Skip to content

feat: Git Changes widget for a space's working tree - #160

Merged
sanchitrk merged 4 commits into
canaryfrom
claude/git-changes-widget
Nov 13, 2026
Merged

sanchitrk merged 4 commits into
canaryfrom
claude/git-changes-widget

Conversation

@sanchitrk

@sanchitrk sanchitrk commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

A desktop widget that shows the working-tree changes of the space a thread is placed in, built on the space's git daemon. Opened from a thread's More menu → Git Changes, beside the thread.

What

App server

  • changes.status { machineId, spaceId }: the git daemon's last plugin.git.status, from the machine_space_state mirror (re-read on sync/state notices). Never wakes a sandbox.
  • changes.diff { machineId, spaceId, files? }: patches over daemon.call on the space's machine; errors unavailable | detached | failed.
  • changes.space { machineId, spaceId }: folder, kind, environment (from the machine's stored sandbox rows) and the threads placed in the space.
  • The thread line carries its spaceId.

Widget (apps/web/src/widgets/changes/)

  • Every changed file stacked in one scroll, folded by default; per-file and fold-all folding with a 180ms slide; inline or split diffs (@pierre/diffs 1.6.2, worker pool); ←/→ and a file list; untracked folders listed as their files.
  • Space line under the toolbar: folder · branch · environment (Local / Worktree / <Driver> Sandbox) · Updated N Ago, and "Shared by N Threads" with the threads sharing the working tree (the changes are the space's, not one thread's).
  • Smooth with hundreds of files: off-screen diffs skipped, memoized rows, data / fold state / scroll kept across tab switches, a skeleton only for a slow cold open (fades in after 300ms).
  • Phosphor icons; standard title-case copy.

Harness: a local space's daemons now start on a daemon.call (and stop on the same idle timer), so a host project's diff no longer disappears after an idle hour. Sandbox spaces still never start from a call.

Also: the Skills section's placeholder fades in only for a slow load, and the list is kept between visits.

Verified

  • E2E apps/server/test/changes.test.ts (real CodeWork server, pinned 69th clone): status, full and single-file diff, spaceId on the line, the Space read (one and two sessions in a folder, unknown space), a local space no run mounted serving its diff, revert → no changes. Artifact __artifacts__/changes.json.
  • Harness git daemon E2E (host), CodeWork daemon RPC test, app server mirror/schema/reads tests.
  • Real Electron app with a real model: a 720-file diff (this repo reset 20 commits) and a small repo — folding, fold-all, navigation, inline/split, 24 tab switches with 0 layout shifts, cold-open skeleton, live updates after runs.
  • vp check, vp run typecheck, vp run knip:check.

Large diffs (Daytona benchmark, 69th, 100 → 1000 tracked files)

Status and live diffs held up to 1000 files (status 77 KB, mirrored in 1–3 ms; diff 0.5–0.9 s warm, 1.46 MB). Fixed from the findings:

  • Per-file patch caps: an over-cap file gets an empty patch with its counts instead of cutting off later files; the 1 MB cache keeps what fits (truncated); a left-out file is read alone when unfolded.
  • Status refresh on a diff request, never waking a space (a sandbox not held by a run stays dirty for its next mount).
  • Error row under the Space line ("Diffs Unavailable · reason · Retry"); "The Sandbox Is Stopped" only when it is; failed diffs retried on open / show / run start or end; no background diff fetch for hidden frames.
  • Large single diffs virtualized past 200 lines; plain rendering past 500k characters. A/M/D letters beside the coloured names.
  • A repo with no commits published head: undefined, which broke the event feed; fixed at the source.

Not covered

  • The Worktree label and "The Sandbox Is Stopped" were not seen live.
  • Expanding unchanged lines needs file contents (tracked separately).

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

sanchitrk and others added 4 commits November 13, 2026 17:26
A space's daemons stopped after an idle hour, and only a run's mount
started them again, so a host project's diff was unavailable until the
next run. Reading a local space wakes nothing, so a daemon.call there now
starts its daemons and waits for the start; the same idle timer stops
them again. A sandbox space still never starts from a call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A desktop widget showing the working-tree changes of the space a thread
is placed in, from the space's git daemon:

- app server: changes.status (the git daemon's mirrored status),
  changes.diff (patches over daemon.call on the space's machine) and
  changes.space (folder, kind, environment and the threads sharing the
  space); the thread line carries its spaceId
- widget: every changed file stacked and folded by default, per-file and
  fold-all folding with a short slide, inline or split diffs rendered with
  @pierre/diffs in a worker pool, a file list and arrow navigation, and a
  Space line naming the folder, branch, environment (Local, Worktree,
  <Driver> Sandbox), freshness and the threads sharing the space
- stays smooth with hundreds of files: off-screen diffs are skipped, rows
  are memoized, data, fold state and scroll survive switching tabs, and a
  skeleton fades in only for a slow cold open
- opened from a thread's More menu as Git Changes
- Skills in project settings: the placeholder fades in only for a slow
  load and the list is kept between visits

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… git daemon

From a 1000-file Daytona benchmark:
- The cache kept nothing once patches passed 1 MB, so a let-go sandbox's
  diff failed. Each file is now sized from the status line counts and read
  only if it fits; a file that does not gets an empty patch with its counts
  (later files keep theirs), untracked files over 5 MB are skipped, a file
  asked for alone is read by its real size, and an over-cap result says
  truncated. Live reads cap at 10 MB the same way.
- A diff request marks the status for refresh: a local space re-reads, a
  sandbox not held by a run stays dirty for its next mount (never woken).
- A repository with no commits published head: undefined, which the event
  feed cannot encode; head and branch are left out instead.
- Literal pathspecs, and the over-200 untracked count reads NUL-separated
  names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A slim warning row under the Space line when diffs are unavailable
  (with the reason and Retry), sliding in and out; the file list stays.
- "The Sandbox Is Stopped" only when it is; otherwise diffs appear during
  the next run. A failed diff is retried on open, when the frame is shown
  and when a run in the space starts or ends.
- A file left out of the bulk diff is read alone when unfolded, shown only
  if its counts match.
- Diffs over 200 lines are virtualized; past 500k characters word diff and
  highlighting are off.
- A/M/D letters beside the status-coloured names.
- changes.space re-reads only for its own space, sessions and threads,
  debounced; a hidden frame does not fetch the diff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sanchitrk
sanchitrk merged commit 45a0e02 into canary Nov 13, 2026
1 check passed
@sanchitrk
sanchitrk deleted the claude/git-changes-widget branch November 13, 2026 14:36
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.

1 participant