fix(cli): isolate ambient session IDs in telemetry lifecycle tests
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 88/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- typescript
- Domaine
- cli, testing-qa
Piste de recherche
Inspecte cli/tests/contexts/telemetry/telemetry-lifecycle.integration.test.ts et cli/tests/e2e/telemetry-lifecycle.e2e.test.ts, puis retracez la configuration de l’environnement via cli/tests/helpers/git-sandbox.ts et cli/tests/helpers/telemetry-sandbox.ts. Exécute la commande Vitest ciblée avec un CODEX_THREAD_ID artificiel, mettez à jour uniquement les helpers de test afin de contrôler explicitement les variables de session pertinentes, et vérifiez que les 42 tests passent à la fois avec cette variable définie et supprimée, sans modifier la précédence en production.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Description
Two telemetry lifecycle tests are not isolated from the parent process environment. When CODEX_THREAD_ID is set, commits created by tests that explicitly set CLAUDE_CODE_SESSION_ID receive the Codex value in their AIDD-Session-Id trailer instead of the fixture's Claude session ID.
Both test helpers build the Git environment from box.gitEnv and then add CLAUDE_CODE_SESSION_ID. The Git sandbox removes Git-specific environment variables, but does not clear ambient session variables. The test delegate gives CODEX_THREAD_ID precedence over CLAUDE_CODE_SESSION_ID, so the inherited Codex value wins.
This is a test-fixture isolation issue. Production session-ID precedence must remain unchanged.
Affected file(s)
cli/tests/contexts/telemetry/telemetry-lifecycle.integration.test.tscli/tests/e2e/telemetry-lifecycle.e2e.test.ts- Relevant helpers:
cli/tests/helpers/git-sandbox.tsandcli/tests/helpers/telemetry-sandbox.ts
Expected behaviour
Each test controls the session variables passed to Git hooks. A test configured with CLAUDE_CODE_SESSION_ID must produce a trailer containing its fixture session ID, regardless of session variables in the parent process.
Observed behaviour
With CODEX_THREAD_ID set in the test runner's environment, the delegate writes that value into AIDD-Session-Id. The tests fail because their assertions expect the fixed Claude fixture ID.
AI tool
Other (test runner environment)
aidd-cli version
N/A (repository tests)
OS
Linux
Additional context
Reproduction
From the repository root:
-
Set an ambient Codex session ID and run the two affected tests:
CODEX_THREAD_ID=codex-test-session pnpm --dir cli exec vitest run \ tests/contexts/telemetry/telemetry-lifecycle.integration.test.ts \ tests/e2e/telemetry-lifecycle.e2e.test.ts -
Observe failures where the commit trailer contains
codex-test-sessioninstead of the fixture'sCLAUDE_CODE_SESSION_ID. -
Run the same tests with the variable removed:
env -u CODEX_THREAD_ID pnpm --dir cli exec vitest run \ tests/contexts/telemetry/telemetry-lifecycle.integration.test.ts \ tests/e2e/telemetry-lifecycle.e2e.test.tsThe tests pass.
Acceptance criteria
- Both lifecycle tests pass when the parent process supplies an artificial
CODEX_THREAD_ID. - Both tests continue to verify the expected fixture
CLAUDE_CODE_SESSION_IDin the commit trailer. - The tests also pass when
CODEX_THREAD_IDis absent. - Existing trailer assertions remain in place and can still detect a regression.
- Production session-ID precedence is unchanged.
- Test helpers must explicitly control relevant session environment variables rather than relying on the parent process environment.
Verification scope
The targeted reproduction was run on the current upstream/next HEAD 940e8e36517c153b320b8496093650770859e253: with CODEX_THREAD_ID=codex-test-session, the two lifecycle test files had 2 failures and 40 passes; both failures received the ambient Codex value instead of the Claude fixture ID. With CODEX_THREAD_ID removed, both files passed (42 tests).
The affected test setup lines trace to commit 0a103e67 in PR #993. PR #1034 contains later telemetry changes; the affected lines still trace to #993.
Related but distinct:
- #630: commit/session trailer feature.
- #940: trailer deduplication with Git 2.39.
- #999: Windows Lefthook command formatting.
No equivalent issue or PR was found in the final searches for CODEX_THREAD_ID, ambient session leakage, or telemetry lifecycle tests.
Code of Conduct
- I agree to follow this project's Code of Conduct.
- Langage dominant
- TypeScript
- Étoiles
- 481
- Forks
- 45
- Merge moyen
- 1 j 2 h
- PR mergées (30 j)
- 77
Préparer son environnement
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de ai-driven-dev/framework
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
ai-driven-dev/framework#1002 ·
Les mainteneurs répondent en général sous 1 jour
-
feat(aidd-dev/test): enforce test effectiveness and test-double disciplinePeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
ai-driven-dev/framework#952 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
refactor(aidd-orchestrator): the check zone says when to stop, and reviews its axes in one roundOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
ai-driven-dev/framework#887 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 1-2 jours Accessibilité débutants 64/100
ai-driven-dev/framework#1084 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 72/100
ai-driven-dev/framework#1081 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de ai-driven-dev/framework
Issues similaires
-
e2e-failure ready-to-code
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
redhat-developer/rhdh-plugin-export-overlays#4580 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
devdotfast/whiteboard#1415 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
area/sessions comp/desktop desktop/sessions P2 type/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
NousResearch/hermes-agent#145383 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
Les mainteneurs répondent en général sous 1 jour
-
enhancement p2 setup
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
vercel/eve#5419 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour