Skip to content

fix(templates): show why downloaded manifests are invalid - #198590

Open
borealisalastor-byte wants to merge 3 commits into
openclaw:mainfrom
borealisalastor-byte:fix/template-manifest-diagnostics
Open

borealisalastor-byte wants to merge 3 commits into
openclaw:mainfrom
borealisalastor-byte:fix/template-manifest-diagnostics

Conversation

@borealisalastor-byte

@borealisalastor-byte borealisalastor-byte commented Nov 14, 2026 •

Copy link
Copy Markdown

Closes #198556

What Problem This Solves

Adding a downloaded Template with an invalid manifest reports only a generic failure, hiding the field and reason needed to fix it.

User Impact

Template users and authors can see the manifest diagnostic codes, paths, and explanations when a downloaded package is rejected, including through catalog reads.

Why This Change Was Made

The verified-artifact reader already receives the diagnostics but discards them. Append all diagnostics to the existing error message, using the existing terminal-text sanitizer on each diagnostic before joining the lines. Preserve the clawhub_manifest_invalid error code and summary.

Keep diagnostic filenames package-relative at this downloaded-artifact boundary. Malformed YAML embeds the resolved filename in its parser message, so strip both the canonical package root and its caller-provided alias before sanitizing. This also covers packages reached through a directory symlink (a junction on Windows), without exposing the Gateway extraction directory through CLI or catalog errors.

The regressions read real packages with two invalid MCP server declarations, an ANSI escape in a metadata key, and malformed nested YAML through direct and linked package roots. They preserve diagnostic reasons and nested filenames while rejecting terminal controls and host-root paths.

Evidence

  • pnpm test src/templates/clawhub-source-artifact.test.ts --maxWorkers=1: 9 passed. The diagnostic regression failed before the original fix; the escape-character assertion failed without sanitization. Both direct-root and linked-root YAML cases failed before the path follow-up and pass with it. Final run: 3.46 seconds Vitest duration, 5.58 seconds wrapper duration.

  • pnpm tsgo:core: passed.

  • Targeted repository Oxlint, pnpm format:check for both changed files, and git diff --check: passed.

  • Independent Codex subagent reviews covered the original two-file change and the complete path follow-up against c34f48f132132fbe27c24303ad3bb10d399f2841; no remaining findings. The hosted ClawSweeper path-disclosure finding is addressed by the follow-up and its direct/linked-root regressions. Local standalone autoreview and local ClawSweeper were not run.

  • Related clawhub-source.test.ts: 47 passed, 2 failed on Windows with EPERM renaming an existing source directory. Restoring the original production file from the base reproduced the same two failures; this PR does not change that operation.

  • Official CLI proof at 7bfdd9b1b550ab66b271efae2b74de8f49818155: ran pnpm openclaw templates add @fixture/template --dry-run in text and JSON modes against real local tar artifacts with valid integrity/trust metadata and malformed manifests. All four invocations exited 1 after exactly four unauthenticated loopback GETs each. Text/JSON preserved both schema/MCP reasons (including a fixture key containing ANSI controls) and malformed YAML parse detail, along with the generic rejection headline. Emitted diagnostics contained no ANSI bytes, host-root path, or extraction-directory prefix. Isolated config was byte-for-byte unchanged; no agent, workspace, template, skill, plugin, or session was installed. Full CLI build, bootstrap import guard, plugin control-plane verification, and runtime postbuild passed. No Gateway/model endpoint was contacted. Example text output:

    Downloaded Template package manifest is invalid.
    invalid_manifest $.schemaVersion: Invalid input: expected 1
    invalid_manifest $.mcpServers.badserver: Invalid key in record
    

    Malformed YAML also reported invalid_template_frontmatter $: Could not parse CLAW.md: Flow sequence in block collection must be sufficiently indented and end with a ].

  • Hosted CI awaits maintainer approval; no broad CI pass is claimed.

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

@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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as a duplicate of #198583, an open, mergeable fix for the same diagnostic-loss boundary with real CLI proof; its required workflows still await maintainer authorization.

Root-cause cluster
Relationship: duplicate
Canonical: #198583
Summary: Both PRs repair discarded diagnostics in the downloaded-Template artifact reader; MCP diagnostic generation is a separate boundary.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: Consolidate the repair in #198583 and retain the linked bug report until that fix merges.

So I’m closing this here and keeping the remaining discussion on #198583.

Review details

Best possible solution:

Consolidate the repair in #198583 and retain the linked bug report until that fix merges.

Do we have a high-confidence way to reproduce the issue?

Current-main source demonstrably discards manifest diagnostics, matching the linked report's CLI reproduction; no target code was executed during this read-only review.

Is this the best way to solve the issue?

Repairing the existing shared artifact reader is appropriate, and the canonical alternative already covers that same fix without changing accepted manifests.

Security review:

Security review cleared: The patch sanitizes publisher-controlled diagnostics and removes package-root paths without changing authorization or artifact integrity checks.

AGENTS.md: found and applied where relevant.

What I checked:

  • Current-main defect remains: The current-main artifact reader still replaces failed manifest validation with a fixed message, discarding the returned diagnostics. (src/templates/clawhub-source-artifact.ts:244, 41d0dec31bfc)
  • Introduced change and prior finding: The pinned introduced diff appends existing diagnostics, sanitizes terminal controls, and removes canonical and caller-visible package roots; direct and linked-root regressions address the previous path-disclosure finding. (src/templates/clawhub-source-artifact.ts:247, 7bfdd9b1b550)
  • Canonical alternative: fix(templates): ClawHub Template Add says the manifest is invalid without saying why #198583 changes the same shared rejection owner, preserves its error code and validation behavior, sanitizes diagnostics, and removes package-root paths; its body supplies before/after CLI traces for local and Gateway-owned Add. (src/templates/clawhub-source-artifact.ts, 91c887117dbd)
  • Alternative merge and CI state: The canonical alternative is open, non-draft, and mergeable; CI and security workflows report action_required rather than executed test failures, so ordinary authorization and successful required checks remain necessary. (91c887117dbd)
  • Contributor behavior proof: The supplied current PR body records official CLI runs at the reviewed head against real loopback-served archives in text and JSON modes, showing schema and malformed-YAML diagnostics without terminal controls or extraction paths. (7bfdd9b1b550)
  • Feature history across the rename: History across the Claws and Templates paths identifies Patrick Erichsen's sustained work on artifact acquisition, canonical manifest admission, catalog loading, and the rename; the earlier artifact file already contains the generic rejection. (src/claws/clawhub-source-artifact.ts:151, db0d3d00ce53)

Codex review notes: model internal, reasoning medium; reviewed against 41d0dec31bfc.

@borealisalastor-byte

Copy link
Copy Markdown
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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. 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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: templates add @publisher/slug hides why a downloaded Template manifest is invalid

1 participant