Skip to content

fix(framework): a git worktree gets its own journal, by accident rather than by decision #693

Description

@blafourcade

Context

The journal is written under <repoRoot>/aidd_docs/runs/, and repoRoot comes from git rev-parse --show-toplevel.

In a worktree, that resolves to the worktree, not the repository:

worktree root:  /tmp/wt/feature      ← what the hook resolves
common dir:     /tmp/wt/main/.git    ← the shared repository
main root:      /tmp/wt/main

So each worktree keeps its own journal. Nobody decided that; it is what git resolution happens to give.

Why it matters now

Agent runners give each agent its own worktree — Orca sets ORCA_WORKTREE_ID and does exactly this. That is the shape this measurement will actually meet in the field.

Today, a report run in worktree A sees only A's journal. Sessions from worktree B still contribute their tokens — the sink is machine-level and pools everything — but with no step and no task. They read as unattributed, and nothing says why.

The decision to make

Both answers are defensible and they answer different questions:

  • Per worktree. "What did this feature branch cost." Attribution stays with the work.
  • Shared, at git rev-parse --git-common-dir. "What did this project cost this week." One journal for every branch of one repository.

A third possibility is to record the worktree on the session_start line and let the reader choose, which keeps both questions answerable and costs one field.

Expected

Whatever is chosen is chosen, written down, and tested — not inherited from a git default.

Actual

Inherited from a git default, undocumented, and invisible in the output: a cross-worktree session is indistinguishable from a session no journal ever covered.

Cheap to change

Only attribution is per-worktree. The figures already pool machine-wide, so nothing measured is lost or has to be migrated whichever way this goes.

Relations

Field Value
parent #631
related #663, #629

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    Status
    Ideation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions