Repository navigation
fix(templates): invalid MCP declarations report only "Invalid input" - #198598
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR exposes existing field-level validation errors for malformed Template MCP declarations while preserving ambiguous-union diagnostics. Example: Validate a Template containing mcpServers.sample = { command: "node", args: [8080] }.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a concrete authoring problem with a focused, proven change; no actionable defects were found, and current-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherTemplate validation reads CLAW.md, parses its manifest with Zod, and returns structured diagnostics to CLI and other Template consumers. flowchart LR
A[Template project] --> B[CLI validate command]
B --> C[Project validator]
C --> D[Manifest reader]
D --> E[Manifest schema]
E --> F[Structured diagnostics]
F --> G[Text or JSON output]
Technical reviewBest possible solution: Merge the focused diagnostic change once the existing required checks pass. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the diagnostic-loss path, and the supplied before/after CLI receipts reproduce the reported inputs; this review executed no target code. Is this the best way to solve the issue? The existing diagnostic converter is the smallest appropriate owner: forward the uniquely closest branch's existing issues, preserve ties, and retain the current validation contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 387042f830d0. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +16, Tests -7. Total +9 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)Reviewed November 14, 2026, 9:00 PM ET / November 15, 2026, 02:00 UTC (Revision 4). |
|
Real behavior proof added for the two outstanding test items — the shipped CLI entry point with real argv, and a red/green run of the committed regressions. The 1. Shipped CLI entry point, real argv (was: handler called directly) The previous evidence imported
Verbatim stdout at head and the same case in {
"schemaVersion": "openclaw.templateProject.v1",
"stability": "experimental",
"ok": false,
"root": "/tmp/mcp-cli-198554/non-string-arg",
"diagnostics": [
{
"level": "error",
"code": "invalid_manifest",
"phase": "schema",
"path": "$.mcpServers.s.args[0]",
"message": "Invalid input: expected string, received number"
}
]
}Both legs are the identical harness; only
All 14 invocations (7 fixtures × text/ 2. Committed regressions: red on the base, green on the head
The six suites that touch this surface also pass at head in one runner invocation —
Still not available locally (host limits, unchanged)
CI status on this head No CI job has run and failed on @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Confirmed the fix through The CLI routes through Host isolation check: the merge-base diff touches only vitest-source: the contributor's unchanged four regressions fail on main merge-base source: real on-disk Template projects ( All malformed cases exit 1. The equally-close case has two existing issues per branch and retains the original union message rather than guessing. Simplified production from +48/-3 to +23/-7 (net +16), removing both added helpers and intermediate issue objects. Consolidated MCP tests retain the four regressions, existing rejection cases, OAuth acceptance, and a tie control: +25/-32, net -7, no allocation file. Contributor commit and credit are retained. Both added commits are authored/committed by Ayaan Zaidi; original author/committer is LiuwqGit. No agent identities or co-author trailers. full: Commands: Message provenance was also checked directly against uncustomized Zod schemas ( |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged current main Requested post-merge checks, through host ocx:
Malformed cases exited 1; valid controls exited 0. These remain Zod's built-in messages, unchanged. The host-isolation diff against the new merge base still contains only |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…penclaw#198598) fix(templates): report the closest MCP server shape's field errors A Template MCP server entry must match either the stdio or the remote shape. An entry that matched neither reported only `$.mcpServers.<name>: Invalid input`, hiding which field was wrong. Validation now reports the existing field-level errors from the shape the entry most closely matches, and keeps "Invalid input" when no shape is clearly closer. The detailed messages are the schema library's built-in messages; no new text. Evidence: source tier with `openclaw templates validate` on Template projects; base twice, candidate twice, rechecked after merging current main. A mostly-stdio entry with a number where a string belongs and a remote entry with `transport: http` reported only "Invalid input" on base; this change reports the field path with "Invalid input: expected string, received number" and "Invalid option: expected one of \"sse\"|\"streamable-http\"". An entry equally close to both shapes still reports "Invalid input", and valid stdio and remote entries pass on both. Vitest-source: the regression fails on base and all 65 schema tests pass here; full build and packed smoke pass. Net -7 test lines. Receipts: openclaw#198598 (comment) and openclaw#198598 (comment). Fixes openclaw#198554. Thanks @LiuwqGit. Co-authored-by: Ayaan Zaidi <[email protected]>
Fixes #198554. Original fix by @LiuwqGit; reported by @anmol0b.
What Problem This Solves
openclaw templates validateloses Zod's nested field diagnostics when a Template MCP entry matches neither the stdio nor remote shape. Authors only see$.mcpServers.<name>: Invalid input.Fix
Forward the existing issues from the uniquely closest union branch, including their full field paths. Keep the existing union diagnostic on a tie. No schema, accepted values, defaults, or message text changes. Other Template artifact diagnostic forwarding (#198556) stays out of scope.
The simplification removes both added helpers and intermediate located-issue objects. Against the merge base: production +23/-7 (net +16); tests +25/-32 (net -7), consolidating the existing MCP cases while retaining the reported regressions and adding an equally-close control.
Risk
Two-way door: reverting restores the old diagnostics. No persisted state or published API changes. Blast radius is malformed Template MCP validation diagnostics; valid declarations retain their existing behavior.
Evidence
Observed before/after receipts: four contributor regressions red on main merge-base and green on the contributor head; final focused suites 61/61. Source CLI cases and valid controls ran twice on each side. Final full declaration build and packed CLI smoke passed. All ran through ocx on macOS arm64 with isolated CLI HOME/state/profile paths.