Repository navigation
feat(remote): fork chats from paired devices and aiden serve - #349
Conversation
Contract revision 21 adds POST /chats/{chatId}/fork and
POST /chats/{chatId}/fork-summary/{retry|skip|cancel}, the forkedFrom
lineage on chats, rows and message windows, and the chat-fork-v1 and
chat-fork-summary-v1 features.
Desktop and Remote share one fork service. A fork before a prompt
returns the prompt as prefill, with its attachments restaged for the
calling device. Busy sources, unknown messages, ineligible cuts and
oversized forks map to stable Remote errors, and replays are idempotent.
aiden serve forks without summaries. A daemon turn reads its history
from the chat's pi journal, so the fork gets a journal seeded from the
copied visible messages.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Fork summaries expose host-private data and make focused-summary chats unreadable by the existing native clients. Two additional failure paths can report an unsuccessful fork after committing it, or report success without preserving its model context.
Reviewed changes Reviewed the complete stacked PR against feat/chat-fork-summary, including shared copy orchestration, Remote contracts, daemon history, and native compatibility.
- Shared fork service: Desktop IPC and Remote now share source locking, workspace admission, dependent-record preparation, summary startup, and publication.
- Remote API: Revision 21 adds fork and summary-control routes, feature negotiation, lineage projections, idempotent creation, and device-bound attachment prefill.
- Daemon context:
aiden serveseeds fork journals from copied visible messages and advertises plain forks only. - Verification: All 166 focused tests, the rebuilt CLI HTTPS parity test, and root/CLI TypeScript checks passed. Local reproductions confirmed the projection, oversized-outcome, and journal-failure findings; Android verification timed out (
Tool 'shell' timed out after 120000ms), and iOS execution was unavailable because this Linux runner has noxcodebuild.
gpt-6.1-sol | 𝕏
The fork move left four source-grep assertions pointing at handler code that now lives in the fork service. Drop the stale lines, retarget the Bot platform guard to the copyBotChat caller, and cover the unrecovered artifact block with a behavioral fork-service test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hermes Review BotConfidence: 5 Engine: SummaryPart 4 of the chat fork plan extends Aiden's chat-forking capability to paired Remote devices and the headless Confidence Score: 5/5Fully traced and verified the end-to-end flow across router authentication, mutation locks, idempotency ledger replay, workspace admission, store-level copy locks, journal seeding in the CLI daemon, attachment restaging, and the cross-platform contract fixtures and mobile test assertions. 📁 Important Files Changed
FindingsNo findings. Sequence DiagramsequenceDiagram
autonumber
actor Client as Paired Device (Remote)
participant Router as Remote Router
participant RemoteChats as RemoteChatService
participant ForkService as ChatForkService
participant Store as ChatStore
participant AttStore as RemoteAttachmentStore
Client->>Router: POST /chats/{chatId}/fork (If-Match, Idempotency-Key)
Router->>RemoteChats: fork(deviceId, chatId, revision, key, body)
RemoteChats->>ForkService: fork(request, caller)
ForkService->>Store: copyVisibleHistory(sourceId, targetId, forkAt, ...)
Store->>ForkService: beforeInstall(targetChat, sourceMessageIds)
ForkService->>RemoteChats: assertInstallable(targetChat)
Store-->>ForkService: forkedChat
ForkService-->>RemoteChats: forkedChat
opt Position is "before" and prompt has attachments
RemoteChats->>AttStore: stage(deviceId, forkedChat.id, attachments)
AttStore-->>RemoteChats: stagedAttachments
end
RemoteChats-->>Router: { chat: project(forkedChat), prefill? }
Router-->>Client: 201 Created
[]
|
There was a problem hiding this comment.
ℹ️ No new issues found in this delta. Approval remains withheld because the existing review findings are unresolved.
Reviewed changes Reviewed the test updates and merge of main since the previous review at d1b04f6.
- Retargeted guard assertions: Updated the Bot platform check to follow
copyBotChatand removed stale source assertions for logic moved out of the handler. - Added artifact-block coverage: Exercised the real fork service and chat store to verify that an unrecovered artifact prevents copying and that clearing the block allows a copy.
- Merged current main: Checked the resulting full PR diff for context and confirmed the test inventory remains registered correctly.
- Verified affected suites: Passed all 49 tests across the five changed test files and all 10 CI-registry checks.
gpt-6.1-sol | 𝕏
A restaged prefill attachment is redeemed by its upload ID on the fork's next turn, so the fixture now uses an att_ ID and the parser rejects any other shape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
ℹ️ No new issues found in this delta. Approval remains withheld because the existing review findings are unresolved.
Reviewed changes Reviewed the attachment-ID validation change since the previous review at c4b9fb7, with the full PR diff as context.
- Tightened prefill validation: Required restaged attachment IDs to match the upload and turn-redemption format, preventing acceptance of unusable history-style IDs.
- Corrected the shared fixture: Replaced the edit-fork attachment ID with a valid upload-shaped ID and added a behavioral parser rejection test.
- Verified affected behavior: Passed all 114 tests across the Remote protocol, chat service, and operation-contract suites, including fixture parsing and device/chat-bound attachment redemption.
gpt-6.1-sol | 𝕏
…devices - Project fork summaries for Remote with `focus` in place of the private `instructions` name, without the host file list, and with only Aiden's own failure text. Provider errors stay on the Mac. - Map only real summary state conflicts to 409; other failures are not echoed to the device. - Check that the fork response can be sent and replayed before the copy is installed, so a 413 leaves no new chat behind. - `aiden serve` refuses a fork whose journal it cannot seed, because its turns read earlier messages only from the journal. - Record ready and failed summary vectors in the contract fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed 652a1f1..56a27c9, with the complete PR diff as context.
- Sanitized Remote summaries: Omitted host file lists, translated internal
instructionsto publicfocus, and restricted failure text to Aiden-owned messages. - Separated summary conflicts: Mapped only
ForkSummaryStateErrorto a public conflict, leaving unexpected exceptions to the generic HTTP error sanitizer. - Preflighted fork outcomes: Checked the complete response, including conservative attachment-prefill metadata and durable-result limits, before installing the new chat.
- Required daemon history: Refused daemon forks when journal preparation throws or returns
false, while preserving the desktop fallback and cleaning up partially prepared journals. - Verified affected behavior: Passed all 202 focused behavioral tests, the rebuilt CLI HTTPS parity test, both TypeScript checks, and all 10 CI registry checks. Native validator inspection supported compatibility; Android verification returned
Tool 'shell' timed out after 120000ms, and iOS execution was unavailable because this Linux runner has noxcodebuild.
gpt-6.1-sol | 𝕏
…ct revision 23 #349 (chat fork, revision 21) and #352 (provider creation, revision 22) merged first, so chat-messages-window-metadata-v1 moves to revision 23 across the server, iOS, Android, fixtures, OpenAPI and docs. Window pages also carry main's forkedFrom lineage so a windowed refresh keeps the fork row on both clients. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Summary
Part 4 of the chat fork plan (
docs/plans/chat-fork-plan.md). It lets paired devices andaiden servefork chats. It is stacked on #345.POST /chats/{chatId}/fork(forkChat) andPOST /chats/{chatId}/fork-summary/{retry|skip|cancel}.forkedFromon chats, chat rows (with no summary) and message windows.chat-fork-v1andchat-fork-summary-v1.chat-fork-service.tsnow serves the desktop window and Remote alike. The desktopchats:forkhandler uses it.prefill. Its attachments are restaged for the calling device only.operation_in_progress, which can be retried.revision_conflict.aiden serve. It forks without summaries, so it never advertiseschat-fork-summary-v1.beforeInstall, because the store holds the source's lock there./forkand/treefor the TUI.Paired-Mac fork actions on desktop come in a follow-up PR, because they go through the peer-operation layer. The iOS and Android menus follow after that.
Tests
aiden-remote-chats.test.ts: forks after a reply and before a prompt, attachment restaging, error mapping, a host without summaries, and the summary actions.aiden-remote-router.test.ts: feature gating,If-MatchandIdempotency-Key, scopes, and the summary routes.aiden-remote-protocol.test.ts: fixture lineage, prefill, and the row rules; OpenAPI route freezing.packages/cli/tests/parity.test.mjs: forks over HTTPS fromaiden serveand checks that the fork's next turn sends the copied history to the model.npm test;tscfor the root and the CLI;npm run test:ci-policy;AidenBotContractTest.🤖 Generated with Claude Code