fix(cli): isolate ambient session IDs in telemetry lifecycle tests
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 88/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- cli, testing-qa
调研方向
检查 cli/tests/contexts/telemetry/telemetry-lifecycle.integration.test.ts 和 cli/tests/e2e/telemetry-lifecycle.e2e.test.ts,然后通过 cli/tests/helpers/git-sandbox.ts 和 cli/tests/helpers/telemetry-sandbox.ts 跟踪环境设置。使用人工设置的 CODEX_THREAD_ID 运行定向 Vitest 命令,仅更新测试辅助工具以显式控制相关的会话变量,并验证在该变量设置和移除两种情况下全部 42 个测试均通过,同时不改变生产环境中的优先级。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- TypeScript
- 星标
- 481
- 派生
- 45
- 平均合并
- 1 天 12 小时
- 30 天内合并 PR
- 78
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ai-driven-dev/framework 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 83/100
ai-driven-dev/framework#1035 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
ai-driven-dev/framework#1002 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
ai-driven-dev/framework#952 ·
维护者通常 1 天内回复
-
refactor(aidd-orchestrator): the check zone says when to stop, and reviews its axes in one round未关闭
难度 2/5 1-3 小时 新手友好度 76/100
ai-driven-dev/framework#887 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
ai-driven-dev/framework#1052 ·
维护者通常 1 天内回复
查看 ai-driven-dev/framework 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 65/100
521xueweihan/HelloGitHub#4025 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
voidzero-dev/void#478 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 69/100
Small-tailqwq/dsh-deep-whale#207 ·
维护者通常 1 天内回复
-
The inspector never shows the instances field, so scaling out is unreachable可能已有人在做 @Mrkewl 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
xevrion/breakscale#96 ·
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
Flux159/mcp-server-kubernetes#384 ·