Skip to content

feat(framework): a session says which worktree it ran in #695

Description

@blafourcade

Split out of #693, which asks where the journal lives. This asks the smaller question underneath it: can a reader tell?

Context

session_start names the run, the project, the tool and the vendor session. It does not name the worktree, so two sessions from two worktrees of one repository are indistinguishable in the journal.

Today that is hidden, because each worktree keeps its own journal — a report simply never meets the other one's sessions.

Why it is worth doing whichever way #693 goes

  • Journal stays per worktree: the field is what lets a reader gather several journals and still tell them apart.
  • Journal becomes shared: the field is what stops one repository's sessions collapsing into an undifferentiated pile.

Either way it is one field on a line already written, and it makes "what did this branch cost" answerable without deciding anything else first.

Expected

session_start carries the worktree it ran in, taken from git rather than from an environment variable — an agent runner's own variable names its concept, not the repository's.

git rev-parse --show-toplevel     the worktree
git rev-parse --git-common-dir    the repository they share

A repository with no worktrees answers the same for both, which is the case to keep cheap.

Acceptance

  • session_start names the worktree and the repository it belongs to.
  • A plain clone, with no worktree, is unchanged in shape and costs no extra git call.
  • Two sessions from two worktrees are distinguishable in the journal.
  • The field is absent rather than empty when git cannot answer, like every other optional field on that line.

Out of scope

Where the journal is written, and what a report does with the field. #693 owns the first; the second follows it.

Relations

Field Value
parent #631
related #693, #663

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