Repository navigation
feat(files): refresh the files tree when the app changes the workspace - #3
Merged
Merged
Conversation
The Files panel only re-listed on remount or after its 30s staleness window lapsed, so files an agent created or deleted during a turn did not appear. The server already knew: `WorkspaceEntries.refresh` runs on checkpoint, on turn settle, and on every write through the app. It just never told anyone. Adds `subscribeProjectEntryChanges`, a streaming RPC carrying a coarse signal with no payload, published from inside `refresh` so all three call sites are covered by construction. Clients re-read through `projects.listEntries`, so limits, ordering and error mapping stay in one place. The client change is one `invalidate` line on the shared `listEntries` atom, which web, desktop and mobile all read. No new filesystem watchers and no polling: changes made outside the app still need a remount, which is the follow-up ticket's job. Refs #1 Model: Claude Opus 5, harness: Claude Code Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Closes #1
Problem
The Files panel only re-listed on remount or after its 30s staleness window lapsed, so a file an agent created or deleted during a turn did not show up. The server already knew the tree had moved —
WorkspaceEntries.refreshruns on checkpoint, on turn settle, and on every write through the app — it just never told anyone.subscribeProjectFileChangesalready keeps an open file's contents fresh; nothing covered the file list.How it was fixed
A new streaming RPC,
subscribeProjectEntryChanges, carrying a coarse signal with no payload. It is published from insideWorkspaceEntries.refreshrather than at its three call sites, so every present and future caller is covered by construction. Clients re-read throughprojects.listEntries, keeping limits, ordering and error mapping in one place.ProjectEntriesChangedEvent, the RPC reusingProjectListEntriesInput, registered onWsRpcGroupwatchEntriesrouted viaobserveRpcStreamEffectinvalidateline on the sharedlistEntriesatom, mirroringreadFiledirectly below itwatchEntriesreturnsEffect<Stream, …, Scope>rather than a bareStream: acquiring the subscription is the effect, consuming it is the stream, so a caller that has awaited it is already listening. That is whatobserveRpcStreamEffectexists for, and it is what makes the ordering testable.No new filesystem watchers and no polling. Changes made outside the app still need a remount — that is the follow-up ticket's job, not a gap here.
Verification
Server test drives the subscription with a write through
projects.writeFile, with a completed round trip on the same socket as the happens-before rather than a sleep or a retry loop. A probe confirmed this matters: injecting a delay ahead ofPubSub.subscribebreaks it, so the ordering is load-bearing and now explicit.Checked live in the web client with the Files panel open and untouched throughout:
agent-created.txtappeared, no remounttouchfrom a terminal → still nothingA file created from the terminal beforehand stayed invisible until an app-driven refresh fired, then surfaced with the rest — the coarse signal behaving exactly as specified.
No before/after images: the panel is pixel-identical either way, since what changed is when it re-lists, not how it looks.
Model: Claude Opus 5, harness: Claude Code