feat(web): watch files, store keys and terminals on the host and retire the last seq 0 events
Merged
GN
8d ago+1792+1792+0123456789012345678901234567890123456789-1301-1301-0123456789012345678901234567890123456789
Summary
- The host still sends file changes, branch renames and browser-open requests as
seq = 0events. A client can miss one, and a client with no session subscription never gets it. - This change moves them to the state watches from the earlier watch PRs. It adds a store-key watch and a terminal-set watch. No
seq = 0event leaves the relay except theauth_requiredhandshake frame.
Related Issue
Refs #1070
Searched open and closed PRs for the same problem. No PR covers it. This is the sixth PR for the read-model work in #1070. It builds on the state watch PRs (#1094, #1096). A follow-up PR adds the host-offline state and closes the issue.
Type of Change
- feat: new feature
- fix: bug fix
- docs: documentation only
- style: formatting or non-functional styling changes
- refactor: internal cleanup with no behavior change
- perf: performance improvement
- test: adds or updates tests
- build: build or dependency changes
- ci: CI/CD workflow changes
- chore: maintenance or tooling
- revert: reverts a previous change
What Changed
- The host has three new watches.
fsis scoped by project and sends one debounced batch of changed paths per delta.storeis scoped by key and sends the value after each write or delete. It acceptsshared/...keys and thedevice/...keys of the connection's own device.terminalsis scoped by project and lists its terminals without claim credentials. watch_project,unwatch_project,fs_changedandfs_watch_endedare gone. Thefswatch replaces them.worktree_branch_renamedis achat_historydelta.browser_open_requestis anagentsdelta.- A delta that the host cannot queue leaves a revision gap. The client then rebuilds from a fresh state.
- The web client watches the explorer directories through the
fswatch. It arms the watch once per project and re-arms it after a reconnect, a lost delta or a refusal. - The web client has a terminal-set hook and a
watchStoreKeycall. The branch-rename hook reads thechat_historydelta. - The client no longer accepts events without a session. Only
auth_requiredskips that check. WS_PROTOCOL_VERSIONgoes from 6 to 7. An old client reloads once.- Desktop is unchanged.
How It Was Tested
-
bun run ci(Biome lint + format + imports, strict mode) -
bun run typecheck -
bun run test -
cargo clippy --all-targets -- -D warnings(in src-tauri) -
cargo test(in src-tauri) - Manual verification completed
- Not applicable
Screenshots or Recordings
No user-visible UI change. The explorer, the terminal list and the branch name stay correct after a missed change or a reconnect. The tests cover the behavior.
CI & Review Gate
- All CI checks pass (PR Validation, Rust Checks, Build Verification, Security Scans)
- Code review comments from CodeRabbit / Claude have been addressed or resolved
- No unresolved review findings remain
Checklist
- My PR title follows the conventional commit format used by this repo
- I linked the related issue or explained why none exists
- I updated docs when needed
- I added or updated tests when needed
- I verified the change does not introduce unrelated modifications
- I read AGENTS.md and followed the contributor guidelines
- A human reviewed the complete diff before submission