Skip to content

feat(files): refresh the files tree when the app changes the workspace - #3

Merged
Francois3d merged 1 commit into
localfrom
agent/files-live-entry-refresh
Aug 29, 2026
Merged

Francois3d merged 1 commit into
localfrom
agent/files-live-entry-refresh

Conversation

@Francois3d

Copy link
Copy Markdown
Owner

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.refresh runs on checkpoint, on turn settle, and on every write through the app — it just never told anyone. subscribeProjectFileChanges already 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 inside WorkspaceEntries.refresh rather than at its three call sites, so every present and future caller is covered by construction. Clients re-read through projects.listEntries, keeping limits, ordering and error mapping in one place.

Layer Change
Contracts ProjectEntriesChangedEvent, the RPC reusing ProjectListEntriesInput, registered on WsRpcGroup
Auth Read scope entry — the map is typed off the RPC group, so omitting it is a compile error
Server PubSub keyed by normalised workspace root; watchEntries routed via observeRpcStreamEffect
Client One invalidate line on the shared listEntries atom, mirroring readFile directly below it

watchEntries returns Effect<Stream, …, Scope> rather than a bare Stream: acquiring the subscription is the effect, consuming it is the stream, so a caller that has awaited it is already listening. That is what observeRpcStreamEffect exists 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 of PubSub.subscribe breaks it, so the ordering is load-bearing and now explicit.

Checked live in the web client with the Files panel open and untouched throughout:

Criterion Result
Agent creates a file during a turn → appears agent-created.txt appeared, no remount
Agent deletes it → disappears gone after the delete turn
touch from a terminal → still nothing absent after 15s, which also rules out polling

A 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

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>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Aug 29, 2026
@Francois3d
Francois3d merged commit 02b0f7c into local Aug 29, 2026
6 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant