Repository navigation
fix(runtime): omit empty MCP args instead of writing null - #1192
finallylly wants to merge 6 commits into
Conversation
mcpConfigEntries wrote "args": null for stdio MCP servers without arguments, such as the built-in gate server. Claude Code skips a server whose args is null, so SOP nodes running on Claude never saw submit_gate_result and stopped for manual confirmation. Omit args when it is empty, matching the Codex renderer.
|
Pi is affected by the same bug, and it is still present in v0.4.2 ( For the "agentflow-gate": {
"args": null,
"command": ".agentflow/config/<agent>/gate-mcp",
"env": { "AGENTFLOW_GATE_RESULT_PATH": ".agentflow/gate-results/<node>/attempt-N.json" }
}Pi ( Other servers in the same file, such as Whether a node gets through depends on the model. One model found Both this PR and #1034 fix the Pi case too, because |
What changed
SOP agent nodes running on Claude Code could not see the
agentflow-gateMCP server, sosubmit_gate_resultwas missing. The platform resumed the CLI session, still received no gate result, and stopped every node for manual confirmation (未收到 submit_gate_result,恢复 CLI session 后仍未提交).mcpConfigEntrieswrote"args": nullintomcp.jsonfor stdio servers without arguments, such as the built-in gate server. Claude Code skips a server whoseargsis null instead of starting it.The entry now omits
argswhen it is empty, which matches how the Codex renderer (codexMCPServerArgs) already handles servers without arguments.This addresses the same problem as #1034, which writes
"args": []instead. Either form works with Claude Code; this PR adds a reproduction on macOS and keeps the generated entry consistent with the Codex renderer. Feel free to close whichever one you do not prefer.Scope
Compatibility
No schema or runner protocol change. Only stdio MCP entries without arguments change:
argsis omitted instead of written asnull. Entries with arguments are unchanged. Consumers inagent_cli.goalready handle a missingargskey.Validation
Run on macOS (Apple silicon).
TestMCPConfigEntriesOmitsEmptyArgsfails without the fix ("args":nullin the rendered config) and passes with it.go test ./internal/runtime: the remaining failures in this macOS environment (Docker-dependent tests) are identical with and without this change."args": null→ no MCP servers loaded,submit_gate_resultabsent;"args": []or omitted →agentflow-gateconnected andsubmit_gate_resultlisted.localsandbox: before the fix every Claude agent node stopped for manual confirmation; after it, the backend delivery SOP ran through and only stopped at the configured approval nodes.go test ./...,scripts/scan-secrets.sh(downloads a Linux-only binary), Local edition scripts (not affected).Safety