Skip to content

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

Closed

Description

@blafourcade

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.ts — sessionAnchoredClaim, 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

Activity

  1. added a commit that references this issue on Sep 21, 2026
    1333e32
  2. added theissue type on Sep 22, 2026
  3. moved this from Ideation to Done in AIDD Roadmapon Sep 24, 2026
  4. closed this as completedby moving to Done in AIDD Roadmapon Sep 24, 2026
  5. blafourcade commented on Sep 24, 2026

    @blafourcade
    ContributorAuthor

    Resolved by #886, merged into next on 2026-09-21.

    Verification:

    • PR CI: all required checks passed, including Windows, telemetry mutation, typecheck, lint, and test/coverage.
    • Local targeted suite: 4 files, 148 tests passed.
    • A foreign-project anchor now reports unknown with reason anchor-in-another-project; this project's own missing run file still reports fail.

    Closing as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions