Skip to content

fix(aidd-telemetry): keep a worktree's sessions in every report, even after the worktree is removed - #988

Open
VincentMenard76 wants to merge 18 commits into
ai-driven-dev:nextfrom
VincentMenard76:fix/worktree-journal-survives
Open

VincentMenard76 wants to merge 18 commits into
ai-driven-dev:nextfrom
VincentMenard76:fix/worktree-journal-survives

Conversation

@VincentMenard76

@VincentMenard76 VincentMenard76 commented Oct 9, 2026 •

Copy link
Copy Markdown

🎯 What & why

A session run in a linked worktree was missing from every report outside that worktree, and lost for good on git worktree remove: the journal lived at the worktree's own root, git-ignored, and the CLI only read the checkout it ran in. Agent runners give every agent its own worktree, so this was the common case.

🛠️ How it works

  • One journal per clone, under <git common dir>/aidd/runs/ (repo.cjs runsDir). Outside every working tree: never committed, no branch dirtied, untouched by git worktree remove, and a bare clone has one too. AIDD_RUNS_DIR still replaces it. Decision and refused alternatives: one-run-journal-per-clone.md.
  • The CLI finds the same directory from files, not by spawning git (git-common-dir.ts, paths.ts). A parity test runs the hook's git rev-parse and the CLI's file walk side by side over a plain checkout, a subdirectory, a linked worktree and a bare clone's worktree.
  • Earlier journals stay counted: the reader also reads the pre-move aidd_docs/runs of every live checkout of the clone, never writes there, and prefers the new copy when one session has both. forget previews and removes those directories too; check names the real directory instead of a hardcoded aidd_docs/runs.
  • No worktree axis in the report: only the cumulative figure matters, and task, backlog, flow and agent already answer what a piece of work cost. worktree_id stays in the journal. fix(aidd-telemetry): a session run in a git worktree is missing from every report outside that worktree, and lost when the worktree is removed #932 was amended to say so.

🧪 How to verify

⚠️ Heads-up

  • Release order. The hook ships in the aidd-telemetry plugin, the reader in @ai-driven-dev/cli, released apart. A newer CLI reads both locations; an older CLI with a newer plugin sees no new session. The plugin README now says to update aidd first, and the decision record lists it. If maintainers prefer a transition period where the hook also writes the old location, that is a follow-up.
  • Bundle budget raised 734 → 745 KB (check-bundle-size.mjs, registry entry added): next was already at 733.98 KB, this change measures 737.25 KB.
  • The decision record is marked proposed, for a maintainer to confirm or overturn.
  • Out of scope, tracked on feat(aidd-telemetry): a task declares its backlog once, and every session on it is found #975: the backlog axis still reads none for a task folder that exists only on another worktree's unmerged branch.
  • Commits made with lefthook disabled: its Windows hooks are broken (fix(lefthook): Windows/Git Bash pre-commit hooks fail with node syntax error #948). commitlint and the pre-commit checks were run by hand; validate.yml replays them here.

🔗 Linked issue

Closes #932

✅ I certify

  • I DO CERTIFY I READ EACH LINE OF THE PULL REQUEST BECAUSE I AM A SOFTWARE ENGINEER, NOT A AI PUPPY.

🤖 Generated with Claude Code

VincentMenard76 and others added 18 commits October 9, 2026 16:21
…on git directory

The hook wrote each session's journal at the root of the checkout it ran in,
so a session run in a linked worktree was missing from every report outside it
and lost for good on git worktree remove. Runs now land in
<git common dir>/aidd/runs/, shared by every worktree and outside every
working tree. AIDD_RUNS_DIR still replaces the location.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reader resolves the common git directory from files, as the hook's git
rev-parse does, and still reads the pre-move aidd_docs/runs of every live
checkout so earlier sessions stay counted; the new copy wins for one session.
forget previews and removes those earlier journals too, and check names the
real directory. The bundle budget moves with its registry entry.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds the decision record, points the journal contract, the plugin README and
its init skill at the new location, and keeps the task's brainstorm, plan and
review beside it.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…matted

A runner's tmpdir can be an 8.3 alias of the directory git records, so the
path tests now start from the canonical temp root. One e2e expression is
reformatted to satisfy the formatter.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the probes

The identifier-join probe and the real-tools smoke both looked under
aidd_docs/runs, so they reported a journal as missing once the hook moved it
under the common git directory.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An older CLI never reads the new journal location, so a newer plugin alone
would drop new sessions from its reports and from forget.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
telemetry on still said deleting the aidd_docs/runs/ line would commit the
journal; new journals live under the clone's git directory, so the line now
only keeps an earlier version's journals out of a commit. The reader also
drops a filter that could never remove a directory.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the sink empty and the worktree removed, a report from the main
checkout reads the session from Claude Code's own transcript and attributes
it to its task, through the journal the real hook wrote.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sion once

check counted run files from the earlier aidd_docs/runs too but named only
the new directory, and listForeignSchemas reported one session twice when it
had a file in both places. The label now names every directory read, and
foreign schemas go through the same one-file-per-session walk as list.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd verify

The architecture table still called the journal git-ignored, and the verify
step used a bash-only glob and ignored AIDD_RUNS_DIR. The worktree e2e also
names what its removal case asserts.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The schema test now proves the common-dir copy is the one judged, and the
removal e2e proves the pre-move session's cost is still reported, unattributed,
rather than passing when its row vanished. The plugin README paragraph is
rewrapped.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…get per directory

legacyRunsDirs compared paths as spelled, so a worktree opened through a
junction or symlink appeared twice and forget previewed and counted its files
twice. It now compares real paths. forget also reports each earlier journal
on its own line, as the preview does, and names the directory of a file it
could not remove.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…emove

A failure in the project's own journal still showed only a file name; it now
carries its directory like an earlier journal's does. The store port documents
listRunFilesIn, and the decision record names the separate-git-dir and
submodule limit.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on failure

Two reader tests removed their extra directory only on success; it now goes
in the shared teardown. The port states listForeignSchemas reports one entry
per session. The plan records why telemetry on changed, and the review is
refreshed with the final verdict and its evidence.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts evidence

The previous commit announced this refresh but the file write had failed;
the review now records the seven rounds, the mutation evidence and the
accepted limits.

Refs ai-driven-dev#932

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VincentMenard76
VincentMenard76 marked this pull request as ready for review October 10, 2026 03:37
@VincentMenard76
VincentMenard76 requested a review from a team as a code owner October 10, 2026 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant