Fix OpenRouter tool-result wire messages for namespaced tools #370

Closed
nsaspy wants to merge 4 commits from fix/openrouter-dotted-tool-result-name into main
Owner

Why

A real Auto-Dig run on OpenRouter succeeded through context tools and four mcp.brave.brave_web_search calls, then the next model request failed with HTTP 400. The failure boundary is the first time role:tool messages carry the dotted MCP name in the optional name field.

OpenRouter's current tool-calling loop returns tool results with role, tool_call_id, and content; name is not needed for correlation. Prolog-RLM already validates Result.name == Call.name internally before rendering the provider message.

Change

  • preserve internal call/result name validation
  • render provider tool-result messages with role, tool_call_id, and content only
  • add a regression test using a dotted MCP tool name

Live evidence

Auto-Dig run: https://github.com/lost-rob0t/starintel-gpt-auto-dig/actions/runs/33434682240

The prior raw malformed-argument batch issue is tracked separately in #325.

## Why A real Auto-Dig run on OpenRouter succeeded through context tools and four `mcp.brave.brave_web_search` calls, then the next model request failed with HTTP 400. The failure boundary is the first time `role:tool` messages carry the dotted MCP name in the optional `name` field. OpenRouter's current tool-calling loop returns tool results with `role`, `tool_call_id`, and `content`; `name` is not needed for correlation. Prolog-RLM already validates `Result.name == Call.name` internally before rendering the provider message. ## Change - preserve internal call/result name validation - render provider tool-result messages with `role`, `tool_call_id`, and `content` only - add a regression test using a dotted MCP tool name ## Live evidence Auto-Dig run: https://github.com/lost-rob0t/starintel-gpt-auto-dig/actions/runs/33434682240 The prior raw malformed-argument batch issue is tracked separately in #325.
test: pin tool-result correlation without optional name (#326)
Some checks failed
Tree-sitter FFI / Direct SWI-Prolog Tree-sitter FFI (pull_request) Successful in 1m50s
CI / REAL OpenRouter integration (pull_request) Has been skipped
Nix flake / Flake package and clean runtime load (pull_request) Failing after 5s
Paid OpenRouter / Pinned paid OpenRouter integration (pull_request) Failing after 52s
CI / Deterministic unit and load checks (pull_request) Successful in 1m47s
Clean SWI pack install / Install and load copied pack (pull_request) Successful in 2m0s
0c38c04d36
The scripted direct-mode provider asserted Message.name on role:tool
messages, but #326 removes that optional wire field; correlate by
tool_call_id and verify tool identity through the observation payload.
Also add an exact regression for internal tool_result_name_mismatch
validation, which stays on the wire path.
nsaspy closed this pull request 2026-09-04 22:56:20 +00:00
Some checks failed
Tree-sitter FFI / Direct SWI-Prolog Tree-sitter FFI (pull_request) Successful in 1m50s
CI / REAL OpenRouter integration (pull_request) Has been skipped
Nix flake / Flake package and clean runtime load (pull_request) Failing after 5s
Paid OpenRouter / Pinned paid OpenRouter integration (pull_request) Failing after 52s
CI / Deterministic unit and load checks (pull_request) Successful in 1m47s
Clean SWI pack install / Install and load copied pack (pull_request) Successful in 2m0s

Pull request closed

Sign in to join this conversation.
No description provided.