Repository navigation
Conversation
Saved-thread entries carry the desktop sidebar's status, pin, snooze, harness, model and scheduled job, and their project is the one the sidebar files them under. list_projects lists every project, subscribe_saved_sessions pushes saved_sessions_changed frames, and create_session accepts any listed project's folder.
Owner
Author
|
Landed on main through #4310, which was built on this branch. |
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.
What
Lets a paired device (the mobile app) show the same thread list as the desktop sidebar: every project and every saved thread on the host, kept in sync. All changes are additive to protocol v1. New fields are optional and the new operations sit behind new capability flags.
status,pinned,snoozed_until,harness,modelandscheduled_job.projectnow matches the desktop's grouping: a worktree's repository, then the repo recorded for the folder, then the folder. It is absent for a root folder or RustCode's data folder.workspacestill holds the thread's own folder.statusvalues areidle | running | needs_input | stalled | review | done, sent as a plain string. Clients show any unknown value asidle.done) thread staysdone.runningandneeds_inputcome from the gateway's live list; the other values come fromstatus.json.snoozed_untilis read-only. The engine stores snooze (snooze.json), so the README line saying snooze lives only in the app was out of date and is fixed here.list_projects(capabilityprojects) lists every project that has a saved thread, newest first, max 500, with atruncatedflag. Each project haspath,name,thread_count,running,needs_inputandupdated_at. Projects with no open thread are included.subscribe_saved_sessions(capabilitysaved_session_updates). The host pushessaved_sessions_changedframes, each holding whole entries: changed threads, removed thread IDs, changed projects and removed project paths. I chose a push subscription over anupdated_sincecursor because a cursor can't report deleted threads, and pin, status and snooze changes don't touch the transcript's mtime. While at least one device is subscribed, the gateway rescans about every 5 s. Transcripts are re-read only whenhistory.json,title.txtorworkspace.jsonchanged, and the scan stops when the last subscriber leaves. Large diffs are split across frames that each stay under the frame limit.saved_sessions_subscribed, then lists. A change that races the listing comes again in a frame, so applying both in arrival order converges.create_session/create_threadaccepts any listed project. Before,pathhad to be inside home or[remote] roots, so a project at e.g./Volumes/...was refused.pathmay now also be exactly a project'spathfromlist_projects. Subfolders of such a project are still refused.Only threads listed by the session store, with files inside it, are reported (same rule as before). The new code is in
remote_gateway/workspace/saved_threads.rs;workspace.rsis at its size cap. There is no Swift client in this repo to update.Wire examples
A device that asked for thread names in the handshake gets the thread-named form; the committed goldens use v1 names. Both are shown below.
list_saved_threadsentry (changed: new optional fields){"kind": "response", "protocol_version": 1, "request_id": "req-saved", "result": {"type": "saved_threads", "threads": [ {"thread_id": "20260714-091502-3fa2c1", "title": "Fix the parser", "project": "/Users/example/projects/parser", "workspace": "/Users/example/worktrees/parser-fix", "updated_at": "2026-07-14T09:40:12Z", "message_count": 42, "state": "saved", "status": "review", "pinned": true, "snoozed_until": "2026-07-15T08:00:00Z", "harness": "codex", "model": "gpt-5.5", "scheduled_job": "nightly-triage"}, {"thread_id": "5f0c2d9e-7a41-4c1b-9d55-0b6c1f2a3e44", "title": "Refactor the session store", "project": "/Users/example/projects/rustcode", "workspace": "/Users/example/projects/rustcode", "updated_at": "2026-07-14T08:02:55Z", "message_count": 118, "state": "shared", "status": "running", "pinned": false, "harness": "claude-code", "model": "gpt-5.5"}, {"thread_id": "20260713-171233-9b0e44", "title": "Untitled", "message_count": 3, "state": "open", "open_in": "app", "status": "idle", "pinned": false} ], "next_cursor": "20260713-171233-9b0e44"}}(v1:
"type": "saved_sessions","sessions","session_id".)list_projects(new){"protocol_version": 1, "request_id": "req-projects", "operation": {"type": "list_projects"}}{"kind": "response", "protocol_version": 1, "request_id": "req-projects", "result": {"type": "projects", "projects": [{"path": "/Users/example/projects/parser", "name": "parser", "thread_count": 12, "running": true, "needs_input": false, "updated_at": "2026-07-14T09:40:12Z"}], "truncated": false}}subscribe_saved_threads(new){"protocol_version": 1, "request_id": "req-saved-sub", "operation": {"type": "subscribe_saved_threads"}}{"kind": "response", "protocol_version": 1, "request_id": "req-saved-sub", "result": {"type": "saved_threads_subscribed"}}(v1:
subscribe_saved_sessions/saved_sessions_subscribed.)saved_threads_changedpush frame (new){ "kind": "saved_threads_changed", "protocol_version": 1, "threads": [{"thread_id": "20260714-091502-3fa2c1", "title": "Fix the parser", "project": "/Users/example/projects/parser", "workspace": "/Users/example/worktrees/parser-fix", "updated_at": "2026-07-14T09:40:12Z", "message_count": 42, "state": "saved", "status": "review", "pinned": true, "snoozed_until": "2026-07-15T08:00:00Z", "harness": "codex", "model": "gpt-5.5", "scheduled_job": "nightly-triage"}], "removed": ["20260713-171233-9b0e44"], "projects": [{"path": "/Users/example/projects/parser", "name": "parser", "thread_count": 12, "running": true, "needs_input": false, "updated_at": "2026-07-14T09:40:12Z"}], "removed_projects": ["/Users/example/projects/old"] }(v1:
"kind": "saved_sessions_changed","sessions","session_id".) Empty lists are left out. Each entry replaces the one under itsthread_id/path, or is added if new.Capabilities in the
threads/sessionsresult"capabilities": [..., "projects", "saved_session_updates"]create_threadin a listed project outside home (behaviour change, same frames){"protocol_version": 1, "request_id": "req-create", "operation": {"type": "create_thread", "path": "/Volumes/work/parser"}}This is now accepted when
/Volumes/work/parseris apaththatlist_projectsreturned. Before, it was refused withinvalid_request.Changelog
Paired devices can list every project and saved thread with the desktop sidebar's status, pin, snooze and harness, get pushed updates, and start threads in any listed project.
Testing
cargo check --workspace --tests,cargo fmt --all -- --check,scripts/check-comments.py,scripts/check-rust-size.py.RUSTCODE_UPDATE_REMOTE_PROTOCOL=1on theremote::contracttests, then reran the contract tests clean.remote::,remote_gateway::workspaceandremote_gateway::wire_names(178 tests). These include 10 new tests: entry fields and status precedence, past snooze, project grouping and exclusions, the 500-project bound, rescan diffs (pin, rename, delete, add, removed project), splitting large diffs across frames, the subscribe → answer → change frame → stop sequence, and creating a thread in a project outside the roots while refusing its subfolders.rustcode-lifecycle/rustcode-loop-detect(a newer local toolchain); CI's Clippy job covers the engine.