Repository navigation
fix(subagent): shrink worker toolsets and sanitize Grok schemas - #1309
TheGreatAxios merged 6 commits into
Conversation
Grok workers inherit the parent xAI profile then 400 on first infer with an empty Bad Request. submit_result advertised an untyped result property, which the Responses proxy rejects, and inherited MCP schemas can carry $schema. Give result a JSON Schema type and sanitize Grok wire schemas so one bad tool cannot kill the infer.
Workers were putting every mounted tool on the wire, including all inherited MCP schemas. Dispatch already uses a CORE+CATALOG prefix and discovers the rest via tool_search. Give leaves the same shape: a smaller preset than dispatch, tool_search, and promote-on-execute. MCP stays mounted for execute but off the wire until search.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review · Comment
Workers advertise a smaller preset plus tool_search (MCP stays mounted for execute and is pinned when requires_tools names it); Grok advertise paths strip $schema/$id and type untyped properties; submit_result.result is a JSON Schema object.
Findings
- PR title — the title describes only the Grok/
submit_resultcommit. The branch also changes every worker's advertised prefix (advertisedToolNamesForWorker, promote-on-execute,requires_toolspin). CONTRIBUTING requires the title to describe the whole branch. Something likefix(subagent): shrink worker tool prefix and sanitize Grok schemaswould match both commits.
Code on the wire path is otherwise sound: leaf prefix includes tool_search / ask_director / submit_result / skill_search and excludes fleet verbs, ask_operator, and MCP names; nested orchestrators add the fleet verbs they mount and still omit wait_agents (mailbox collection, matching ToolAvailability.waitAgentsMounted); requires_tools merge into pinnedTools so a required MCP name is on the wire from turn 1. Checked bun test ./src/subagent ./src/agent/tool-search.test.ts ./src/agent/tool-schema-normalize.test.ts.
The worker wire prefix is the director package allowlist plus tool_search and the leaf reporting channel, not one shared preset. Explorer is READ_TOOLS (no path writes). Coder/docs/orchestrator keep their own envelopes. apply_patch still folds via tool profile.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Initial enum/const corruption is resolved, with literal metadata/property names preserved. The full-suite xAI diagnostic failure is traced to a Bun nested asymmetric matcher mutating the canonical tool_search schema; asserting against a copy fixes pollution without relaxing diagnostic assertions. Review includes the concurrent b5801c0 per-director update, plus a test-first repair for custom nested orchestrators losing fleet verbs from their initial prefix. Muse/Kimi/Grok normalization paths compose correctly. Full bun run check passes with 8,275 tests and zero failures; no remaining actionable findings in the shipped code. No live Grok API smoke or generic MCP reference-cycle elimination is claimed; CL-9839 remains partial.
Summary
submit_result.resultis typed. Grok sanitation removes schema metadata and types untyped/enum/const nodes without corrupting literal payloads; Muse/Kimi retain the acyclicpresentrewrite.Verification
bun run checkpasses against integrated main: 8,275 tests, zero failures.$refcycle elimination is not implemented; those CL-9839 outcomes remain open.Refs CL-9839
Fixes CL-9841