fix(cli): isolate ambient session IDs in telemetry lifecycle tests
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 88/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- cli, testing-qa
Hướng nghiên cứu
Kiểm tra cli/tests/contexts/telemetry/telemetry-lifecycle.integration.test.ts và cli/tests/e2e/telemetry-lifecycle.e2e.test.ts, sau đó truy vết việc thiết lập môi trường qua cli/tests/helpers/git-sandbox.ts và cli/tests/helpers/telemetry-sandbox.ts. Chạy lệnh Vitest có mục tiêu với một CODEX_THREAD_ID nhân tạo, chỉ cập nhật các test helper để kiểm soát rõ ràng các biến phiên liên quan, và xác minh rằng cả 42 test đều pass khi biến đó được đặt cũng như khi bị xóa mà không thay đổi thứ tự ưu tiên trong production.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 481
- Fork
- 45
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 78
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ai-driven-dev/framework
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
ai-driven-dev/framework#1035 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
ai-driven-dev/framework#1002 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ai-driven-dev/framework#952 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
refactor(aidd-orchestrator): the check zone says when to stop, and reviews its axes in one roundĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ai-driven-dev/framework#887 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
ai-driven-dev/framework#1052 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của ai-driven-dev/framework
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
paperclipai/paperclip#16785 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
code-yeongyu/senpi#3661 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
lingdojo/kana-dojo#32731 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug status: needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
mastra-ai/mastra#27538 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Yeachan-Heo/oh-my-codex#3822 ·
Maintainer thường phản hồi trong vòng 1 ngày