Repository navigation
fix(templates): failed Template Add preview warns the Add may be partial - #198521
Conversation
- templates.add.plan is read-only, but its error reply carried no mutationAccepted marker. - The owner-routed CLI therefore told users a failed preview "may be partial" and to inspect state before retrying. - Mark preview failures with details.mutationAccepted false, as other read-only owner methods do.
|
🦞👀 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 changesMarks failed Template Add previews as having accepted no mutation so the CLI stops warning about a partial Add. Example: Run openclaw templates add @etzelm/job-application-coordinator against an isolated Gateway when its manifest is invalid.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a real misleading preview-failure warning with a focused change; no introduced correctness or security defect was found, but the required CI gate is not successful. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Template planning Gateway handler resolves a published package and returns a preview or error; the CLI's state-owner adapter uses error details to distinguish rejected work from an uncertain mutation. flowchart LR
A[Templates CLI] --> B[State owner adapter]
B --> C[Gateway preview handler]
C --> D[Template planner]
D --> E[ClawHub source preview]
C --> F[Error with mutation marker]
F --> B
Technical reviewBest possible solution: Keep the no-mutation marker at the existing Gateway preview owner and merge this focused repair after the required CI gate succeeds. Do we have a high-confidence way to reproduce the issue? Current-main source directly connects an unmarked preview failure to the partial-outcome warning, and the contributor supplies matching live before/after output; no target code was executed during this read-only review. Is this the best way to solve the issue? This is the smallest complete fix: the read-only preview owner supplies the existing outcome marker on both catch branches without changing apply semantics, introducing another owner, or adding configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9156de83fa53. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +2, Tests +15. Total +17 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: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed November 13, 2026, 7:51 PM ET / November 14, 2026, 00:51 UTC. |
|
Merged via squash.
|
…claw#198521) - templates.add.plan is read-only, but its error reply carried no mutationAccepted marker. - The owner-routed CLI therefore told users a failed preview "may be partial" and to inspect state before retrying. - Mark preview failures with details.mutationAccepted false, as other read-only owner methods do.
What Problem This Solves
Fixes: when
openclaw templates addruns against a Gateway and the preview fails, the CLI says "The outcome may be partial; inspect the operation's status and the target before retrying", although a preview never changes anything.User Impact
User impact: a failed preview now reports that no local mutation was attempted, so users retry or fix the Template instead of inspecting state for a partial Add that cannot exist.
Why This Change Was Made
The CLI routes Add through the Gateway that owns the state dir and treats any error reply without
details.mutationAccepted: falseas an unknown outcome.templates.add.planis read-only but sent no marker on either failure branch. Both its UNAVAILABLE and its FORBIDDEN (Labs disabled) replies now carrymutationAccepted: false, as other read-only owner methods already do. Error codes and messages are unchanged.Evidence
src/gateway/server-methods/templates-add.test.ts: new cases assert the marker on UNAVAILABLE for a ClawHub source error and a generic error; the existing "Labs switched off mid-request" case now also asserts it on FORBIDDEN. They fail on origin/main and pass with the fix.pnpm exec vitest run src/gateway/server-methods/templates-add.test.ts src/cli/templates-cli.state-owner.test.ts: pass.pnpm check:changed --base origin/main: everything passes except the dead export scan, which fails the same way on origin/main in files this PR does not touch.openclaw templates add @etzelm/job-application-coordinatoragainst an isolated Gateway (preview fails on an invalid manifest):Known gap: the "after" recovery text still suggests updating the Gateway or fixing authentication, which is the CLI's generic owner-refused wording. Changing that text is out of scope here.