[PR #3972] [CLOSED] [Engine] accept Codex spellings of a namespace tool #4859

Closed
opened 2026-11-07 16:30:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3972
Author: @Righteous-AI
Created: 10/24/2026
Status: ❌ Closed

Base: main ← Head: codex-mcp-tool-spellings


📝 Commits (2)

  • 6f5d5ab serve: accept the other spellings Codex writes for a namespace tool
  • 5da438d Merge upstream/main into codex-mcp-tool-spellings

📊 Changes

3 files changed (+191 additions, -6 deletions)

View changed files

📝 docs/DETAILS.md (+5 -3)
📝 serve/frontend.py (+7 -3)
➕ serve/test_tool_name_alias.py (+179 -0)

📄 Description

Problem and result: Codex CLI, talking to Strata over the Responses API, stops the turn when Qwen writes a namespace tool under a spelling Strata does not accept. The block comes back as assistant text, so Codex never runs it. Stock main already accepts namespace__member (PR #3556). This also accepts namespace=member, namespace_member, and the bare member when exactly one declared tool has that member.

Observed on Strata v0.2.2 (011c9e60), Codex 0.163, model Qwen3.8-Flash-Next-FP4. The model wrote <function=mcp__filesystem=write_file>, <function=mcp__filesystem_edit_file>, and later a bare <function=write_file> and <function=list_allowed_directories>. The declared tool was mcp__filesystem.write_file (and the same namespace for the others). After this change those calls come back as function_call items with namespace mcp__filesystem and the member name.

Related discussion: none found for these spellings. #3075 stays as it is: a name that matches nothing is still text, and two namespaces that share a member are not guessed. A Codex turn does end when that text path happens. This PR does not change that rule.

Approach: the alias table in OutputParser already rewrites namespace__member to the declared namespace.member name, which request_tools maps back to a namespace and a member. The same table now includes the equals form (the <function= tag's equals sign), the one-underscore form, and the bare member. An alias is kept only when one declared tool produces it, and a name that is itself declared wins.

Validation:
Passed: python3 -m unittest serve.test_tool_name_alias serve.test_tool_call_envelope -v on 6f5d5ab (parent 7dd5cf18, Strata main). Python 3.14, jinja2 3.x, no GPU. 20 tests, OK. The new file covers the equals write, the underscore edit with a string argument, bare write_file (path /tmp/patch-tencut.py), bare list_allowed_directories, the existing double-underscore form, an equals call inside thinking, an unknown name staying text, two namespaces sharing write_file staying text, and a flat tool named write_file winning over the namespace member.
Failed: none in those tests.
Not run: CUDA, HIP, and SYCL builds. This diff is the Python parser and its doc line. serve.test_responses.ToolRoundTrip.test_namespace_call_written_with_double_underscore was not run: Service imports strata_tokenizer, which this checkout does not put on the path, and no engine was started. A live Codex session against this branch was not run. The fixtures are the call text saved from the session above.

Limits: an unknown name, and a bare member shared by two namespaces, still come back as text (#3075). Codex ends the turn in that case. Say if that should be a follow-up where the block is a function_call with no namespace, so the client can reject it and continue.


🔄 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/3972 **Author:** [@Righteous-AI](https://github.com/Righteous-AI) **Created:** 10/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex-mcp-tool-spellings` --- ### 📝 Commits (2) - [`6f5d5ab`](https://github.com/Niko1221/Strata/commit/6f5d5ab35b4cd26457f95ac40394e86e324ef8d7) serve: accept the other spellings Codex writes for a namespace tool - [`5da438d`](https://github.com/Niko1221/Strata/commit/5da438d6adaf231320e64749021de5f21fc32e51) Merge upstream/main into codex-mcp-tool-spellings ### 📊 Changes **3 files changed** (+191 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+5 -3) 📝 `serve/frontend.py` (+7 -3) ➕ `serve/test_tool_name_alias.py` (+179 -0) </details> ### 📄 Description Problem and result: Codex CLI, talking to Strata over the Responses API, stops the turn when Qwen writes a namespace tool under a spelling Strata does not accept. The block comes back as assistant text, so Codex never runs it. Stock main already accepts `namespace__member` (PR #3556). This also accepts `namespace=member`, `namespace_member`, and the bare member when exactly one declared tool has that member. Observed on Strata v0.2.2 (`011c9e60`), Codex 0.163, model Qwen3.8-Flash-Next-FP4. The model wrote `<function=mcp__filesystem=write_file>`, `<function=mcp__filesystem_edit_file>`, and later a bare `<function=write_file>` and `<function=list_allowed_directories>`. The declared tool was `mcp__filesystem.write_file` (and the same namespace for the others). After this change those calls come back as `function_call` items with `namespace` `mcp__filesystem` and the member name. Related discussion: none found for these spellings. #3075 stays as it is: a name that matches nothing is still text, and two namespaces that share a member are not guessed. A Codex turn does end when that text path happens. This PR does not change that rule. Approach: the alias table in `OutputParser` already rewrites `namespace__member` to the declared `namespace.member` name, which `request_tools` maps back to a namespace and a member. The same table now includes the equals form (the `<function=` tag's equals sign), the one-underscore form, and the bare member. An alias is kept only when one declared tool produces it, and a name that is itself declared wins. Validation: Passed: `python3 -m unittest serve.test_tool_name_alias serve.test_tool_call_envelope -v` on `6f5d5ab` (parent `7dd5cf18`, Strata main). Python 3.14, jinja2 3.x, no GPU. 20 tests, OK. The new file covers the equals write, the underscore edit with a string argument, bare `write_file` (path `/tmp/patch-tencut.py`), bare `list_allowed_directories`, the existing double-underscore form, an equals call inside thinking, an unknown name staying text, two namespaces sharing `write_file` staying text, and a flat tool named `write_file` winning over the namespace member. Failed: none in those tests. Not run: CUDA, HIP, and SYCL builds. This diff is the Python parser and its doc line. `serve.test_responses.ToolRoundTrip.test_namespace_call_written_with_double_underscore` was not run: `Service` imports `strata_tokenizer`, which this checkout does not put on the path, and no engine was started. A live Codex session against this branch was not run. The fixtures are the call text saved from the session above. Limits: an unknown name, and a bare member shared by two namespaces, still come back as text (#3075). Codex ends the turn in that case. Say if that should be a follow-up where the block is a `function_call` with no namespace, so the client can reject it and continue. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:30:54 +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#4859
No description provided.