Repository navigation
fix(templates): publishing a Template from chat drops its CLAW.md description and rewrites its name - #196644
Conversation
…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.
|
🦞👀 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 changesPreserves 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +2, Tests +33, Other +2. Total +37 across 3 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. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 Reviewed November 10, 2026, 6:55 AM ET / 11:55 UTC. |
|
Merged via squash.
|
…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.
…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]>
…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]>
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 DeskbecomesIncident Follow Up Desk,macOS Release NotesbecomesMacOS Release Notes), when the draft's top-leveldescriptionis 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'sagent.descriptionwhen 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 explicitagent.namethrough 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
f4b43b47147and from this branch, driven withopenclaw gateway callthrough the same sequence the Control UI uses:templates.drafts.create→read→save(manifest withagent.name: Incident Follow-up Deskandagent.description, seeded top-leveldescription: "") →review→publishwith the choices the Control UI builds from that review. Only ClawHub is replaced: a loopback server answerswhoamiand saves the uploaded package, which is then extracted.displayNamedescriptionCLAW.mdagentf4b43b47147Incident Follow Up Desk""name: Incident Follow Up Desk, no descriptionIncident Follow-up DeskTriage 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
descriptionfilled in publishes the description, so the harness does observe a kept description.Uploaded CLAW.md frontmatter
main
f4b43b47147:this branch:
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 emptychoices.descriptionstill 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.pnpm test src/templates/draft.test.ts --maxWorkers=1took 6.4 s of test time and 14.9 s wall time locally. The new case adds 33 test lines, recorded inconfig/test-lines-allocations/template-draft-manifest-identity.txt;check:test-lines-ratchetpasses.