Skip to content

fix(skills): generalize freeform frontmatter value recovery beyond description - #122884

Merged
obviyus merged 6 commits into
openclaw:mainfrom
xydt-tanshanshan:fix/frontmatter-freeform-fields-122496
Aug 30, 2026
Merged

obviyus merged 6 commits into
openclaw:mainfrom
xydt-tanshanshan:fix/frontmatter-freeform-fields-122496

Conversation

@xydt-tanshanshan

@xydt-tanshanshan xydt-tanshanshan commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Workspace skills were silently omitted when a plain-text read_when or summary value contained an unquoted colon followed by a space.

For example, read_when: signals: user announcing a conversion task makes YAML report BLOCK_AS_IMPLICIT_KEY. The strict skill loader then rejects the complete skill.

This regressed behavior that stable OpenClaw releases accepted before strict frontmatter diagnostics landed in 0d31fbf5f0ec.

Related to #122496.

Why This Change Was Made

Markdown Core owns frontmatter parsing for every skill consumer. The repair keeps one canonical recovery loop there.

  • description keeps its shipped recovery for punctuation, reserved characters, alias-like text, and colon-rich text.
  • read_when and summary recover only when YAML reports BLOCK_AS_IMPLICIT_KEY on that exact top-level field and the value contains colon-space text.
  • Structured fields such as metadata remain strict.
  • Valid comments, quoted escapes, block scalars, and nested metadata retain normal YAML decoding.

The allowlist is closed: description, read_when, and summary. The parser does not recover arbitrary fields or arbitrary YAML failures.

User Impact

Valid workspace skills with colon-rich read_when or summary text now appear in openclaw skills list and in the model's <available_skills> prompt.

Malformed structured metadata still rejects the skill with a visible diagnostic.

Evidence

Real workspace skill

The same disposable workspace contained a valid control skill, a colon-rich skill, and a skill with malformed structured metadata.

Current main 0bd5c6a43b7d71e61834abf2f4b0b74cc92d6e46:

skills list: control-proof
available-skills prompt contains colon-proof: false
structured-proof rejected: true

Repaired head 0ec7dfae2ab172a53c16bc836a292bbf40491b5d:

skills list: colon-proof, control-proof
available-skills prompt contains colon-proof: true
structured-proof rejected: true
parsed read_when: signals: user announcing a conversion task
parsed summary: handles formats: pdf and docx
valid nested metadata emoji: beaker

The proof ran a remote pnpm build, the real openclaw skills list --json command, the workspace loader, and the exact prompt snapshot builder. Testbox runs: main red, head green.

Regression and focused tests

  • Original PR head 1fb253abde03f65ada9540d167ae63d5782e42dd failed three existing description-recovery tests.
  • Exact repaired head passed 59 parser and skill-owner tests: Testbox run.
  • Workspace loader and prompt suites passed 40 tests.
  • Oxfmt, Oxlint, git diff --check, and Autoreview passed.

Dependency contract

packages/markdown-core/package.json pins yaml 2.9.0. Its YAMLError.pos type provides the required source range, and resolve-block-map.js emits BLOCK_AS_IMPLICIT_KEY at the compact nested mapping offset. Alias conversion instead fails during toJS, so the repair retains the existing description-alias path without extending it to other fields.

Production size

Production: +33 lines. Tests: +95 lines.

The absorbing refactor keeps one parser owner and one bounded retry loop. No consumer workaround, fallback parser, or second recovery path was added.

@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@xydt-tanshanshan
xydt-tanshanshan marked this pull request as ready for review August 13, 2026 00:47
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 10:56 AM ET / 14:56 UTC.

ClawSweeper review

What this changes

The branch recovers colon-rich plain-text read_when and summary values at the YAML error location while retaining strict parsing for structured fields.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this PR open for maintainer judgment: the patch is a focused, evidence-backed repair, but it deliberately expands accepted malformed YAML in a shared Markdown Core parser.

Priority: P1
Reviewed head: 0ec7dfae2ab172a53c16bc836a292bbf40491b5d
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong real workspace proof and focused invariant coverage support the patch; the remaining gate is the deliberate shared-parser compatibility decision.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The changed production owner is Markdown Core’s frontmatter parser, reached by the skill loader; captured exact-head workspace evidence shows the previously omitted skill in the real CLI and available-skills prompt while malformed metadata still fails.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed production owner is Markdown Core’s frontmatter parser, reached by the skill loader; captured exact-head workspace evidence shows the previously omitted skill in the real CLI and available-skills prompt while malformed metadata still fails.
Evidence reviewed 6 items Changed parser boundary: The introduced recovery loop rewrites only an error-located top-level field in a closed allowlist, and retries parsing at most once per allowlisted field.
Observed skill rejection path: A parser issue is thrown by the skill-frontmatter owner, and the local loader turns it into a diagnostic while omitting that skill from loaded entries.
Coverage of parser invariants: The introduced tests cover one and multiple recovered text fields, quoted keys, valid sibling scalar semantics, nested metadata, and continued structured-field errors.
Findings None None.
Security None None.

How this fits together

Markdown Core parses frontmatter before the skills loader accepts workspace skills. Accepted skills then feed the CLI status and the model-visible available-skills prompt; hooks and bundled commands also consume the shared parser.

flowchart LR
  A[Skill Markdown file] --> B[Markdown Core frontmatter parser]
  B --> C{YAML error on allowed text field?}
  C -->|Yes| D[Rewrite only that field as a string]
  C -->|No| E[Preserve YAML result or error]
  D --> F[Skill loader]
  E --> F
  F --> G[CLI status and model skill prompt]
  B --> H[Hooks and bundled commands]
Loading

Decision needed

Question Recommendation
Should shared Markdown Core accept colon-rich malformed YAML for read_when and summary, matching the existing description compatibility recovery? Accept bounded recovery: Merge the closed allowlist and error-location guard so existing workspace skill text remains loadable without relaxing structured metadata.

Why: The implementation is bounded and preserves structured-field errors, but the parser is shared beyond workspace skills and this is an intentional input-language expansion.

Before merge

  • Resolve merge risk (P1) - Merging intentionally broadens the shared parser’s tolerance for malformed YAML on three named fields; maintainers should explicitly accept that compatibility policy before landing.
  • Resolve merge risk (P1) - The branch is behind fetched current main and some exact-head checks are still in progress, so merge readiness remains unproven despite GitHub reporting a clean merge.
  • Complete next step (P2) - The code has no discrete repair finding, but maintainers must choose the compatibility contract before it can land.
Agent review details

Security

None.

PR surface

Source +33, Tests +95. Total +128 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 46 13 +33
Tests 1 95 0 +95
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 141 13 +128

Review metrics

Metric Value Why it matters
Production versus test delta production +46/-13 (net +33); tests +95/-0 The added bounded retry and guards implement a compatibility expansion; the test growth covers the affected parser invariants.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #122496
Summary: This PR is a candidate repair for the linked workspace-skill frontmatter regression.

Members:

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

Merge-risk options

Maintainer options:

  1. Accept the bounded compatibility rule (recommended)
    Approve recovery only for error-located description, read_when, and summary fields after confirming this shared-parser contract.
  2. Pause for strict-parser policy
    Do not merge if malformed YAML must remain rejected outside the previously shipped description exception.

Technical review

Best possible solution:

Accept the error-positioned, three-field recovery only if maintainers want compatibility for previously tolerated skill text; otherwise retain strict YAML and surface the failure through the canonical skill diagnostic path.

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

Yes, by source and captured real-workspace evidence: a colon-rich read_when produces a parser issue that the skill loader rejects; the reviewed head records the skill loading after recovery.

Is this the best way to solve the issue?

Unclear pending policy: this is the clean owner-boundary repair if compatibility with previously tolerated plain text is desired, but the shared-parser grammar expansion needs maintainer acceptance.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 961904eb06a8.

Labels

Label justifications:

  • P1: The reported regression silently omits otherwise usable workspace skills from both CLI discovery and the model-visible catalog.
  • merge-risk: 🚨 compatibility: The shared parser newly accepts a defined subset of syntax that YAML otherwise rejects, affecting existing skill, hook, and bundle inputs.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed production owner is Markdown Core’s frontmatter parser, reached by the skill loader; captured exact-head workspace evidence shows the previously omitted skill in the real CLI and available-skills prompt while malformed metadata still fails.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed production owner is Markdown Core’s frontmatter parser, reached by the skill loader; captured exact-head workspace evidence shows the previously omitted skill in the real CLI and available-skills prompt while malformed metadata still fails.

Evidence

What I checked:

  • Changed parser boundary: The introduced recovery loop rewrites only an error-located top-level field in a closed allowlist, and retries parsing at most once per allowlisted field. (packages/markdown-core/src/frontmatter.ts:83, 0ec7dfae2ab1)
  • Observed skill rejection path: A parser issue is thrown by the skill-frontmatter owner, and the local loader turns it into a diagnostic while omitting that skill from loaded entries. (src/skills/loading/frontmatter.ts:25, 0ec7dfae2ab1)
  • Coverage of parser invariants: The introduced tests cover one and multiple recovered text fields, quoted keys, valid sibling scalar semantics, nested metadata, and continued structured-field errors. (packages/markdown-core/src/frontmatter.test.ts:97, 0ec7dfae2ab1)
  • Shared-consumer compatibility surface: Hooks and Claude bundle commands call the same generic parser, so accepting formerly invalid read_when or summary syntax is a shared-parser compatibility choice rather than a workspace-only change. (src/hooks/frontmatter.ts:23, 0ec7dfae2ab1)
  • After-fix behavior proof: The captured PR body records a real workspace before/after run on the exact reviewed head: the colon-rich skill appears in skills list and the available-skills prompt, while malformed structured metadata remains rejected. (0ec7dfae2ab1)
  • History limitation: The local promisor checkout could read the PR-tip commit but could not retrieve older source objects for a full introduction/provenance comparison because its remote DNS lookup failed; no predecessor is attributed.

Likely related people:

  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record maintainer acceptance or rejection of the three-field malformed-YAML compatibility rule, then wait for exact-head checks to finish.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (8 earlier review cycles)
  • reviewed 2026-08-13T00:53:46.944Z sha 605a86a932ebc5bc47fee03cbc4e1622ba34cfee :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-13T02:24:16.199Z sha 605a86a932ebc5bc47fee03cbc4e1622ba34cfee :: needs changes before merge. :: [P2] Recover only the field that caused the YAML error
  • reviewed 2026-08-13T03:23:27.762Z sha 14847f85c7b005c15e3a65a2cd7793a12ae24132 :: needs changes before merge. :: [P2] Do not rewrite valid quoted sibling scalars
  • reviewed 2026-08-13T04:18:38.433Z sha 3afc5b3f6e8980f67e2a8d7dd3f3c74fb5bb7336 :: needs changes before merge. :: [P1] Preserve quoted freeform keys during recovery
  • reviewed 2026-08-13T07:14:59.843Z sha 3afc5b3f6e8980f67e2a8d7dd3f3c74fb5bb7336 :: needs changes before merge. :: [P1] Preserve quoted freeform keys during recovery
  • reviewed 2026-08-13T07:23:00.901Z sha 9bc84db4104274c89c3f8fda7bcde50ef7565020 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-19T11:12:53.296Z sha 9bc84db4104274c89c3f8fda7bcde50ef7565020 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-25T12:05:33.030Z sha 1fb253abde03f65ada9540d167ae63d5782e42dd :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. 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 rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 13, 2026
xydt-tanshanshan and others added 6 commits August 30, 2026 16:35
…nd description

Pure-text scalar fields (read_when, summary) with an unquoted colon+space
inline value were silently dropped after the stricter YAML parser landed;
only description was recovered. Extend single-line freeform recovery to a
whitelist of pure-text fields while keeping structured fields (metadata,
install) strictly parsed.

Related to openclaw#122496

Co-Authored-By: Claude <[email protected]>
…AML error

The recovery loop rewrote every allowlisted field after any parse error,
turning a valid commented scalar like `description: text # note` into the
literal `text # note` when a sibling read_when needed recovery. Only
recover values whose inline colon+space actually triggers
BLOCK_AS_IMPLICIT_KEY; valid YAML scalars keep their comment and quote
semantics.

Co-Authored-By: Claude <[email protected]>
The previous guard still rewrote every allowlisted sibling whose value
contained a colon+space, which reserialized valid quoted scalars through
stripQuotes+JSON.stringify and broke YAML escape sequences (e.g. "line\n:
detail" lost its decoded newline). Anchor recovery to the YAML error
position: only the field whose value actually triggers
BLOCK_AS_IMPLICIT_KEY is rewritten, iterated per error so multiple
colon-rich fields are fixed without touching valid siblings.

Co-Authored-By: Claude <[email protected]>
The error-line matcher only accepted unquoted keys, dropping the quoted-key
recovery that current main explicitly supported for description. A quoted
colon-rich description ("description": signals: user) reached
BLOCK_AS_IMPLICIT_KEY but could not be rewritten, so the loader skipped a
skill that current main retains. Extend the matcher to unquoted,
double-quoted, and single-quoted allowlisted keys.

Co-Authored-By: Claude <[email protected]>
oxlint typescript(prefer-includes) flagged `!/: /.test(rawValue)` as a
regex test on a plain substring. Replace with the equivalent
`!rawValue.includes(": ")` to satisfy the rule; semantics are identical.

Co-Authored-By: Claude <[email protected]>
@obviyus
obviyus force-pushed the fix/frontmatter-freeform-fields-122496 branch from 1fb253a to 0ec7dfa Compare August 30, 2026 14:49
@obviyus

obviyus commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Maintainer decision: accept the bounded compatibility recovery.

  • Recover only error-located top-level description, read_when, and summary text.
  • Preserve the shipped broader description recovery forms.
  • Keep structured metadata and every non-allowlisted field strict.
  • Do not make Markdown Core generally permissive.

This resolves the compatibility choice raised in the previous review.

@obviyus

obviyus commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Thanks @xydt-tanshanshan!

Proof: A real workspace contained a valid control skill, a skill with colon-rich read_when and summary text, and a skill with malformed structured metadata. Current main omitted the colon-rich skill from both openclaw skills list and <available_skills>. Head 0ec7dfae2ab172a53c16bc836a292bbf40491b5d listed and injected it while still rejecting the malformed structured skill.

  • Bug: Strict YAML diagnostics silently removed valid shipped plain-text skill frontmatter from discovery.
  • Fix: Markdown Core now recovers only the three approved top-level text fields and keeps structured YAML strict.
  • Decision: Maintainers accepted the bounded compatibility rule; no general YAML fallback was added.
  • Gates: 59 focused tests passed, exact-head openclaw/ci-gate passed, and local ClawSweeper passed with no findings or security concerns.

Example

Before After
read_when: signals: user made the skill disappear The skill appears in skills list and the model prompt
metadata: owner: value rejected the skill The same malformed structured value still rejects the skill

@obviyus
obviyus merged commit 149a185 into openclaw:main Aug 30, 2026
177 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
Restore shipped skill discovery compatibility for colon-rich read_when and summary text.

Keep structured YAML strict and preserve the existing description recovery contract.

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

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

2 participants