Skip to content

[AI-3861] A child agent's failed store read tells the model a fixed sentence - #2715

Closed
kanat wants to merge 1 commit into
mainfrom
kanat/ai-3861-child-agent-read-errors
Closed

kanat wants to merge 1 commit into
mainfrom
kanat/ai-3861-child-agent-read-errors

Conversation

@kanat

@kanat kanat commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

When the store could not be read for a child agent's call (its config, a sibling's config, or a connector definition), the model, the tool_call frame and the stored result said only "the tool failed". This PR makes that call fail with "ask_kid could not reach its agent", naming the tool, and logs the store's error with app_id, session and tool. A refusal (an unknown child, the sensitive-connector rule) keeps its own error and its "the tool failed" answer, as on main.

How it works

parent's model calls ask_kid
└─ childRunner.Run
   ├─ read the child's config ──────────────┐
   ├─ read each sibling child's config ─────┼─ fails -> unreachable()
   ├─ read the connector definitions ───────┘            ├─ call already stopped? -> "ask_kid was stopped before it finished"
   │    (the sensitive-connector check)                  ├─ log: store's error, app_id, session, tool
   │                                                     └─ tool error "ask_kid could not reach its agent"
   ├─ child no longer exists / not a text agent / ...    -> unchanged ("the tool failed" to the model)
   └─ sensitive rule refuses                             -> unchanged ("the tool failed" to the model)
Case Model, frame, stored result Log Test
child's config read fails ask_kid could not reach its agent store's error, app_id, session, tool TestAChildWhoseConfigCannotBeReadIsUnreachable, TestAFailedReadIsLoggedWithTheSessionsIds
sibling's config read fails same same TestAChildWhoseSiblingCannotBeReadIsUnreachable
connector definition read fails same same TestAChildWhoseConnectorDefinitionCannotBeReadIsUnreachable
read fails because the call was stopped ask_kid was stopped before it finished none TestAReadCutShortByTheCallEndingIsThatEnding
child no longer exists (control) the tool failed, error text as on main as on main TestAChildThatNoLongerExistsKeepsItsOwnRefusal
sensitive rule refuses (control) the tool failed, error text as on main as on main TestADelegationTheSensitiveRuleRefusesKeepsItsOwnRefusal

What was already true on main

Since #2499, harness.ToolFailure tells the model, the frame and the stored result "the tool failed" for any tool error not marked correctable, so no store text reached them before this PR either. The new tests check this too (readsNothingOf) and pass on main. What fails on main is the sentence: it said "the tool failed" for a read the router could not make, and now says which tool and that the agent could not be reached. The sentence is marked harness.Correctable so the model reads it as written.

Not changed

The error of the child's own run (manager.Run, run.Failed) still goes up as it is, so the model reads "the tool failed" for it. sensitive.exposureOf still returns the store's error to its callers, and childRunner is the one that answers for it.

🤖 Generated with Claude Code

Mutations and commands

Each mutant is applied to child_agents.go, run with go test -tags integration ./internal/session/ -run TestChildConversationSuite, and restored.

Mutant Killed by
config read returns the raw error ...ConfigCannotBeReadIsUnreachable, TestAFailedReadIsLoggedWithTheSessionsIds, TestAReadCutShortByTheCallEndingIsThatEnding
sibling and definition reads return the raw error ...SiblingCannotBeReadIsUnreachable, ...ConnectorDefinitionCannotBeReadIsUnreachable
call-stopped guard never taken TestAReadCutShortByTheCallEndingIsThatEnding
call-stopped guard answers a plain error TestAReadCutShortByTheCallEndingIsThatEnding
error not marked correctable the three read tests
sentence without the tool's name the three read tests
no log line / no app_id / no session / no tool / no error / warn instead of error TestAFailedReadIsLoggedWithTheSessionsIds
ErrNoAgentConfig no longer excluded from the read failure TestAChildThatNoLongerExistsKeepsItsOwnRefusal

13 of 13 killed (mutinv.sh listed 5 lines, all covered by the first six rows).

Base probe: with child_agents.go from d734ca0bb, the three read tests and the log test fail (model, frame and stored result read "the tool failed"); both controls pass.

Run: go test -tags integration ./internal/session/ and -run TestChildAgentsSuite ./internal/api/ pass; go test ./internal/session/ passes; go vet with and without the integration tag is clean.

…entence

When the store could not be read for a child agent's call, the call now fails with
"<tool> could not reach its agent" and the log keeps the store's error with the
app_id, session and tool. The model, the tool_call frame and the stored result
said only "the tool failed" before, so they now name the tool.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kanat

kanat commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator Author

Closing: a failed read during a delegation already gives the model, the tool_call frame and the stored item fixed words on main since #2499 (harness.ToolFailure). A probe of main with this change reverted shows "the tool failed" in all three places, so there is nothing left to fix here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant