fix(strategy): warn when a commit is left unlinked with a live sibling-worktree session#1858
Closed
ColeDriver wants to merge 1 commit into
Closed
fix(strategy): warn when a commit is left unlinked with a live sibling-worktree session#1858ColeDriver wants to merge 1 commit into
ColeDriver wants to merge 1 commit into
Conversation
ColeDriver
force-pushed
the
fix/warn-unlinked-commit-live-sibling-session
branch
3 times, most recently
from
July 26, 2026 05:12
b4e0715 to
6cd68db
Compare
…g-worktree session Commits made in a worktree with no matching session were silently left without an Entire-Checkpoint trailer even when a live agent session was running in another worktree of the same repo -- the silent no-trailer case in #1852 (94% of commits unlinked in one reported case). The miss was logged at DEBUG, so nothing surfaced it. On the no-session path, prepare-commit-msg now checks whether any non-ended session exists in a different worktree of the same repo (the session store is already scoped to this repo's git common dir). When one does, it logs at WARN with the offending worktree(s) and the `entire session adopt` remedy instead of swallowing the miss at DEBUG. A plain sessionless commit -- the common case -- stays quiet, and the check is skipped entirely when session listing errored so the hook stays resilient. This makes the failure visible; the underlying cross-worktree matching is unchanged. Refs #1852 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ColeDriver
force-pushed
the
fix/warn-unlinked-commit-live-sibling-session
branch
from
July 26, 2026 05:25
6cd68db to
41e5807
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Fixes the silent no-trailer case in #1852. Commits made in a worktree with no matching session were silently left without an
Entire-Checkpointtrailer — even when a live agent session ran in another worktree of the same repo. In one reported case this unlinked 101 of 108 commits (94%). The miss was logged at DEBUG, so nothing surfaced it to the person runninggit commit.Change
On the no-session path in
prepare-commit-msg, the hook now checks whether a live agent session exists in a different worktree of the same repo. When one does, it (1) prints a notice to stderr during the commit — the same channelwarnIfAttributionDivergeduses, so the failure is actually visible — and (2) keeps a structuredWARNin.entire/logsfor diagnostics. The stderr notice reads:Sessionless commits — the common case — stay quiet; the check is skipped when listing errored. Underlying matching is unchanged — this makes the residual silent case visible, it doesn't change what gets linked.
Notes / decisions
activeSessionInteractionThreshold), mirroring the staleness guard used elsewhere in this file — a crashed session that never reaches ENDED won't nag forever. ENDED / stale / adopted-away / imported don't count.--yesis required in the hint: same-repo adoption routes throughadoptFromSameSessionStore, which needs it even on first adoption — the bare command would always error.Tests
t.Parallel()):isLiveSessionInOtherWorktree(same-worktree / sibling-active / sibling-idle / stale / never-interacted / ended / adopted-away / imported),uniqueWorktreePaths,formatUnlinkedCommitNotice.strategysuite passes;maintidx+golangci-lintv2.11.3 clean on changed files;go build ./...,go vet,gofmtclean.Refs #1852