Skip to content

fix(oc-path): preserve comments when filling empty frontmatter values - #180918

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

steipete merged 19 commits into
openclaw:mainfrom
LinzeShi:daily/2026-10-22

Conversation

@LinzeShi

@LinzeShi LinzeShi commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: filling an empty Markdown frontmatter value absorbs an adjacent YAML comment into the new value.

User Impact

openclaw path set preserves the comment when replacing an empty value, including anchored fields and CRLF files. For example, key: # comment becomes key: new # comment.

Why This Change Was Made

An empty scalar's YAML range ends at the comment marker. Preserve a separator before that marker while retaining the existing newline and block-value handling.

Thanks @LinzeShi for the fix and before/after CLI proof. The original contributor commit is preserved.

Evidence

  • Four actual CLI regressions fail on main 798570bc460f96d8321744be7bb99637d44a5b7d: LF/CRLF files with empty plain or anchored values lose the intended comment boundary. Assertions verify exact output bytes and independently parse the edited YAML.
  • Final integrated head a159cebba8cca9a641dce1e57f985e79a713ce2d passes all 72 tests in extensions/oc-path/src/cli.test.ts with one worker.
  • The contributor's official Windows CLI replay used clean base 9d4827306a89 and fixed 08328734a080: the base absorbed comments, the fix retained them, and a nonempty-value control remained correct. This is retained contributor evidence; a fresh installed CLI build was not repeated on this Mac. Local tests exercise the repository CLI command boundary.
  • Matching extension type-aware oxlint, oxfmt, and scoped diff checks pass. Independent Codex review with edit/CLI/formatting context found no actionable P0–P2 findings.
  • Production +2/-2 (net 0); tests +13/-2. No new parser, configuration, or CLI option.
  • The merged quoted-value repair in fix(oc-path): comments leak into quoted frontmatter values #182792 addresses a different case and does not fix empty values before comments.

The contributor capture below is retained for inspection; final-head regression results are listed above.

Reproduction and captured output
---
key: # comment
next: keep
---
Body stays.
pnpm --silent openclaw path set 'oc://empty.md/[frontmatter]/key' new --file empty.md --json

The command exits 0 on both revisions, but the base writes key: new# comment; the fix writes key: new # comment. Other file bytes stay unchanged. The proof runner passes argv directly on Windows.

Captured fixed output below has only its temporary directory redacted:

{
  "ok": true,
  "dryRun": false,
  "bytesWritten": 50,
  "fsPath": "<temporary directory>/empty.md"
}

Focused commands:

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

Enforced security review still requires a maintainer approval for this head. Its notice flags src/gateway/tool-resolution-authority.ts in the integrated history.

@clawsweeper

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 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-26T18:11:09.680997Z
We couldn’t complete this review. Comment @codex review to try again.
a159ceb New commits
ℹ️ 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 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Preserve inline YAML comments when filling empty Markdown frontmatter values.

Example: Run openclaw path set 'oc://empty.md/[frontmatter]/key' new on a file containing key: # comment.

  • Before: The command writes key: new# comment, absorbing the comment into the value.
  • After: The command writes key: new # comment.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A minimal contract-restoring repair with reusable CLI evidence, meaningful regression coverage, and no identified actionable defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Retained Windows official-CLI base/fix evidence covers plain and anchored empty values, CRLF, and a nonempty control; the editor is byte-identical to the previously verified revision. Integrated authority proof exercises real Gateway own-job removal, sibling denial, and retained-grant revocation.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Filling an empty Markdown frontmatter field absorbs its inline comment into the new value or creates invalid YAML.
Reason: Restores the existing literal-value and source-preservation contract with a minimal repair; integrated changes outside oc-path already match fetched main.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR fixes a concrete defect still present on fetched main; no actionable defect was identified in the separator repair, and current-head maintainer security approval remains enforced.

Priority: P2
Reviewed head: a159cebba8cca9a641dce1e57f985e79a713ce2d

Before merge

  • Await maintainer action - Review the integrated sensitive changes and, if approved, provide the required current-head security approval for a159ceb.

Findings

None.

Agent review details

How this fits together

The optional OC Path plugin routes CLI file edits through its universal setter and Markdown source-range editor, then writes the resulting bytes.

flowchart LR
  A[Path set CLI] --> B[Load file]
  B --> C[Universal setter]
  C --> D[Markdown range editor]
  D --> E[YAML value boundary]
  E --> F[Preserved source bytes]
  F --> G[Write selected file]
Loading

Technical review

Best possible solution:

Keep the existing range editor and insert the missing separator before an adjacent YAML comment.

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

Fetched-main source exposes the missing separator, matching the retained contributor CLI reproduction; this read-only review did not execute target code.

Is this the best way to solve the issue?

The repair restores the documented contract in the existing owner, preserves newline and anchor behavior, and needs no additional parser or state.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Linze Shi: Raw commit 837a38a adds extensions/oc-path/src/oc-path/parse.ts:96 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 837a38a625cc; files: extensions/oc-path/src/oc-path/parse.ts)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster. Replaced prior rating: 🦞 diamond lobster.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • P2: A focused optional-plugin editing defect silently changes the requested value or produces invalid YAML.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster. Replaced prior rating: 🦞 diamond lobster.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • 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-22T19:22:28.999Z sha 0832873 :: needs maintainer review before merge. :: none

Reviewed October 26, 2026, 2:16 PM ET / 18:16 UTC (Revision 2).

steipete and others added 16 commits October 26, 2026 10:44
…penclaw#184142)

* test(memory): define paired embedding prefix contract

* fix(memory): format Nemotron inputs and refresh aliased vectors

* test(memory): narrow the embedding fixture provider

* fix(memory): honor explicit document formats in Gemini

* fix(memory): distinguish explicit raw document identity

* fix(memory): preserve vectors when adopting Ollama digests
…4775)

sortAndLimitSessionEntries used compareSessionEntryPairs as its comparator, which derived pin and timestamp facts on every comparison and allocated a lazily built pinnable set and closure for each list.

The sort now computes each entry's timestamp and effective pin once per list into typed arrays, sorts indices, and maps back. Ordering, including ties, pins and activity sorting, is unchanged. compareSessionEntryPairs loses its optional pinnable callback.

Evidence, 11 interleaved pairs: sort-path allocation 12,291 -> 10,845 bytes/list (-11.8%, 9/11 better); whole-list allocation flat; CPU inconclusive. The warm benchmark reuses cached selections, so the live effect is likely larger but unproven. 17 focused tests pass. Runtime +3 LOC.
Register the documented session-actor receipt measurement as an exact Knip entry so unused-file analysis recognizes the maintained command without altering runtime behavior.
…kends, and session jobs can't yield (openclaw#183987)

* fix(cron): scheduled runs take their automations scope and requester yield from the execution context

Scheduled occurrences on embedded and CLI runtimes read the automations scope
from context.toolPolicy.automations: the tool is restricted to the run's own job
(status, list, get, remove, runs), and a run with no scope gets none. The CLI
loopback now carries that self scope, which replaces the automations denial
0d5.10 left on scheduled CLI runs. A self-and-parent-wake scope offers the same
self actions; the parent wake action is a follow-up.

sessions_yield is refused for every scheduled placement, so session: jobs match
isolated ones. The exec target pin also reads from the context. Ingress turns
keep their existing CLI surface and yield.

Refs openclaw#178812

* fix(cron): session-target runs keep sessions_yield listed and refuse the call

A session: run shares its session's tool catalog, and CLI backends hash that
catalog for native session reuse, so the definition stays listed and the
scheduled callback refuses the call. Child and detached runs still get no
sessions_yield. Adds coverage that a CLI run's retained self-scoped automations
tool refuses its own job's removal once the run closes, including a close
during an awaited Gateway call.

* fix(agents): keep the scheduled exec pin on its existing tool-policy source

The context copies the same stored exec target, so reading it there changed
nothing; keep the existing source until a consumer needs the context's pin.

* test(cron): CLI self-removal through the real Gateway cron handler

A scheduled CLI run's self-scoped automations tool removes its own job through
the in-process Gateway dispatch and cron.remove handler, and the job stays when
the run settles while the removal awaits the store.

* test(cron): pin the self-and-parent-wake scope to self actions; name session-job losses in Doctor

The context can name a parent wake for an owner child, but the wake action is
deferred to the automations wake design; a test pins that both runtimes offer
own-job self actions only. Doctor's access review describes the CLI automations
narrowing and the sessions_yield loss for session-target jobs, under a heading
that no longer attributes every loss to creator authority.

* test(cron): CLI self-removal settles against the real cron service and store

The scheduled CLI run's automations tool removes its own job through the real
Gateway cron handlers, CronService and store. When the run settles while the
service's removal is held before persistence, the removal is refused and the
stored job is unchanged.
…penclaw#184120)

Sanitize completion installation status paths and suppress unsafe shell reload hints while preserving literal profile writes and ordinary shell commands.

Validation: the regression fails on base and all 30 runtime tests plus 13 CLI consumer tests pass on the reviewed head. Targeted lint/format and exact-head CI pass.

Co-authored-by: Alix-007 <[email protected]>
…claw#184157)

* fix(sessions): preserve agent transcript IDs across automatic resets

Append the existing reset boundary at admitted command persistence so idle and daily resets keep historical messages indexed. Preserve terminal recovery rotation and explicit session-ID resume behavior.

Co-authored-by: SeungTaek Lim <[email protected]>

* fix(sessions): preserve Gateway automatic reset boundaries

Keep the durable transcript ID through Gateway agent preparation, share reset metadata cleanup, and commit the boundary with the renewed lifecycle. Preserve the triggering RPC source during cleanup and the ended transcript window for hooks.

Co-authored-by: SeungTaek Lim <[email protected]>

* fix(sessions): preserve reset consumer contracts

Keep Gateway explicit-ID expiry semantics while preserving transcript IDs. Align voice and Gateway consumer assertions, adapt the in-memory lifecycle fixture, and retain the original patch accessor binding used by restart-settlement tests.

* test(gateway): decouple accessor fixture types

Define the fixture dependency surface from the accessor contracts instead of importing its parent mock module. This removes the type-only import cycle without changing fixture execution or production code.

---------

Co-authored-by: SeungTaek Lim <[email protected]>
…claw#184842)

Transfer the fresh scanner result map to reconciliation, reuse tracked path membership, and avoid repeated logical-path lookups on unchanged files. Preserve failed-read retries and cached directory fingerprints.
…w#176941)

Prevent the replacement Stop button from accepting an accidental second Send tap for its first 700 ms, while retaining deliberate cancellation and the existing abort owner.

Preserve the shared native composer path, view-bound task cancellation/reset and voice-note behavior. Existing native production-timing red/green proof is retained; the web Control UI is unchanged.

Co-authored-by: Solvely-Colin <[email protected]>
Co-authored-by: Marvinthebored <[email protected]>
…nclaw#184672)

Keep accepted workspace preparation pending during temporary source contention, sharing the existing wait budget through checkout and final session binding without repeating setup.

Fixes openclaw#184272.
…claw#183770)

Load private conversations in native macOS chat through the existing private session-entry document route instead of the public conversation document. Preserve canonical mounted return paths, escaped drafts, authentication and native draft/focus ownership.

Validation: five exact-blob Foundation route tests, SwiftLint and repository-pinned SwiftFormat pass; exact-head CI 40257600942 is green. Signed contributor native evidence shows the baseline unavailable document and the final WebView receiving a fresh synthetic chat.inject message. This maintenance pass did not relaunch the native session.

Co-authored-by: pstarkgit <[email protected]>
…penclaw#184754)

* perf(ui): trim Settings search dependencies

Move shared Memory keys into config sections and register only shared session labels for Settings targets, preserving the full catalog order and synchronous registration.

* test(ui): measure native Settings root cold loads

* perf(ui): keep Settings search out of optional session chunk

Share the dependency-free dedupe helper through the existing boot group and keep shared session English copy with the existing English group. Settings retains its search labels without evaluating optional session UI.

* test(ui): await lazy chat details before assertions
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: ios App: ios app: macos App: macos app: web-ui App: web-ui gateway Gateway runtime extensions: memory-core Extension: memory-core cli CLI command changes labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ Maintainer security changes approved

A maintainer approved this revision with an explicit security approval comment.

A later push requires a fresh approval comment for an external contributor's PR.

@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. labels Oct 26, 2026
@steipete

Copy link
Copy Markdown
Contributor

/allow-security-sensitive-change

@steipete
steipete merged commit 3f9df34 into openclaw:main Oct 26, 2026
130 of 147 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
…openclaw#180918)

Preserve inline comments when setting empty frontmatter scalar values.

Regression tests cover the original defect and expected supported behavior.

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

agents Agent runtime and tooling app: ios App: ios app: macos App: macos app: web-ui App: web-ui clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: codex extensions: google extensions: memory-core Extension: memory-core extensions: oc-path extensions: ollama gateway Gateway runtime 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. scripts Repository scripts security-sensitive-changed size: XL 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.

8 participants