Skip to content

fix(templates): publishing a Template from chat drops its CLAW.md description and rewrites its name - #196644

Merged
Patrick-Erichsen merged 1 commit into
openclaw:mainfrom
Yigtwxx:fix/template-draft-manifest-description
Nov 14, 2026
Merged

Patrick-Erichsen merged 1 commit into
openclaw:mainfrom
Yigtwxx:fix/template-draft-manifest-description

Conversation

@Yigtwxx

@Yigtwxx Yigtwxx commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Closes #196643

What Problem This Solves

Fixes: a Template published from chat loses the description written in its CLAW.md, and its explicit agent name is rewritten (Incident Follow-up Desk becomes Incident Follow Up Desk, macOS Release Notes becomes MacOS Release Notes), when the draft's top-level description is still the empty value new drafts start with.

User Impact

User impact: the Template review shows the name and description the agent wrote in CLAW.md, and the published package keeps them. A draft without an agent name still gets the readable title-cased default from its package slug, and editing or clearing the fields in review still takes precedence.

Why This Change Was Made

New drafts are seeded with description: "". The review was meant to fall back to the manifest's agent.description when the draft has no description of its own, but it used ??, which does not skip an empty string. As a result the fallback never ran for drafts created by OpenClaw, and the manifest description was removed. The review also passed an explicit agent.name through the title-casing meant for the slug default, which replaces - and _ with spaces and capitalizes every word.

Now an empty draft description falls back to the manifest description, and only the slug-derived default is title-cased. Review choices still win, so an explicit empty description from the review modal clears it.

#196427 (open) makes the review read-only. Once it lands, the manifest values are the only way to set the published name and description, so they need to survive review unchanged.

Evidence

A real Gateway built from main f4b43b47147 and from this branch, driven with openclaw gateway call through the same sequence the Control UI uses: templates.drafts.create → read → save (manifest with agent.name: Incident Follow-up Desk and agent.description, seeded top-level description: "") → review → publish with the choices the Control UI builds from that review. Only ClawHub is replaced: a loopback server answers whoami and saves the uploaded package, which is then extracted.

Build Review displayName Review description Uploaded CLAW.md agent
main f4b43b47147 Incident Follow Up Desk "" name: Incident Follow Up Desk, no description
this branch Incident Follow-up Desk Triage incoming incidents and hand off with evidence. name: Incident Follow-up Desk, description: Triage incoming incidents and hand off with evidence.

Control on main: the same run with the top-level draft description filled in publishes the description, so the harness does observe a kept description.

Uploaded CLAW.md frontmatter

main f4b43b47147:

schemaVersion: 1
agent:
  id: incident-triage
  name: Incident Follow Up Desk
metadata: {}
workspace:
  bootstrapFiles: {}
  files: []

this branch:

schemaVersion: 1
agent:
  id: incident-triage
  name: Incident Follow-up Desk
  description: Triage incoming incidents and hand off with evidence.
metadata: {}
workspace:
  bootstrapFiles: {}
  files: []

Focused checks:

  • src/templates/draft.test.ts: the new case fails on main (expected { … } to match object { …(2) }) and passes here. It also checks that an explicit empty choices.description still clears the description. 13/13 pass; the existing slug-default case ("Research Brief") still passes.
  • src/gateway/server-methods/templates-drafts.test.ts: 12/12 pass.
  • tsgo -p test/tsconfig/tsconfig.core.test.templates.json, oxfmt --check, oxlint, git diff --check: clean.
  • Test cost: pnpm test src/templates/draft.test.ts --maxWorkers=1 took 6.4 s of test time and 14.9 s wall time locally. The new case adds 33 test lines, recorded in config/test-lines-allocations/template-draft-manifest-identity.txt; check:test-lines-ratchet passes.

…eview

New drafts start with an empty top-level description, and the review
fallback used `??`, so the description authored in CLAW.md was always
dropped from the review and the published package. The review also
title-cased an explicit agent name, turning "Follow-up Writer" into
"Follow Up Writer". Only the slug-derived default is title-cased now,
and an empty draft description falls back to the manifest. Review
choices keep precedence.
@clawsweeper

clawsweeper Bot commented Nov 10, 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. 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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserves authored Template names and descriptions through draft review and publication while retaining explicit review overrides.

Example: Publish a draft with an empty top-level description and CLAW.md metadata naming Incident Follow-up Desk.

  • Before: The published name becomes Incident Follow Up Desk and the manifest description disappears.
  • After: The published name remains Incident Follow-up Desk and its authored description survives.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct repair with meaningful archive-level regression coverage and supplied shipped-entry-point publication evidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied real-Gateway CLI run exercises draft creation through publication with seeded-empty metadata, captures the upload using a loopback registry, and shows the extracted archive retaining the authored name and description after the fix.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Publishing a Template silently drops its authored description and alters capitalization and punctuation in its authored name.
Reason: Preserving supported authoring metadata restores the existing contract without adding options, owners, or unrelated behavior.

Merge readiness

✅ Ready for maintainer review

Keep this PR open for merge: it fixes a current metadata-loss bug with a focused change, useful regression coverage, and supplied Gateway publication evidence; no actionable defects were found.

Priority: P2
Reviewed head: ad66ca2f95a9185a01eadcf4126712ea73f3d89d

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Template draft owner turns agent-authored proposals and human review choices into an immutable archive that Gateway publication uploads to ClawHub.

flowchart LR
  A[Agent proposal] --> B[Private draft]
  B --> C[Draft preparation]
  D[Human review choices] --> C
  C --> E[Reviewed archive]
  E --> F[Gateway publication]
  F --> G[ClawHub]
Loading

Technical review

Best possible solution:

Merge the focused precedence correction in the existing draft owner, retaining slug-derived defaults and explicit human overrides.

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

Current-main source deterministically shows both failures for a seeded empty description and explicit manifest name; the contributor also supplies before-and-after Gateway publication output, which this read-only review did not rerun.

Is this the best way to solve the issue?

This is the smallest complete fix: correct the two precedence expressions in prepareTemplateDraft and exercise metadata preservation plus explicit clearing through its real archive-building path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 3f17d921f6cc.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +2, Tests +33, Other +2. Total +37 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 4 2 +2
Tests 1 33 0 +33
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 3 39 2 +37

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.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #196643
Summary: This PR owns the metadata-preservation repair described by the linked canonical bug report.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The Labs-gated Template publishing flow silently changes authored metadata, with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • 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.

Reviewed November 10, 2026, 6:55 AM ET / 11:55 UTC.

@Patrick-Erichsen
Patrick-Erichsen merged commit ab5a6d4 into openclaw:main Nov 14, 2026
129 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 14, 2026
…eview (openclaw#196644)

New drafts start with an empty top-level description, and the review
fallback used `??`, so the description authored in CLAW.md was always
dropped from the review and the published package. The review also
title-cased an explicit agent name, turning "Follow-up Writer" into
"Follow Up Writer". Only the slug-derived default is title-cased now,
and an empty draft description falls back to the manifest. Review
choices keep precedence.
obviyus added a commit that referenced this pull request Nov 16, 2026
…cription has stray spaces (#197979)

fix(templates): trim template name and description before review and publish

Template review and publish rejected a template whose name or description had leading or trailing spaces, even though the same metadata was accepted when the draft was created, so a valid draft could never be published. Review and publish now use the same trimmed values the draft accepted, keeping the precedence from #196644. No new text.

Evidence: a natural publish run through a local registry, twice per side: main rejects both padded paths; this change publishes four digest-verified archives. The #196644 precedence controls behave the same on both. 49 tests pass; lint, full build and fresh-consumer packed smoke pass. Receipts: #197979 (comment).

Thanks @SunnyShu0925.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 17, 2026
…cription has stray spaces (openclaw#197979)

fix(templates): trim template name and description before review and publish

Template review and publish rejected a template whose name or description had leading or trailing spaces, even though the same metadata was accepted when the draft was created, so a valid draft could never be published. Review and publish now use the same trimmed values the draft accepted, keeping the precedence from openclaw#196644. No new text.

Evidence: a natural publish run through a local registry, twice per side: main rejects both padded paths; this change publishes four digest-verified archives. The openclaw#196644 precedence controls behave the same on both. 49 tests pass; lint, full build and fresh-consumer packed smoke pass. Receipts: openclaw#197979 (comment).

Thanks @SunnyShu0925.

Co-authored-by: Ayaan Zaidi <[email protected]>
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: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Template review drops the CLAW.md description and rewrites the agent name when publishing from chat

2 participants