[Provider compatibility] undeclared_tool_call from a combo child's committed function_call never reaches the hop decision — guard-refused turns dead-end the combo

Open
#9,163 2 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

@bradhallett is already working on this.

Since Nov 26, 2026.

  • #9164 by @bradhallett — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
typescript

Research direction

Read src/server/responses-undeclared-tool-guard.ts, src/server/responses/combo-stream-preflight.ts, and src/combos/failover.ts, then trace how the required-tool contract reaches comboFailureDecision. Check the combo failover tests for coverage of suppressed output and relayed deltas. Done means a guard-refused turn can hop when no output reached the client, while relayed output still prevents replay; the issue says a fix is already in progress as PR #9164.

Written by the indexing model from the issue text.

Description

provider provider-compatibility
Client or integration

Codex CLI

Provider or upstream service

zai (glm-5.3, glm-5.3-flash), opendesign (deepseek-v4.1-flash), anthropic-apikey (claude-sonnet-5-5) — via lane combos (strategy: "failover")

OpenCodex version

2.100.8 → 2.100.10 (npm installer, macOS arm64)

Endpoint or capability

/v1/responses — tool calls under combo streaming; interaction between the undeclared-tool guard and combo failover

Current behaviour

A combo child's model answers with a function_call naming a tool the request never declared. The undeclared-tool guard (src/server/responses-undeclared-tool-guard.ts) suppresses the item and synthesizes a terminal response.failed with code undeclared_tool_call — correct, fail-closed. But the combo never hops to its other targets, for two reasons in the 2.100.10 tree:

  1. UNDECLARED_TOOL_CALL_ERROR_CODE appears nowhere in src/combos/failover.ts — the hop vocabulary has no entry for this code.
  2. In src/server/responses/combo-stream-preflight.ts, comboStreamPayloadCommitsOutput treats any response.output_item.added as committing, so the child is considered to have delivered output even though the client never received that item (the guard suppressed it) and nothing client-executed ran.

#8871 (carrying #8563) already made combos hop on the upstream-400 verdict shape — a provider refusing pre-output with The model called a function that was not offered in tools. (isUnofferedToolCallRefusal, src/combos/failover.ts:1958). That path works. The stream-level shape above is the remaining dead end: the guard refusal never reaches comboFailureDecision.

Closest precedent in-tree: the required-tool contract carve-out in retryableZeroOutputTerminal — REQUIRED_TOOL_CONTRACT_CODE is judged on what the client actually received ("it synthesizes this terminal over output it held back from the client, so held text and reasoning are not evidence of anything sent"). The undeclared-tool refusal is the missing sibling: same synthesized-terminal shape, same nothing-reached-the-client property, no equivalent carve-out.

Expected behaviour

A guard-refused turn — the client received only the synthesized undeclared_tool_call terminal, no relayed output — should be a hop signal for multi-target combos, under the same replay-safety discipline the required-tool guard uses: any output the client genuinely received (a relayed text delta before the offending item) still vetoes the replay; suppressed items do not. The refusal is deterministic per target but target-local: another model may know the tool or not hallucinate the name, which is exactly what strategy: "failover" is for. Concrete client requirement: the combo layer's own documented behaviour (#8871) — target-local model misbehaviour advances the chain instead of ending it.

Minimal redacted request or reproduction
# Codex CLI pointed at the proxy; request declares a Codex-standard tool catalog
# (exec-centric); combo lane serves it with the failover targets above.
ocx start
# Run any long-horizon agentic turn whose history includes foreign tool names
# (e.g. code_runner/bash from another client's transcripts); a routed model
# eventually echoes such a name as a function_call.
# Observed on this rig: 84 failed member turns in one swarm program on
# 2026-11-26 09:30–11:20 local, clustering on combo/lane/orchestration and
# opendesign/deepseek-v4.1-flash; recurring in logs 2026-11-11 → 2026-11-26,
# always terminal, never hopped. Ledger records show failureStage
# semantic-output / side-effect — the pre-commit classifier reads the call item
# as committed output, which is the veto.
Actual response or error
# Buffered wire: HTTP 502
{"error":{"type":"upstream_error","code":"undeclared_tool_call","message":"routed provider emitted undeclared client tool \"code_runner/bash\"; only request-declared tools may be called"}}
# SSE wire: response.failed with the same error record, then data: [DONE]
# Ledger record ocx-8033046ee7ac337b2dbd3d7126784a76 (2026-11-03,
# anthropic-apikey / claude-sonnet-5-5): the name is not an alias of any
# declared tool — the model echoed a tool name from earlier items in the
# conversation (a different client's harness). The guard is right to refuse;
# this report asks for recovery routing, not relaying.
Upstream documentation

No public provider specification exists for this behaviour — the refusal is proxy-synthesized, not upstream. The governing specs are the project's own: https://opencodex.me/reference/proxy-formats/ documents the undeclared_tool_call fail-closed refusal on every wire, and #8871/#8563 define the combo failover contract this refusal currently bypasses.

Suggested mapping or implementation notes

Some combination of:

  1. Teach comboStreamPayloadCommitsOutput / the preflight inspector that an output_item.added whose client-executed call name is undeclared per the declared catalog does not by itself commit the turn — it never reaches the client.
  2. Surface the client-boundary guard's onRefusal into the combo failure decision (mirror whatever wiring reports REQUIRED_TOOL_CONTRACT_CODE), so comboFailureDecision can classify it; extend the hop vocabulary in src/combos/failover.ts with caller-supplied provenance only — never bare message words alone, mirroring the envelope-walk rigor of isUnofferedToolCallRefusal so quoted or reflected prose stays terminal.

Secondary, cheap, independent: when the refused name matches an item already in the request's input items, include that item's index/type in the refusal details — it distinguishes "provider broke the tool contract" (report to provider) from "model hallucinated a name from context" (restructure the turn), which is what an operator needs.

Additional context and attachments

A fix is in progress and will be linked as a PR on this issue. Happy to run any diagnostic on this rig; proxy, ledgers (~/.opencodex/usage.jsonl), and Codex journal are intact. Related: #8563, #8871, #9040 (dotted-alias echo shape — same family of provider echo behaviour the guard normalizes).

Checks
  • I searched existing provider and compatibility issues.
  • The request and response were redacted.
  • The expected behaviour is based on an upstream specification or a concrete client requirement.
Dominant language
TypeScript
Stars
16.9k
Forks
1.3k
Avg merge
1d 4h
Merged PRs (30d)
814

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lidge-jun/opencodex

All issues in lidge-jun/opencodex

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.