Skip to content

diff: the pane notices a finished merge by itself, and stays quiet on an unusual branch name - #98357

Merged
poteat merged 1 commit into
mainfrom
poteat/diff-read-parity
Sep 30, 2026
Merged

poteat merged 1 commit into
mainfrom
poteat/diff-read-parity

Conversation

@poteat

@poteat poteat commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Summary

TLDR: the diff pane notices a merge finished elsewhere, and no longer starts git every two seconds on some branches

Three places where the open pane now behaves as the built-in panel does, or costs less while nothing is happening.

Notes

  • The pane watches the repository's HEAD from the moment it opens, not from its first successful read. A merge finished in another terminal, or a rebase aborted there, clears "Diff unavailable" by itself within a few seconds, with no edit and no command, however soon after the pane opened.
  • An open pane no longer starts git every two seconds on a branch with an unusual name (a # in it, or letters outside ASCII). It dates HEAD's own log instead, and a commit or checkout made elsewhere is still noticed. Where that log is absent nothing changes. A ref written without git on such a branch waits for the next edit or command.
  • A conversation started over with /clear under an open pane counts the pane as shown once for the new conversation, as the person's own.
  • Nothing looks at HEAD for a pane nobody sees.
  • The diff also tidies names and comments in the files it touches: test titles shortened to fit the line, a doc comment shortened, a redundant annotation dropped. No other behaviour changes.

Test Plan

  • claude plugin test mods/diff passes
  • Start a merge that conflicts, open /diff (it reads "Diff unavailable"), finish the merge in another terminal right away: the pane shows the diff within a few seconds with no edit
  • On a branch named fix/#12, open /diff and leave it idle for a minute while watching the process list: no git process starts; then commit from another terminal: the pane follows
  • Open the pane, /clear: the pane stays up and shows the fresh read

Revert-proof: 7 new tests fail with the two modules' changes reverted (the mod's own suite, run against the unchanged modules)

Changelog

@poteat
poteat enabled auto-merge (squash) September 30, 2026 19:15
@poteat
poteat merged commit 525d3b3 into main Sep 30, 2026
3 of 5 checks passed
konsta95 added a commit to konsta95/claude-code that referenced this pull request Sep 30, 2026
poteat's HEAD watch from the pin, quiet polling on unusual branch names,
and the /clear shown mark, fitted into the bundle's ownership model:

- register(): poteat's doc wording, with anthropics#94847's in-tree fetch clause kept.
- probeBackend: startPoll runs right after the pin, as poteat's does after
  `backend ??= probed`. Here the pin follows the owner check, so a probe
  overtaken while it reads the store starts no watch.
- refresh: a listed read no longer starts the poll (poteat).
- placePane: poteat's keepBaseline() on open. The shown mark stays with the
  bundle's recordShown, which is fenced by epoch and close.
- openOnRestore: the bundle's epoch guard is kept. poteat's change there
  only restyles the same read.
- /clear under an open pane (confirmSessionChange): the pane counts as shown
  for the new conversation with trigger 'manual', and its HEAD baseline is
  kept after the pin (poteat's two additions).
- register.test.ts: anthropics#94847's resumed-session test is kept, and poteat's
  retitle is taken.

Co-authored with a harness running Claude and Codex teams.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: 16cb7844-98c6-4af7-b67a-3e9d16705e7f
konsta95 added a commit to konsta95/claude-code that referenced this pull request Sep 30, 2026
anthropics#98357's keepBaseline() read HEAD outside the bundle's 'head' lifecycle.
While earlier HEAD reads were held, each /clear under an open pane
started another git process: 6 and 12 reads where the capacity tests
allow 3. The baseline read now runs as 'head' work. It shares a poll's
read, waits for capacity, and does not start once the pane is hidden.

Tests:
- owner-lifecycle: the four HEAD-count tests also count the baseline
  read at each open and each /clear. Without the two keepBaseline()
  calls they read the bundle's former counts.
- register: poteat's /clear shown test switches sessions through
  Fixtures.switchSessions. Like the bundle's other /clear tests since
  5d5f379, it now ends the old session before the ID changes.

Co-authored with a harness running Claude and Codex teams.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: 16cb7844-98c6-4af7-b67a-3e9d16705e7f
konsta95 added a commit to konsta95/claude-code that referenced this pull request Sep 30, 2026
poteat's batched hunks read (one git child for every drawn file), fitted
into the bundle's body ownership:

- fetchBodies: each call reads its new rows with one
  pinned.fetchHunks(data, files) run through lifecycle.runBody. A read
  skipped before it starts is not a Git failure. Its answer is shown only
  while its owner and stamp are current. bodyLoads becomes anthropics#98445's set of
  asked paths.
- Lifecycle: one body read per view at a time, two across views as
  before. BODY_FETCH_CONCURRENCY, which anthropics#98445 deletes, set the old
  per-view limit.
- fetchHunks takes an optional isWanted, and a read that can no longer be
  shown starts no further child for the paths past MAX_PATHSPEC_CHARS or
  left unread by a cut answer. Without it, a split read released after
  /clear or a base switch started its second child for the ended view.
- register() doc and openOnRestore: the bundle's text and epoch guard, as
  in the anthropics#98357 merge.

Tests:
- owner-lifecycle: the three BODY_FETCH_CONCURRENCY tests count batched
  children, and the lifecycle world records every asked path. The skip
  test now queues its refresh's batch behind two held batches, so /clear
  skips it. New: a split read revoked by /clear or a base switch starts
  no further child.
- fetch-hunks: a read no longer wanted asks no further child.

Co-authored with a harness running Claude and Codex teams.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: 16cb7844-98c6-4af7-b67a-3e9d16705e7f
konsta95 added a commit to konsta95/claude-code that referenced this pull request Sep 30, 2026
main now has poteat's anthropics#98374, anthropics#98445 and anthropics#98357 as squash commits
(9778ad7, 292c5b8, 525d3b3). Its mods/ is identical to 732e167
with the three PR heads merged, which this bundle has already merged
from the heads. The six files that conflict keep the bundle's text from
the first parent, so mods/ is unchanged by this merge. CHANGELOG.md and
feed.xml come from main.

Co-authored with a harness running Claude and Codex teams.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: 16cb7844-98c6-4af7-b67a-3e9d16705e7f
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.

2 participants