Skip to content

backends: built-in tools a hosted turn cannot use are in every request #4307

Closed

Description

@schlessera

Context

Part of #4278.

An interactive hosted Claude turn sends the runtime's default built-in tools, minus a short fixed list (disallowedTools, packages/ui-backend-claude/src/sdk-options.ts:455). Fourteen of the built-ins that remain cannot do anything useful in a hosted turn, because the session's process ends with the turn or because the host owns the function:

Built-in Why it cannot serve a hosted turn
EnterPlanMode, ExitPlanMode plan approval is a terminal UI; the host owns approvals
EnterWorktree, ExitWorktree runtime-managed git worktrees inside the brain bypass the reference worktree model
CronCreate, CronDelete, CronList, ScheduleWakeup, RemoteTrigger session schedulers end with the per-turn process; the host has its own schedules
Workflow, SendMessage, ListAgents cross-process orchestration; background agents end at turn end
ReportFindings a code-review UI hook
NotebookEdit no notebooks; hosted writes go through host tools

Their definitions are about 70 kB of tool JSON in every request. In three months of recorded use on one hosted install (2,660 tool calls) these fourteen were called three times: SendMessage twice and RemoteTrigger once.

SendMessage is the one judgment call. It can continue a subagent inside the same turn.

Scope

  • Add a fixed list of built-ins that a hosted interactive turn cannot use to disallowedTools for interactive profiles. It is a constant, not derived from posture or sandbox state, so the tool list stays stable within a deployment (backends: the tool list changes with posture and sandbox profile, so a posture switch mid-session misses the whole prompt cache #2048).
  • Decide SendMessage explicitly in the PR: keep it if continuing a subagent within a turn works in a hosted turn and is wanted, drop it otherwise.
  • Keep the fixed registration of reference tools. The published MCP contract specifies registration in every interactive session and a scoped refusal when no handler is available (docs/integration-contract/mcp.md:1332-1340). A change to that contract requires a separate ruling.
  • Record the list in docs/decisions/claude-code-runtime.md.

Out of scope

Decision before code

Decide whether to keep SendMessage for an in-turn workflow with a live or resumable subagent, or remove it from new sessions along with individually verified unusable tools. The installed SDK documents named agents as addressable while they run. The hosted hook rewrites background Agent calls to foreground (packages/ui-backend-claude/src/input-rewrite-hooks.ts:69-82), so a useful supported path needs a hosted fixture or a documented example. Both recorded calls are leads. Keep SendMessage if that workflow is wanted and can be reproduced. Removing it saves its definition and removes that interaction.

In an offline SDK 0.3.293 / CLI 2.1.293 turn with the Unix relay, resuming with SendMessage newly in disallowedTools removed it and changed the tool array. EnterPlanMode was absent in this fixture’s original request. This proves roster drift from the option change. Each proposed removal still needs the hosted behaviour check listed below.

Acceptance criteria

  • For a new interactive session the tool list sent to the provider excludes every built-in selected for removal, by the keyless provider-history test.
  • Existing sessions. docs/decisions/provider-history.md requires the original roster throughout the session. Prove the old roster by capturing SDK assembly inputs and provider requests before and after the upgrade. Apply the new selection to new sessions.
  • A model that calls a removed built-in gets the runtime's ordinary unknown-tool result, and the turn continues, by a test.
  • For each built-in on the list, the PR shows it was tried in a hosted turn and names what it did. A built-in that turns out to work is taken off the list.
  • The decision record carries the list and the reason for each entry.
  • A test covering this fails on the tree before the change and passes after.

Verification

bun run test packages/ui-backend-claude
bun run typecheck
bun run lint

Contract impact

  • Scope is Claude’s built-in roster. The documented reference-tool contract remains in force.
  • This changes a published package's behaviour, so it needs a changeset.

2026-11-20 triage at main 63bb400b3. The pinned runtime confirmed that a deployment-wide disallow list would affect resumed sessions. The SendMessage decision and per-tool hosted evidence are distinct questions.

Activity

  1. added
    type: fixSomething is broken and must behave the way it is documented.
    area: backendsAgentBackend implementations and the seam they share.
    on Nov 20, 2026
  2. added
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Nov 20, 2026
  3. schlessera commented on Nov 20, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-20): Remove SendMessage along with the other listed built-ins that are verified unusable in a hosted turn. The hosted hook makes Agent calls foreground, so there is no live subagent to message within a turn. The removal applies to new sessions only. A session keeps the roster it started with through every resume, and that is proven by capturing the SDK assembly inputs and the provider request before and after, as the triage note requires. The reference-tool registration contract stays as it is (docs/integration-contract/mcp.md). needs: decision is removed.

  4. removed
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    on Nov 20, 2026
  5. self-assigned this
    on Nov 20, 2026
  6. schlessera commented on Nov 20, 2026

    @schlessera
    OwnerAuthor

    Claimed for implementation. Claim token: claim-5ba82fdf. Branch: fix/4306-model-request-shape.

    Worked as part of the #4278 epic integration branch epic/4278-host-overhead (one main landing for the epic). Collisions: none recorded at claim.

  7. added this to the 0.45.0 milestone on Nov 21, 2026
  8. schlessera commented on Nov 23, 2026

    @schlessera
    OwnerAuthor

    Closed by #4444, squash-merged to main as a3395c4b2. The combined review found every non-native criterion met. Native-measurement criteria for this issue moved to #4420 by maintainer decision, because native proof cannot run on the integration host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: backendsAgentBackend implementations and the seam they share.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: fixSomething is broken and must behave the way it is documented.

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions