Skip to content

fix(session): a device's new session leaves a worker's tools to the worker - #2408

Closed
thesyncim wants to merge 1 commit into
mainfrom
fix/ai-3746-worker-tools
Closed

thesyncim wants to merge 1 commit into
mainfrom
fix/ai-3746-worker-tools

Conversation

@thesyncim

Copy link
Copy Markdown
Member

Changes

  • A tool a connected worker hosts for a session's agent, or for every agent, is the worker's in a session opened by an end user's device. createSession and the session socket refuse a new device session that declares a tool by that name, with the 409 conflict that addSessionTools answers (ErrToolTaken).
  • A device's fork or carried-on conversation, resume with tools included, is not refused: it uses the worker's tool and keeps the device's others. This follows what Create does for tools the config no longer names.
  • What workers host is read once per session, so the check and the offer agree. A session that names no conversation is checked before its conversation is opened.
  • As before: a backend's own tool keeps its name over a worker's, a device declares tools no worker hosts, and a worker that connects later leaves a running session's tools as they are.
  • createSession's 409 description says so. The spec and the JavaScript types are regenerated; the Go, Python, Swift and Kotlin clients do not change.

Tests

  • TestADevicesNewSessionDoesNotDeclareAToolItsAgentsWorkerHosts: a user, a guest and an anonymous caller get the same answer from createSession and the socket.
  • TestADevicesNewSessionDoesNotDeclareAToolHostedForEveryAgent, TestADevicesNewSessionOnAConversationDoesNotDeclareAToolItsAgentsWorkerHosts, TestARefusedSessionOpensNoConversation.
  • TestADevicesConversationIsCarriedOnWithTheToolAWorkerHostsNow, TestADevicesForkHasTheToolAWorkerHostsNow, TestACallInADevicesConversationCarriedOnIsTheWorkersToRun.
  • With the new rule switched off, the first six fail (201 for 409, or the tool's source is session for worker).
  • What stays the same: TestADevicesOwnToolsAreOfferedBesideItsWorkers, TestADeviceDeclaresAToolNoWorkerHosts, TestADeviceDeclaresAToolItsWorkerHostsForAnotherAgent, TestABackendsSessionKeepsItsOwnToolOverItsWorkers.
  • TestASessionNamingAHostedAgentIsOfferedTheWorkersTools opens as a backend: since [CHA-6998] fix(api): a device can't name the user the agent joins and writes Chat as #2393 a device names no agent id.

Fixes AI-3746

@thesyncim
thesyncim marked this pull request as draft November 25, 2026 10:35
@thesyncim

Copy link
Copy Markdown
Member Author

Closing: the repo documents that the caller's tool wins, and an example relies on it. A setting that says whose tool runs is proposed on AI-3746.

@thesyncim thesyncim closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant