Repository navigation
fix(templates): ClawHub Template Add says the manifest is invalid without saying why - #198583
Conversation
- readVerifiedArtifactSource dropped the reader diagnostics and threw a reason-free clawhub_manifest_invalid message. - The CLI, Gateway RPC and Gateway log showed only "Downloaded Template package manifest is invalid." - Append up to three reader diagnostics (code, path, message) and a count of the rest. - Reader messages name files by the Gateway cache path; report them relative to the package root instead. - Diagnostics can carry publisher-controlled text: each reported diagnostic goes through sanitizeTerminalText, so Gateway RPC clients and the owner-routed CLI print a clean message; the local CLI catch also sanitizes.
|
🦞👀 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: blocked before merge. What this changesIncludes sanitized, package-relative validation reasons when a downloaded Template manifest is rejected. Example: Add @etzelm/job-application-coordinator version 0.1.2, whose CLAW.md contains the retired packages key.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains This PR provides a focused fix for discarded manifest diagnostics, with credible CLI proof and no actionable code findings. Priority: P2 Before merge
FindingsNone. Agent review detailsHow this fits togetherThe shared Template artifact reader validates downloaded ClawHub packages and returns source snapshots or errors consumed by local Add, Gateway Add, and catalog requests. flowchart TD
A[CLI or Control UI] --> B[Template source resolver]
B --> C[Verified ClawHub archive]
C --> D[Manifest reader]
D --> E[Sanitized package-relative diagnostics]
E --> F[CLI or Gateway error]
Technical reviewBest possible solution: Retain the shared-reader fix and complete the existing required CI gates before merging. Do we have a high-confidence way to reproduce the issue? Current-main source demonstrably discards reader diagnostics, and the contributor supplies matching before/after CLI output; no target code was executed during this read-only review. Is this the best way to solve the issue? The artifact reader is the existing shared owner, and the focused formatting helper handles path normalization and sanitization without adding another validation path or changing accepted manifests. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8ebbcaf62a27. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +24, Tests +176. Total +200 across 5 files. Added test files: 1. 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:
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 (1 earlier review cycle)
Reviewed November 13, 2026, 10:02 PM ET / November 14, 2026, 03:02 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
openclaw#198583) - readVerifiedArtifactSource dropped the reader diagnostics and threw a reason-free clawhub_manifest_invalid message. - The CLI, Gateway RPC and Gateway log showed only "Downloaded Template package manifest is invalid." - Append up to three reader diagnostics (code, path, message) and a count of the rest. - Reader messages name files by the Gateway cache path; report them relative to the package root instead. - Diagnostics can carry publisher-controlled text: each reported diagnostic goes through sanitizeTerminalText, so Gateway RPC clients and the owner-routed CLI print a clean message; the local CLI catch also sanitizes.
What Problem This Solves
Fixes: Adding a published ClawHub Template with an invalid CLAW.md fails with only "Downloaded Template package manifest is invalid.", in the CLI, the Control UI and the Gateway log.
User Impact
User impact: users and Template publishers now see what is wrong (for example a retired
packageskey or a missingopenclaw.templateselector) and what to change, instead of a reason-free error. Nothing else about the failure changes: same error code, still fails closed.Why This Change Was Made
The manifest reader already returns specific diagnostics with fix text, but the ClawHub download path dropped them. The error message now carries up to three of them (code, path, message) plus a count of the rest. Reader messages that name a file by its absolute Gateway cache path are rewritten relative to the package root (realpath and link path, longest first), so clients do not see the Gateway host's home directory. Diagnostics can quote publisher-controlled text, so each reported diagnostic goes through
sanitizeTerminalTextbefore it reaches Gateway RPC clients and the CLI (local and Gateway-owned Add).Evidence
src/templates/clawhub-source-artifact.test.ts: a retiredpackageskey is named in the message; an unparsable CLAW.md is named asCLAW.mdwithout the cache path, also when the cache root is a symlink whose realpath contains the link path (as/private/tmpdoes/tmpon macOS). All fail on origin/main and pass with the fix.src/cli/templates-cli.test.ts(local Add) and newsrc/cli/templates-cli.gateway-add.test.ts(Add through a running Gateway, realtemplates.add.planhandler): a manifest key containing U+202E and U+009B is named in the error, and neither control character reaches the CLI output. Both fail without the sanitization.pnpm exec vitest run src/templates/clawhub-source-artifact.test.ts src/templates/clawhub-source.test.ts: 58 passed.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.In a sweep of the 28 third-party ClawHub Templates, 7 failed this way (5 retired format, 2 missing selector) and none of them said why.
Real CLI runs
Built from source: before = merge-base
82123cd17bd(main), after = this PR (91c887117db). Each run used a fresh isolated state dir with Templates enabled. Mode A has a Gateway running, so the CLI routes the Add through it. Mode B has no Gateway, so the CLI does the Add itself. The state dir path is shortened to<state dir>.Published Template with a retired
packageskey (@etzelm/job-application-coordinator0.1.2 on ClawHub)Mode A, before (exit 1):
Mode A, after (exit 1):
The Gateway log line for the failed
templates.add.plancarries the same reason after the change.Mode B, before (exit 1):
Mode B, after (exit 1):
In mode B the local Add asks for
--acknowledge-clawhub-riskbefore it downloads this release, so the flag is passed in both runs. Nothing was installed.Reason text with control characters (local test package served by a loopback registry stub)
The package's CLAW.md has an unknown key
evil+ ESC[31m+key+ U+202E (right-to-left override) + U+009B (C1 CSI) +31m.Mode A, after (exit 1):
Mode B, after (exit 1):
A byte check of the captured terminal output and the Gateway log found no ESC, U+202E or U+009B in the reason line. Before this change, both modes stopped at "Downloaded Template package manifest is invalid." with no reason for this package.
The "outcome may be partial" wording in mode A is a separate issue and is not changed here.