fix(cli): check fails a session that belongs to another project

Open Beginner friendly
#872 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
cli, observability

Research direction

Start in cli/src/contexts/telemetry/domain/telemetry-claim.ts at sessionAnchoredClaim and compare its handling with noAnchorClaim. Inspect the existing project_id data or transcript lookup described in the issue, then make the anchored-session result distinguish a different project as unknown while keeping this project's missing run file as fail.

Written by the indexing model from the issue text.

Description

Description

aidd telemetry check reports hook fired FAIL — this session left no run file when the anchored session belongs to a different project. The hook is fine; the session simply never worked in this repository.

The anchor is inherited: any process nested inside a Claude Code session sees CLAUDE_CODE_SESSION_ID, whatever directory it runs in. resolveSessionAnchor (cli/src/contexts/telemetry/domain/session-anchor.ts) already documents that inheritance for the Codex-inside-Claude case and orders the variables accordingly, but nothing downstream asks whether the anchored session belongs to this project.

So a user running check from a shell that another tool's session spawned — an agent running the 02-check skill against a second repository, a terminal opened inside an editor session, a CI step under an agent — is told the chain is broken when it is not. That is the failure this layer forbids elsewhere: an unknown shown as a negative instead of being named.

Affected

cli/src/contexts/telemetry/domain/telemetry-claim.tssessionAnchoredClaim, reason session-left-no-run-file

Expected

Three distinguishable answers, as the claim already models them:

  • the anchored session journalled here → ok
  • no anchor at all → unknown, which noAnchorClaim already returns
  • an anchor that belongs to another project → unknown, naming that, not fail

fail stays for what it means: this project's own session ran and the hook wrote nothing.

Observed
  hook fired            FAIL  this session left no run file — the newest one is from 2026-09-16T03:30:54Z
  session journalled    ok    3 of 5 run file(s) carry more than session_start
  records join          ok    12 of 20 record(s) joined a step, 8 unattributed

Every other claim on the same run says the chain records. Only the anchored-session claim fails, and it fails for a session that was never supposed to appear in this repository.

Steps
  1. Open a Claude Code session in project A.
  2. From that session, run aidd telemetry check in project B, where measurement is on and sessions have been journalled.
  3. hook fired reports FAIL, naming a run file that has nothing to do with the anchored session.
Possible direction, not a prescription

The data to tell the two apart is already read by this command:

  • the stored records carry vendor_id and project_id, so an anchor found under another project is decidable;
  • Claude Code's own transcript for a session id sits under its project directory, and the tool files readable claim already walks those files.

Either source answers "is this anchor this project's session"; neither needs a new input. The change is one reason, one branch, and its display string.

Environment
  • Tool: Claude Code
  • CLI: 5.3.0
  • Plugin: aidd-telemetry 0.2.0
  • OS: macOS

🤖 Generated with Claude Code

https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp

Dominant language
TypeScript
Stars
481
Forks
45
Avg merge
17h 40m
Merged PRs (30d)
106

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ai-driven-dev/framework

All issues in ai-driven-dev/framework

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.