Skip to content

fix(oc-path): comments leak into quoted frontmatter values - #182792

Merged
steipete merged 2 commits into
openclaw:mainfrom
LinzeShi:daily/2026-10-24
Oct 26, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
LinzeShi:daily/2026-10-24

Conversation

@LinzeShi

@LinzeShi LinzeShi commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

path resolve returns quote syntax and a trailing YAML comment as part of a quoted Markdown frontmatter value, including after that value is written with path set.

User Impact

Quoted values with inline comments resolve to their decoded text. Reads preserve the file, and later edits retain comments and surrounding content.

Why This Change Was Made

The existing YAML decoder handles values beginning with a quote even when a comment follows the closing delimiter. The existing tolerant malformed-input fallback and plain-value behavior remain. This keeps one parser owner and adds no configuration or schema.

Thanks to @LinzeShi for the fix, regression coverage, and shipped Windows CLI proof. Contributor commits are preserved. Simplification retained the two-line repair: production delta 0, test delta +5.

Evidence

  • Base owner plus regression tests: 5 failed, 78 passed, specifically quoted/commented parsing and the CLI write/read path (68.36 seconds including compilation/runner).
  • Fixed owner: 83/83 passed, including malformed-input and byte-preservation controls (94.09 seconds including compilation/runner; 0.64 seconds of assertions across both files).
  • Independent Codex autoreview: scoped-clean, no actionable P0–P2 finding. Targeted formatting and diff checks pass; focused plugin typecheck passes; the final integrated rerun is recorded below.

The contributor's shipped Windows CLI proof below uses isolated home/config/state and disposable Markdown files. The parser repair is unchanged. This lane reruns the real registered CLI/file-I/O boundary locally; a separate packaged macOS CLI build was not live-tested to keep additional live work within the targeted proof budget.

Reproduction and captured output

Fixture single.md:

---
note: 'don''t' # annotation
---
## Body
- untouched
pnpm --silent openclaw path resolve 'oc://single.md/[frontmatter]/note' --file single.md --json

The proof runner passes these arguments directly on Windows. Both commands exit 0; the returned value differs:

Before:

{
  "resolved": true,
  "ocPath": "oc://single.md/[frontmatter]/note",
  "match": {
    "kind": "leaf",
    "valueText": "'don''t' # annotation",
    "leafType": "string",
    "line": 2
  }
}

After:

{
  "resolved": true,
  "ocPath": "oc://single.md/[frontmatter]/note",
  "match": {
    "kind": "leaf",
    "valueText": "don't",
    "leafType": "string",
    "line": 2
  }
}

Focused tests cover YAML escapes, doubled apostrophes, literal hashes, malformed input, and CLI read-after-write followed by an unrelated edit that preserves the comment and body.

node scripts/run-vitest.mjs run extensions/oc-path/src/cli.test.ts extensions/oc-path/src/oc-path/tests/parse.test.ts --maxWorkers=1
node scripts/run-vitest.mjs run extensions/oc-path --maxWorkers=1

Integrated current main (96938085d6496d442a06524f8f9344a7d885a7f8) with contributor commits intact. The parser and its focused tests remain byte-identical to the reviewed source. Final head 31d923baa06a3405e9d9273b75b51156d5bfdc17 passes both affected files, 83 tests, in 63.74 seconds including compilation/runner. The initial worktree run lacked an existing QuickJS dependency needed by test subprocess compilation; the supported dependency link fixed that setup without source or dependency changes. Local merge-tree succeeds.

check-changed passed its selected type, lint, formatting, i18n, and ownership guards. Its only failure was the broad unused-export scan in untouched test helpers; the production unused-export scan passed. No exported API is introduced by this change.

Exact-head CI 40252009688 passed on 31d923baa06a3405e9d9273b75b51156d5bfdc17; the CI watcher reports GREEN, excluding superseded cancelled checks. ClawSweeper reviewed this exact head with no findings and sufficient terminal proof.

@clawsweeper

clawsweeper Bot commented Oct 24, 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.

@LinzeShi
LinzeShi marked this pull request as ready for review October 24, 2026 19:07
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-24T19:09:51.205801Z
We couldn’t complete this review. Comment @codex review to try again.
777a695 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug 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: 🦞 diamond lobster Very strong PR readiness with only minor 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. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Decode quoted Markdown frontmatter strings when an inline YAML comment follows the closing quote.

Example: Resolve note from single.md containing note: 'don''t' # annotation.

  • Before: valueText is 'don''t' # annotation.
  • After: valueText is don't.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Minimal owner-level repair with supplied shipped CLI evidence, meaningful regressions, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Supplied Windows CLI output exercises path resolve against a real commented frontmatter fixture and shows decoded text after the fix; unchanged parser code permits reuse after integration, supported by the reported current-head regression rerun. Source inspection verifies no persisted-format or writer change requiring migration.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Resolving a quoted frontmatter value with an inline comment returns YAML syntax instead of decoded text.
Reason: Restores the documented string-leaf behavior within the existing plugin parser without adding configuration, dependencies, or public APIs.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it repairs a current parser bug with a minimal change and no actionable findings; exact-head CI is still finishing.

Priority: P2
Reviewed head: 31d923baa06a3405e9d9273b75b51156d5bfdc17

Before merge

None.

Findings

None.

Agent review details

How this fits together

The optional oc-path plugin loads workspace files for the path CLI, parses frontmatter into string leaves, and returns resolved values or applies targeted file edits.

flowchart LR
  A[Markdown file] --> B[Path CLI loader]
  B --> C[Markdown parser]
  C --> D[YAML scalar decoder]
  D --> E[Frontmatter string leaf]
  E --> F[Resolve output]
Loading

Technical review

Best possible solution:

Use the existing YAML decoder for quote-prefixed scalars while preserving malformed-input tolerance and source bytes.

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

Current-main source deterministically bypasses decoding for the supplied fixture, matching the contributor's before/after CLI output; this review executed no target code.

Is this the best way to solve the issue?

This is the smallest complete repair: change admission to the existing decoder and retain the original fallback, with focused parser cases and an extended CLI preservation test.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7b5ce25ee53a.

Provenance checked

  • Plugin-owned Markdown frontmatter parsing keeps the original intent (refactor: replace core oc-path with bundled plugin #79328: Move oc-path into a bundled plugin with plugin-local parsing and CLI registration.)
  • Quoted-scalar decoding and malformed-input tolerance keeps the original intent (c5c2b7f: Decode YAML quoted scalars correctly while retaining tolerant handling of malformed hand-authored values.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Linze Shi: Raw commit c5c2b7f adds extensions/oc-path/src/oc-path/parse.ts:110 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c5c2b7fd6f44; files: extensions/oc-path/src/oc-path/parse.ts)
  • Peter Steinberger: Raw commit e3b33a2 adds extensions/oc-path/src/oc-path/parse.ts:122 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e3b33a26cdb1; files: extensions/oc-path/src/oc-path/parse.ts)
  • Gio Della-Libera: Raw commit 7b7e651 adds extensions/oc-path/src/oc-path/parse.ts:111 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7b7e65105b0d; files: extensions/oc-path/src/oc-path/parse.ts)

PR surface

Source 0, Tests +5. Total +5 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 2 2 0
Tests 2 6 1 +5
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 8 3 +5

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Incorrect string resolution affects commented Markdown frontmatter in the optional path CLI, with limited blast radius.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-24T19:23:12.137Z sha 777a695 :: needs maintainer review before merge. :: none

Reviewed October 25, 2026, 9:05 PM ET / October 26, 2026, 01:05 UTC (Revision 2).

@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 26, 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 26, 2026
@steipete
steipete merged commit 837a38a into openclaw:main Oct 26, 2026
118 of 119 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
…w#182792)

Decode quoted frontmatter scalars with the existing YAML owner even when an inline comment follows. Keep malformed-value fallback and preserve unrelated file content.

Co-authored-by: LinzeShi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: oc-path P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

2 participants