[PR #3126] [CLOSED] [Engine] test+guard: a call for a tool the request never offered stays text (#3075) #4467

Closed
opened 2026-11-07 15:36:15 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3126
Author: @ctr-137
Created: 10/19/2026
Status: ❌ Closed

Base: main ← Head: serve/undeclared-call-3075


📝 Commits (4)

  • 1926588 test+guard: a call for a tool the request never offered stays text (#3075) - the content state scanned for a call without gating on the declared tools, unlike its reasoning-state twin, so a request that declared none answered with tool_calls and empty content. The answer side of that case had no test anywhere; six subtests now cover tools absent, tools: [] and tool_choice none, streamed and not. Two existing expectations (serve/test_mcp.py:329, serve/test_parser_call_scan.py:56) assert the opposite and are left as they are pending a decision - see the comment on the issue.
  • 3fed9b1 test: the two tests that pinned the content state's old behaviour follow the #3075 rule - a call for a tool the request never offered is text, so serve/test_mcp.py now expects stop and the call as content, and serve/test_parser_call_scan.py declares a tool because it measures the structural walk, not the no-tools rule
  • 669c6a7 serve: keep the tools-less pass-through for Codex's compaction, not for every request
  • 7eadeda test: pin the two tools-less corners the passthrough review named

📊 Changes

6 files changed (+82 additions, -18 deletions)

View changed files

📝 serve/frontend.py (+8 -2)
📝 serve/server.py (+15 -8)
📝 serve/test_mcp.py (+2 -1)
📝 serve/test_parser_call_scan.py (+2 -1)
📝 serve/test_responses.py (+27 -6)
📝 serve/test_server.py (+28 -0)

📄 Description

What it changes

  • serve/frontend.py — the content state's call scan is gated on the declared tools (#3075), the way the reasoning-state scan already is: a request that declared nothing gets the call back as text, not as tool_calls with an empty content.
  • serve/frontend.py / serve/server.py — one explicit exception. OutputParser(passthrough=False) and Service.run/_run(passthrough=False); the responses route sets it only when prompt_tools() actually returned the conversation's kept tools (shown is not tools), i.e. the Codex compaction request, whose prompt is rendered with kept tools while the request declares none (responses.py:361-373). Every other tools-less request follows #804's rule.
  • serve/test_server.py — ForcedToolChoice.test_a_call_the_request_never_offered_stays_text: after </think> the model writes a complete, well-formed call for a tool the request never offered, checked for tools absent, tools: [] and tool_choice: "none", streamed and not (6 subtests). On the unpatched tree all 6 fail.
  • serve/test_mcp.py and serve/test_parser_call_scan.py — the two expectations that encoded the old behaviour. The MCP test now expects stop and the call as content; the re-scan test declares the tool it writes, because it measures the structural walk, not the no-tools rule.
  • serve/test_responses.py — the compaction test keeps its with-metadata half unchanged: the calls still come back as function_call items, with no namespace/custom shape. Its without-metadata half now asserts the text the new rule produces, because without the metadata it is a plain tools-less request.

What it leaves alone

The second gap in #3075 — a call naming a function outside a declared set — is not touched. As measured on review, a name check in _finish_call is too late (_scan() has already emitted tool_start), and name in self.schemas would reject Codex's flat mcp__server__tool spelling, which responses.py:271 maps through names. That needs its own change.

Validation

  • New test: 6 subtests fail on the unpatched tree, pass with the guard.
  • Full serve suite on Windows 11 / Python 3.14.7, CPU only: 849 tests — 1 failure and 1 error, both baseline (test_keepawake's wait_for and test_winjob's tasklist returning None; both fail the same way on unmodified main here). test_responses' thread count, which is order-dependent, was green in this run. Nothing else changed.
  • The compaction test's metadata half still returns [("function_call", "multi_agent_v1.spawn_agent", None), ("function_call", "apply_patch", None)].

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3126 **Author:** [@ctr-137](https://github.com/ctr-137) **Created:** 10/19/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `serve/undeclared-call-3075` --- ### 📝 Commits (4) - [`1926588`](https://github.com/Niko1221/Strata/commit/1926588026f9900f389f20d586a5fe52125ebc73) test+guard: a call for a tool the request never offered stays text (#3075) - the content state scanned for a call without gating on the declared tools, unlike its reasoning-state twin, so a request that declared none answered with tool_calls and empty content. The answer side of that case had no test anywhere; six subtests now cover tools absent, tools: [] and tool_choice none, streamed and not. Two existing expectations (serve/test_mcp.py:329, serve/test_parser_call_scan.py:56) assert the opposite and are left as they are pending a decision - see the comment on the issue. - [`3fed9b1`](https://github.com/Niko1221/Strata/commit/3fed9b1258485c18a2fd43d353d8e4dd82cf6828) test: the two tests that pinned the content state's old behaviour follow the #3075 rule - a call for a tool the request never offered is text, so serve/test_mcp.py now expects stop and the call as content, and serve/test_parser_call_scan.py declares a tool because it measures the structural walk, not the no-tools rule - [`669c6a7`](https://github.com/Niko1221/Strata/commit/669c6a7f0966788e5c005a800d42b4d420a729c0) serve: keep the tools-less pass-through for Codex's compaction, not for every request - [`7eadeda`](https://github.com/Niko1221/Strata/commit/7eadeda329fe223b98da1098c860adbe1d58f6c7) test: pin the two tools-less corners the passthrough review named ### 📊 Changes **6 files changed** (+82 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `serve/frontend.py` (+8 -2) 📝 `serve/server.py` (+15 -8) 📝 `serve/test_mcp.py` (+2 -1) 📝 `serve/test_parser_call_scan.py` (+2 -1) 📝 `serve/test_responses.py` (+27 -6) 📝 `serve/test_server.py` (+28 -0) </details> ### 📄 Description ## What it changes - `serve/frontend.py` — the content state's call scan is gated on the declared tools (`#3075`), the way the reasoning-state scan already is: a request that declared nothing gets the call back as text, not as `tool_calls` with an empty `content`. - `serve/frontend.py` / `serve/server.py` — one explicit exception. `OutputParser(passthrough=False)` and `Service.run/_run(passthrough=False)`; the responses route sets it only when `prompt_tools()` actually returned the conversation's kept tools (`shown is not tools`), i.e. the Codex compaction request, whose prompt is rendered with kept tools while the request declares none (`responses.py:361-373`). Every other tools-less request follows #804's rule. - `serve/test_server.py` — `ForcedToolChoice.test_a_call_the_request_never_offered_stays_text`: after `</think>` the model writes a complete, well-formed call for a tool the request never offered, checked for `tools` absent, `tools: []` and `tool_choice: "none"`, streamed and not (6 subtests). On the unpatched tree all 6 fail. - `serve/test_mcp.py` and `serve/test_parser_call_scan.py` — the two expectations that encoded the old behaviour. The MCP test now expects `stop` and the call as content; the re-scan test declares the tool it writes, because it measures the structural walk, not the no-tools rule. - `serve/test_responses.py` — the compaction test keeps its with-metadata half unchanged: the calls still come back as `function_call` items, with no namespace/custom shape. Its without-metadata half now asserts the text the new rule produces, because without the metadata it is a plain tools-less request. ## What it leaves alone The second gap in #3075 — a call naming a function outside a *declared* set — is not touched. As measured on review, a name check in `_finish_call` is too late (`_scan()` has already emitted `tool_start`), and `name in self.schemas` would reject Codex's flat `mcp__server__tool` spelling, which `responses.py:271` maps through `names`. That needs its own change. ## Validation - New test: 6 subtests fail on the unpatched tree, pass with the guard. - Full `serve` suite on Windows 11 / Python 3.14.7, CPU only: **849 tests — 1 failure and 1 error, both baseline** (`test_keepawake`'s `wait_for` and `test_winjob`'s `tasklist` returning `None`; both fail the same way on unmodified `main` here). `test_responses`' thread count, which is order-dependent, was green in this run. Nothing else changed. - The compaction test's metadata half still returns `[("function_call", "multi_agent_v1.spawn_agent", None), ("function_call", "apply_patch", None)]`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:36:15 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4467
No description provided.