Skip to content

backends: avoidable tool errors cost a model round trip each #4309

Open

Description

@schlessera

Context

Part of #4278.

A tool call that fails for a reason the model could not have known costs a model round trip: the model reads the error and tries again, about 3 s each time. On one hosted install over three weeks of Claude turns there were 55 error results, and 39 tool steps directly followed an error step. Four classes account for most of them:

Class Observed What the error says
complete_share 12 of 14 calls failed 10 times "retained binary must be linked by the filed document": a rule the tool's description does not state
brain CLI through the shell 10 of 39 calls failed mutually exclusive flags, an unknown subcommand, provider admission
native WebFetch 13 of 18 calls failed 8 refusals by the egress proxy, 2 relay admission refusals, 2 "Safety or authority changed before admission"
a guard refusing in mid-turn 7 "Safety or authority changed before admission" on Read and WebFetch

What is already tracked elsewhere:

Not established: the exact invocations behind the brain CLI failures, and why a guard's state changed between a call's request and its admission.

Scope

  • Recount the four classes using Activity records from builds verified to include ui-server: complete_share refuses a retained file linked by a document-relative path, so shared PDFs never complete #3353. Record the observation period, build/release, turns and per-class calls and failures. Count overlapping WebFetch and guard refusals explicitly. Use only sanitized aggregates in the issue.
  • complete_share: if it still fails for the linking rule, state the rule in the tool's description, or let the tool create the link it requires. A description change follows docs/decisions/provider-history.md: new sessions only, or the PR says how an existing session's tool list stays byte-identical.
  • Brain CLI: collect the failing invocations as test fixtures (the command line and the error, no content), then fix the skill text or help text that led to them, or make the CLI accept what the model reasonably tried. The brain's MCP read tools cover most of these calls and stay loaded under backends: tool search is off behind the inference relay, so every tool definition is sent in every request #4306.
  • Guard refusals in mid-turn: reproduce one. File what is found as its own issue.

Out of scope

Acceptance criteria

  • This issue carries the re-count, with the period and the number of turns.
  • For each class still above a handful of failures, a fix or a filed issue with a reproduction.
  • For complete_share, if changed: a test in which a model-shaped first call that would have failed under the old description succeeds, or fails with a message that states the rule and the fix in one sentence.
  • For the brain CLI: each collected invocation is a test case that passes or returns a one-line correction naming the right form.
  • No fixture contains content from a real brain.

Verification

bun run test packages/core/tests packages/ui-server/tests
bun run typecheck
bun run lint

Contract impact

  • This touches the integration contract. It does if a CLI flag's meaning or an MCP tool's schema changes; a description is not a schema.
  • This changes a published package's behaviour, so it needs a changeset.

Reproduction evidence still needed

An authorized operator or agent with access to matching Activity records should supply the aggregate above and one sanitized fictional invocation with the exact error shape for each recurring CLI or guard class. Include whether an immediate retry succeeded. Keep real paths, user inputs, credentials and deployment details out of the evidence. For a guard failure, include a minimal event ordering that lets a local fixture distinguish an intended refusal from a defect.

2026-11-20 triage at main 63bb400b3. bun run test packages/ui-server/tests/interactive-share.test.ts packages/ui-server/tests/share-links.test.ts passed 21 tests, including document-relative share links and expected-path refusal. This proves the current fixture behaviour. The public npm latest version was 0.44.0 while #3353 is attributed to 0.45.0. A verified deployed build is needed for the sample.

Activity

  1. added
    type: fix
    area: core
    area: ui-server
    area: backends
    on Nov 20, 2026
  2. added
    needs: repro
    priority: p2
    needs: human
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: backendsarea: corearea: ui-serverneeds: humanneeds: repropriority: p2type: fix

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions