…runnable remedy
#1856 added warnAmbiguousWorktreeSessions for the #1852 case where live
sessions span multiple worktrees and matching refuses to guess, so the
commit is left unlinked. But it only logs to the internal .entire/logs
file and prints no remedy, so the person running `git commit` still sees
nothing -- the "silent" part of #1852 is unchanged for them.
This keeps the structured WARN (diagnostics) and additionally writes a
user-facing notice to stderrWriter -- the same channel
warnIfAttributionDiverged and warnStaleEndedSessions use -- with a
directly runnable remedy:
entire: this commit was not linked to a checkpoint (live agent sessions
span multiple worktrees: ../a, ../b).
run 'entire session adopt <session-id> --from ../a --yes' to link one explicitly.
The command names a concrete session ID rather than the bare
`--from <path>` form: bare --from relies on adoption's auto-detect, which
only considers sessions within adoptRecentWindow (12h) and fails outright
when a worktree has multiple sessions; and same-repo adoption requires
--yes. The named session is the most-recently-active candidate that
adoption will accept (mirrors isAdoptableSourceSession), so the suggested
command actually runs.
Additive only: the warning trigger and the existing log line are
unchanged.
Refs #1852
Follow-up to #1856
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
What & why
#1856 added
warnAmbiguousWorktreeSessionsfor the #1852 case where live sessions span multiple worktrees, matching refuses to guess, and the commit is left unlinked. But it only logs to the internal.entire/logsfile and prints no remedy — so the person runninggit commitstill sees nothing. The "silent" part of #1852 is unchanged for them.Change
Keeps the structured
WARN(diagnostics) and additionally writes a user-facing notice tostderrWriter— the same channelwarnIfAttributionDivergedandwarnStaleEndedSessionsuse — with a directly runnable remedy:The command names a concrete session ID rather than the bare
--from <path>form, because bare--fromrelies on adoption's auto-detect, which only considers sessions withinadoptRecentWindow(12h) and fails outright when a worktree has multiple sessions; same-repo adoption also requires--yes. The named session is the most-recently-active candidate adoption will accept (mirrorsisAdoptableSourceSession), so the printed command actually runs.Scope
Additive only — the warning trigger and the existing log line are unchanged; this just makes the already-detected case visible and actionable. If reviewers want the stderr line throttled (show-once / rate-limited), happy to add that.
Tests
t.Parallel()):formatAmbiguousWorktreeNotice(with/without an adoptable session, empty input) andmostRecentlyAdoptableSession(newest-adoptable, skips ended/ended-at/fully-condensed, nil when none).strategysuite green;maintidx+golangci-lintv2.11.3 andgofmtclean.Refs #1852 · follow-up to #1856
🤖 Generated with Claude Code