Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

fix(cli): isolate ambient session IDs in telemetry lifecycle tests

Abierto Apto para principiantes
#1,050 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
88/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
cli, testing-qa

Línea de trabajo

Inspecciona cli/tests/contexts/telemetry/telemetry-lifecycle.integration.test.ts y cli/tests/e2e/telemetry-lifecycle.e2e.test.ts; a continuación, rastrea la configuración del entorno a través de cli/tests/helpers/git-sandbox.ts y cli/tests/helpers/telemetry-sandbox.ts. Ejecuta el comando de Vitest dirigido con un CODEX_THREAD_ID artificial, actualiza únicamente los auxiliares de prueba para controlar explícitamente las variables de sesión relevantes y verifica que los 42 tests pasen tanto con esa variable definida como eliminada, sin cambiar la precedencia en producción.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.ts
  • cli/tests/e2e/telemetry-lifecycle.e2e.test.ts
  • Relevant helpers: cli/tests/helpers/git-sandbox.ts and cli/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:

  1. 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
    
  2. Observe failures where the commit trailer contains codex-test-session instead of the fixture's CLAUDE_CODE_SESSION_ID.

  3. 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.ts
    

    The 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_ID in the commit trailer.
  • The tests also pass when CODEX_THREAD_ID is 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

Lenguaje dominante
TypeScript
Estrellas
481
Forks
45
Merge medio
1 d 12 h
PR fusionados (30 d)
78

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ai-driven-dev/framework

Todos los issues de ai-driven-dev/framework

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.