Repository navigation
Client tools cross the remote door to the connection that set them - #2417
Merged
Merged
Conversation
AbirAbbas
added a commit
that referenced
this pull request
Nov 5, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
added a commit
that referenced
this pull request
Nov 5, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
force-pushed
the
workstreams/l-remote-engine
branch
from
November 5, 2026 17:57
e545761 to
36f0664
Compare
A holder that forwards client tools says so in its welcome. A connection sends its whole snapshot of sets with ClientTools.Set; the holder's conversation hub puts them on the belt, sends each call to the owning connection only and takes the answer back with ClientTool.Answer. A connection that leaves (detach, torn pipe, close, failed write) loses its sets and its pending calls settle at once with the disconnected answer; a call nobody answers ends at its existing wait. A roaming client re-sends its sets after a redial. The protocol version is unchanged: an older peer never sees the new calls or frames. Co-Authored-By: Claude Opus 5.5 <[email protected]>
agents.tools_set on a conversation the app joined through another host now forwards the agent's sets to that holder when it supports it, and the app pushes them again every time it holds the conversation. Calls come back as agents.tool_call on the app connection that set them. An older holder keeps the existing bad_scope refusal. A chat held on another computer stores its sets and uses them once it runs here again. Hosts without an app give each conversation the forwarding hub, and the app hello adds agents.client_tools.remote. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
One sender per owner connection drains its pending calls and skips any call already settled or past its wait, so a stuck write holds one sender and no queue. Requests go through the client's ordinary call path. Each client carries a random owner token: a redial that arrives while the old connection is still attached moves the sets to the new connection instead of colliding with itself. A snapshot replays only onto the conversation it was acknowledged in. A forwarded call waits for an in-flight publication only as long as its own context and wait allow. Every new lock unlocks from a defer, and the chat manual keeps its one bounded section. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
force-pushed
the
workstreams/l-remote-engine
branch
from
November 5, 2026 19:09
36f0664 to
f6cbaeb
Compare
AbirAbbas
added a commit
that referenced
this pull request
Nov 13, 2026
…, agents.set_scope) (#2613) * Client tools: a client attaches tools to a conversation Carries #2334 from workstreams/main (e9a571c) onto dev. The workstream door that commit sat beside is left out, and the collection-held conversation half is already on dev (#2475). Co-Authored-By: Claude Mythos 5.2 <[email protected]> * Client tools: a tool call names the message its turn answers; the answer cutoff is a wait Carries #2346 (b1a02be) and #2360 (25c6faa) from workstreams/main. Co-Authored-By: Claude Mythos 5.2 <[email protected]> * Client tools cross the remote door to the connection that set them Carries #2417 (08b6e1e) from workstreams/main. Co-Authored-By: Claude Mythos 5.2 <[email protected]> * A conversation can be told only about its own work (agents.set_scope) Carries #2462 (e985a44) from workstreams/main. Co-Authored-By: Claude Mythos 5.2 <[email protected]> * changes: one entry for client tools and conversation scope (#2613) Replaces the five entries carried with the source commits. Co-Authored-By: Claude Mythos 5.2 <[email protected]> * Client tools: a call id hashes the whole call, and a call without a provider id gets a random id The `call` id was sha256(agent, provider call id), with a per-process counter when the provider gave no id. Provider ids are not unique: Kimi-family models write their own `name:idx` ids, which repeat after agents.rewind or compaction, and a faulty server can repeat any id. A reused id with another tool or other arguments therefore joined the earlier call's wait or got its saved answer, and never reached the app, while the app's 30-day table replayed the old answer for the same id. The counter restarted at every launch, so ids minted without a provider id came back after a restart. clientToolCallID now hashes the agent, provider call id, set, tool name and exact argument bytes, each length-prefixed, and keeps the `ct_` + 64 hex shape. The same call dispatched again keeps its id, joins the pending wait and gets the saved answer. Without a provider id the id is 32 random bytes. Calls from a remote holder reach the same door, so they share the identity. PROTOCOL.md and the change entry say what `call` is derived from. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Conversation scope: the page and the tasks description stop promising other windows' work Under `conversation` scope a conversation gets no <elsewhere> block and its tasks tool lists only its own work, but its system prompt still said "OTHER codeaf WINDOWS ON THIS PROJECT ARE VISIBLE TO YOU" and the tasks description still said search includes other windows' live work. The model could read an empty answer as "nothing else is running here" and tell the person so. The page's other-windows line and the tasks description now follow the stored scope. Under conversation scope the page says the conversation is told only about its own work and must not conclude nothing else is running; the tasks description says search reaches only its own work, even with scope everywhere. A project page and tasks description stay byte for byte as before. The scope is read when the agent is made and again at each turn's start. A changed scope re-renders the page and replaces the tasks tool on the belt and on a lean shelf, in fresh arrays, so the model sees the change from the next turn, as the scope already promises. Task nodes keep their page. PROTOCOL.md, the tasks manual page and the change entry say so. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Client tools: a session swap drops the old conversation's sets A holder shares one ClientToolHub across the initial, fresh and resumed openings of a remote Session. When another window ran /new or /resume, Session.swap replaced the agent but left every connection's sets in the hub, so the replacement conversation got a joined app's tools and instructions, and its calls went to that app under the old agent's id. The app then wrote into the old workstream, and its answer was refused with ErrJoinedGone, so the holder's model was told client_timeout. Session.swap now calls ClientToolHub.forget before the new agent is reachable: every connection's sets go, pending calls end with a clientToolEnded frame so the app stops waiting too, and a joined connection's snapshot that was already past the session's check is refused. A following surface may still attach to the open conversation. PROTOCOL.md, REMOTE.md, the client-tools manual page and the change entry say so. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Mythos 5.2 <[email protected]>
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.
Summary
Client tools (
agents.tools_set,agents.tool_call,agents.tool_result) worked only for a conversation thecodeaf appprocess ran itself. When the app joined a conversation another codeaf host held (the remote door), the holder had no client-tool door. When a chat was held on another computer through the relay, the app answeredbad_scope. This change makes client tools cross the remote door. The change is generic, transport-agnostic and additive. The Workstreams plan's L-REMOTE item depends on it.Remote door (
internal/remote)Welcome.clientToolscapability. With it, a connection sends its whole snapshot of sets withClientTools.Set. The holder answers calls withClientTool.Answer. Two new frames carry the calls:clientToolCall, andclientToolEndedfor a call that ended without an answer.remote.Versionstays 22. An older peer never sends or receives them.ClientToolHubimplementssession.ClientToolDoorand is keyed by connection. It validates on the holder, including built-ins, cross-connection collisions and the 4-set and 64-tool limits. It routes each call only to the connection that owns the set, and rejects answers from any other connection.client_unavailable … disconnectedanswer. A call nobody answers ends at its existing wait withclient_timeout. A roaming client re-sends its snapshot after a redial.App (
cmd/codeaf,internal/appwire)agents.tools_setvalidates locally and forwards the agent's snapshot. The registry commits only after the holder accepts. A holder refusal maps tobad_params; a link failure maps tounreachable. An older holder keeps today's exactbad_scope.holdof a joined conversation installs the call handler and pushes the agent's current sets, so a re-join re-attaches.agents.client_tools.remote.Validation contract → tests
tools_setworks on a joined conversation; the tools reach the holder's belt and instructionsTestClientToolsRemoteCapabilityAndSnapshot,TestClientToolsRemoteModelBoundary,TestClientToolsRemoteJoinedModelRoundTrip,TestClientToolsRemoteHolderRefusalIsAtomic,TestClientToolsRemoteTransportFailureLeavesRegistry,TestClientToolsRemoteAttachmentUsesCallPathTestClientToolsRemoteOwnersAndAnswers,TestClientToolsRemoteAnswerBypassesOrderedLane,TestClientToolsRemoteJoinedModelRoundTrip,TestClientToolsRemoteBoundedResultTestClientToolsRemoteDisconnectDetachAndClose,TestClientToolsRemoteWaitEndAndAnswerOwnership,TestClientToolsRemoteAppDropSettlesPending,TestClientToolsRemoteAppTurnEnded,TestClientToolsRemoteBlockedSenderDropsExpiredCalls,TestClientToolsRemoteCallDuringPublicationTestClientToolsRemoteRedialRestoresSnapshot,TestClientToolsRemoteReholdPushesSets,TestClientToolsRemoteEngineOpenings,TestClientToolsRemoteRedialMovesAttachedOwner,TestClientToolsRemoteRedialConversationIdentityTestClientToolsRemoteOwnersAndAnswers,TestClientToolsRemoteWaitEndAndAnswerOwnership,TestClientToolsRemoteHolderValidationAndAggregateLimitsbad_scopeTestClientToolsRemoteCapabilityAndSnapshot,TestClientToolsRemoteScopeAndElsewhereStorage, existingTestClientToolsAgentLimitsAndScopeunchangedTestClientToolsRemoteScopeAndElsewhereStorageagents.client_tools.remoteTestClientToolsRemoteHelloFeatureTestClientToolsRemoteCapabilityAndSnapshot,TestClientToolsRemoteModelBoundaryReview fixes
A fresh review found three CI blockers and four lifetime/reconnect defects. All are fixed:
CI: no failures of its own. The integration branch's known baseline reds (SYNC7) are unchanged.
🤖 Generated with Claude Code