Skip to content

fix(templates): ClawHub Template Add says the manifest is invalid without saying why - #198583

Merged
Patrick-Erichsen merged 1 commit into
openclaw:mainfrom
etzelm:fix/templates-clawhub-manifest-diagnostics
Nov 15, 2026
Merged

Patrick-Erichsen merged 1 commit into
openclaw:mainfrom
etzelm:fix/templates-clawhub-manifest-diagnostics

Conversation

@etzelm

@etzelm etzelm commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

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 packages key or a missing openclaw.template selector) 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 sanitizeTerminalText before it reaches Gateway RPC clients and the CLI (local and Gateway-owned Add).

Evidence

  • New tests in src/templates/clawhub-source-artifact.test.ts: a retired packages key is named in the message; an unparsable CLAW.md is named as CLAW.md without the cache path, also when the cache root is a symlink whose realpath contains the link path (as /private/tmp does /tmp on macOS). All fail on origin/main and pass with the fix.
  • src/cli/templates-cli.test.ts (local Add) and new src/cli/templates-cli.gateway-add.test.ts (Add through a running Gateway, real templates.add.plan handler): 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 packages key (@etzelm/job-application-coordinator 0.1.2 on ClawHub)

Mode A, before (exit 1):

$ openclaw templates add @etzelm/job-application-coordinator
Gateway owning <state dir> on local port 19583 could not complete templates.add.plan for Template configuration and provenance: Downloaded Template package manifest is invalid.. The outcome may be partial; inspect the operation's status and the target before retrying. No local fallback was attempted.

Mode A, after (exit 1):

$ openclaw templates add @etzelm/job-application-coordinator
Gateway owning <state dir> on local port 19583 could not complete templates.add.plan for Template configuration and provenance: Downloaded Template package manifest is invalid. retired_template_configuration at $.packages: Move native settings into CLAW.md agent and exact ClawHub references into skills/plugins. Use automations for scheduled work; remove packages, profiles, cronJobs, and metadata.openclaw.config; keep schemaVersion: 1.. The outcome may be partial; inspect the operation's status and the target before retrying. No local fallback was attempted.

The Gateway log line for the failed templates.add.plan carries the same reason after the change.

Mode B, before (exit 1):

$ openclaw templates add @etzelm/job-application-coordinator --acknowledge-clawhub-risk
Downloaded Template package manifest is invalid.

Mode B, after (exit 1):

$ openclaw templates add @etzelm/job-application-coordinator --acknowledge-clawhub-risk
Downloaded Template package manifest is invalid. retired_template_configuration at $.packages: Move native settings into CLAW.md agent and exact ClawHub references into skills/plugins. Use automations for scheduled work; remove packages, profiles, cronJobs, and metadata.openclaw.config; keep schemaVersion: 1.

In mode B the local Add asks for --acknowledge-clawhub-risk before 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):

$ openclaw templates add @acme/demo-agent
Gateway owning <state dir> on local port 19583 could not complete templates.add.plan for Template configuration and provenance: Downloaded Template package manifest is invalid. invalid_manifest at $: Unrecognized key: "evilkey". The outcome may be partial; inspect the operation's status and the target before retrying. No local fallback was attempted.

Mode B, after (exit 1):

$ openclaw templates add @acme/demo-agent
Downloaded Template package manifest is invalid. invalid_manifest at $: Unrecognized key: "evilkey"

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.

- 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.
@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: M labels Nov 14, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Includes 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.

  • Before: Downloaded Template package manifest is invalid.
  • After: The rejection identifies retired_template_configuration at $.packages and explains how to migrate the declaration.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct repair with shipped-entry-point evidence and distinct boundary regressions; required CI remains subject to GitHub's approval gate.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Pinned before/after real CLI traces exercise the changed artifact reader through local Add and Gateway-owned Add, showing actionable rejection details and sanitized control-bearing diagnostics in isolated setups.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Rejected downloaded Templates provide no reason that users can report or publishers can correct.
Reason: Restores existing diagnostic information at the point where it is lost, while preserving strict rejection and established trust boundaries.

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
Reviewed head: 91c887117dbd20f7d0e8e884915a336b735e98d3

Before merge

  • Await maintainer action - Approve the action_required workflows for head 91c8871.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Downloaded manifest rejection keeps the original intent (81662c5: Ordinary-agent Add introduced shared verified-artifact admission; the later rename changed its vocabulary and canonical-format cleanup retained strict rejection.)
  • Local CLI acquisition-error rendering keeps the original intent (a63f4df: Direct ClawHub acquisition reports source failures through the existing CLI failure owner while preserving cleanup and mutation boundaries.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +24, Tests +176. Total +200 across 5 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 2 27 3 +24
Tests 3 179 3 +176
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 206 6 +200

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Missing rejection details impede Template troubleshooting, with limited impact beyond invalid packages.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-14T02:44:46.640Z sha 91c8871 :: blocked before merge. :: none

Reviewed November 13, 2026, 10:02 PM ET / November 14, 2026, 03:02 UTC (Revision 2).

@etzelm

etzelm commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper clawsweeper Bot removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 14, 2026
@roboclaw-bot roboclaw-bot added the clawtributors PR from a clawtributor label Nov 14, 2026
@Patrick-Erichsen
Patrick-Erichsen merged commit 3900bb2 into openclaw:main Nov 15, 2026
154 of 155 checks passed
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 16, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawtributors PR from a clawtributor cli CLI command changes P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants