Skip to content

fix(oc-path): prevent duplicate YAML timestamp keys during edits - #169266

Merged
obviyus merged 5 commits into
openclaw:mainfrom
LinzeShi:daily/2026-10-11
Oct 22, 2026
Merged

obviyus merged 5 commits into
openclaw:mainfrom
LinzeShi:daily/2026-10-11

Conversation

@LinzeShi

@LinzeShi LinzeShi commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

For YAML 1.1 timestamp mapping keys, path find and resolve can identify a real leaf, but writing through that address can append a duplicate timestamp key. The resolved Date object loses key identity when the YAML document is cloned.

Changes

Refuse leaf replacements whose resolved path contains an object-valued key before cloning. Return the existing unresolved error without changing the file; do not redirect the write to a same-spelling textual key or claim timestamp mutation support. Selected primitive string keys remain writable. Document the refusal in the CLI mutation contract.

Thanks to @LinzeShi for the integrity guard and collision regression cases; their commit is retained. The regression uses the current parseYaml return contract after main integration.

Evidence

Built main 2fd898bb338c42126c8116fbe8e30a3fea64ba28 and candidate independently in isolated Node 24.22.1 Linux Docker. Enabled the shipped oc-path plugin. For each ordinary user-owned YAML 1.1 input, used the actual address returned by built path find, confirmed its selected leaf with path resolve, then invoked path set. Independently parsed and counted keys and compared exact source bytes.

Input Main Candidate
Timestamp-only mapping, twice Reports success; key count grows 1 → 2 both times Nonzero unresolved; bytes unchanged both times
Timestamp before same-spelling string key Reports success; key count grows 2 → 3 Nonzero unresolved; both entries and source bytes unchanged
Same-spelling string key first Updates selected string only; key count stays 2 Same update; timestamp entry unchanged

Simplification: one four-line guard in the existing YAML write owner, no fallback or second writer. Whole PR production +4/-0, tests +33/-0; necessary growth enforces the identity boundary. No SDK, schema, configuration, or migration changes.

Merge danger: reverting cannot repair duplicate keys already written by older builds. The code change itself is a two-way door. Blast radius is leaf replacement through object-valued YAML keys; ordinary primitive-key writes retain their behavior.

@clawsweeper

clawsweeper Bot commented Oct 11, 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 11, 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 ✅ Completed 2026-10-11T18:21:40.961544Z 70d9639 PR opened
ℹ️ 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 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. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR refuses YAML leaf replacements through object-valued mapping keys before cloning can create duplicate entries.

Example: A YAML 1.1 document contains 2001-12-15: original, and the user sets its discovered address to updated.

  • Before: The command reports success but appends another timestamp key, leaving the original value unchanged.
  • After: The command returns nonzero with unresolved and preserves the exact file bytes.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused integrity repair with production CLI before/after evidence, distinct collision controls, no unnecessary machinery, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The body and exact-head collaborator report exercise the built shipped CLI with oc-path enabled in isolated Linux Docker: find supplies the address, resolve confirms the selected leaf, and set refuses timestamp-only and timestamp-first cases with byte preservation while the string-first control updates correctly.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Writing a successfully resolved YAML timestamp leaf can report success while adding a duplicate mapping key.
Reason: Preventing a demonstrated corrupting write is clear user value, and the change adds no new owner, option, or public API.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a current YAML corruption path with a focused guard, useful regression coverage, and supplied shipped-CLI proof; no actionable findings remain.

Priority: P2
Reviewed head: ad9cb4b9aa67fccb81fecb12c15dd4daabe631b2

Before merge

None.

Findings

None.

Agent review details

How this fits together

The bundled oc-path plugin translates CLI addresses into YAML document paths, applies edits through the YAML adapter, and returns bytes for the CLI to write.

flowchart TD
  A[Path set CLI] --> B[Universal edit dispatch]
  B --> C[YAML path resolver]
  C --> D[Object key guard]
  D --> E[Unresolved refusal]
  D --> F[Clone and edit YAML]
  F --> G[CLI file write]
Loading

Technical review

Best possible solution:

Keep the guard in the existing YAML mutation owner, preserving primitive-key edits while refusing identity-unstable replacements before cloning.

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

Current-main source and yaml 2.9.1 identity comparisons establish the failure path; supplied built-CLI comparisons confirm it, although this read-only review ran no target code.

Is this the best way to solve the issue?

The four-line guard is the smallest complete repair for the stated integrity defect: it retains canonical addressing, prevents duplicate-key writes, and preserves the selected primitive-string control.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 88e5dc1 adds extensions/oc-path/src/oc-path/yaml/edit.ts:26 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 88e5dc121934; files: extensions/oc-path/src/oc-path/yaml/edit.ts)
  • Gio Della-Libera: Raw commit 0b708a2 adds extensions/oc-path/src/oc-path/yaml/edit.ts:37 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0b708a257464; files: extensions/oc-path/src/oc-path/yaml/edit.ts)

PR surface

Source +4, Tests +33, Docs +2. Total +39 across 3 files. Added test files: 0.

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

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +4/-0; tests +33/-0 A single guard in the existing writer protects three distinct cases: timestamp-only refusal, timestamp-first collision refusal, and preserved string-first edits.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Prevents file corruption in the limited YAML 1.1 object-key replacement path of an optional bundled CLI plugin.
  • 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 (6 earlier review cycles)
  • reviewed 2026-10-11T18:19:46.984Z sha 70d9639 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-11T18:27:25.313Z sha 70d9639 :: needs changes before merge. :: [P2] Keep object-valued scalar keys out of reparsed mutation paths
  • reviewed 2026-10-11T19:13:19.718Z sha 5751aa6 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T00:53:50.178Z sha 5751aa6 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-16T19:32:26.870Z sha b334ad4 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-17T17:40:34.989Z sha b334ad4 :: needs maintainer review before merge. :: none

Reviewed October 22, 2026, 4:35 PM ET / 20:35 UTC (Revision 7).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 70d9639efb

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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. labels Oct 11, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@LinzeShi

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added 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 rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 12, 2026
@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@LinzeShi

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Added current-head shipped CLI proof for both timestamp/string collision orderings to the PR body. All six official CLI commands passed the expected read, refusal, dry-run, and exact written-byte checks at b334ad4. No code changed.

@clawsweeper

clawsweeper Bot commented Oct 17, 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. 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 rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 17, 2026
@obviyus

obviyus commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Exact head ad9cb4b: 34 focused YAML tests pass; changed-file formatting/lint pass. Built shipped find/resolve/set proof shows main duplicates timestamp keys (1→2 twice, and 2→3 with a timestamp-first collision), while candidate refuses with unresolved and preserves exact bytes. String-first primitive-key control still updates correctly on both. Supporting bounded gpt-5-mini agent smoke returned CLI_LIVE_OK; isolated credential removed afterward.

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Oct 22, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@obviyus
obviyus merged commit 4fca771 into openclaw:main Oct 22, 2026
102 of 103 checks passed
@obviyus

obviyus commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Landed in 4fca771. Thanks @LinzeShi. Editing YAML timestamp keys no longer adds duplicate keys.

@obviyus

obviyus commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Merged—thank you @LinzeShi for the YAML key-identity guard. Built find/resolve/set proof confirmed timestamp writes now refuse without duplicating keys, while the selected string-key control remains writable.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
…nclaw#169266)

fix(path): refuse to edit YAML timestamp keys instead of duplicating them

Editing a YAML 1.1 key that parses as a timestamp (for example `2024-01-01:`) could append a duplicate key, because cloning the document lost the key's identity. Such an edit is now refused as unresolved and the file is left byte-for-byte unchanged; ordinary string keys still update in place.

Evidence: built CLI, find → resolve → set. On main a timestamp-only key went from one entry to two, and a timestamp-first collision from two to three (twice each); with this change the set is refused and the file is identical (twice each). A string-first file still updates only the string key. Production +4, docs note the refusal.

Thanks @LinzeShi.

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

docs Improvements or additions to documentation 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