Skip to content

fix(oc-path): follow YAML aliases in path resolve, find and set - #189784

Merged
obviyus merged 6 commits into
openclaw:mainfrom
jerome-queck:fix/oc-path-yaml-aliases
Oct 31, 2026
Merged

obviyus merged 6 commits into
openclaw:mainfrom
jerome-queck:fix/oc-path-yaml-aliases

Conversation

@jerome-queck

@jerome-queck jerome-queck commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #189774

What Problem This Solves

openclaw path resolve, path find, and alias-slot path set treat YAML aliases as missing instead of following their anchored value. Files that share YAML values through anchors cannot be read or searched consistently through ordinary oc:// addresses.

User Impact

Scalar/intermediate aliases resolve, wildcard and predicate searches include alias-backed values, and replacing an alias slot leaves its anchor intact. Writes through aliases remain refused. Recursive searches stop at cyclic alias edges without dropping distinct noncyclic logical paths. Reported line numbers refer to the anchor; merge keys (<<) remain outside this change.

Why This Change Was Made

Reuse YAML's existing Alias.resolve(doc) at the shared resolver/finder owner. Preserve the logical edit slot and existing write restrictions. Keep the synchronous find document context bounded by try/finally, and use branch-scoped node/remaining-pattern memoization for recursive alias cycles.

All three commits by @jerome-queck are preserved; production is unchanged from the reviewed cyclic-alias repair. The follow-up documents behavior and keeps compact committed regressions within the explicit zero-growth ceiling: existing numeric/malformed-input test setup is simplified without removing assertions, existing tables gain alias read/replacement rows, and one cyclic-search case is retained. Final diff: production +49/-34; docs +6/-0; tests +15/-15 (net zero). Existing assertion-safety allowances mechanically shrink 9→3 and 2→1; no baseline expansion or test allocation.

Simplification review kept the bounded synchronous document owner rather than adding a factory or context API. Concrete result resolution receives its document explicitly after traversal. No new grammar, SDK, schema, or authority behavior.

Evidence

Independent built CLI proof on Linux Node 24.22.1: main misses scalar/intermediate aliases and wildcard results twice; candidate resolves them twice through real YAML files and its own compiled oc-path plugin. Alias-backed predicates and distinct alias paths are exercised. Dry-run replacement preserves anchor bytes, writes through an alias remain refused, and cyclic find completes with two finite paths. Ordinary direct reads are unchanged; all source files remain byte-identical after dry-run/refused writes.

132 tests pass across YAML-kind, shared find, and resolve suites; formatting passes. The compact alias read, alias-slot replacement, and cyclic-search regressions fail on frozen main for the intended reasons (3 failures, 37 existing cases pass) and all pass on the repaired head. The test file remains 148 lines. No mocked filesystem or direct helper substituted for the shipped CLI proof. Current main's cyclic search is already finite because it ignores aliases; this does not claim an infinite main hang. Existing contributor source/helper proof remains supporting evidence.

Merge Danger

Two-way door: reverting restores alias misses; no configuration, file migration, or schema change. Reads/searches do not mutate YAML, and dry runs do not write. Blast radius is YAML alias traversal and shared recursive-search cycle bookkeeping; an incorrect memo could miss logical paths, covered by distinct-alias and existing non-YAML traversal controls. Alias-slot replacement is a normal explicit file edit; writes through an alias stay refused.

@clawsweeper

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

@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: 🦐 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 31, 2026
@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Follow YAML aliases during path resolution and searches while allowing alias-slot replacement and preserving existing write-through restrictions.

Example: workflow.yaml contains model: &big large and fallback: *big; run openclaw path resolve oc://workflow.yaml/fallback.

  • Before: The command reports that the path was not found.
  • After: The command resolves the value large.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused repair with shipped-entry-point before/after evidence, committed red/green regressions and no remaining actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The shared YAML resolver/finder is exercised through independently built shipped CLI entry points in secretless Linux Docker, showing corrected alias reads, wildcard/predicate results, distinct paths and finite cycles, plus anchor-preserving dry-run replacement and unchanged write-through refusal; verified unchanged production sources make that evidence applicable to this head.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Valid YAML alias-backed values appear missing when users inspect or search workspace files, and alias-slot replacement fails.
Reason: The repair restores ordinary YAML addressing without new options, public APIs or write-through behavior, and collaborator follow-up supports the scoped direction.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current YAML alias bug with convincing CLI evidence and focused regressions; no actionable defects remain, and current-head CI is still running.

Priority: P2
Reviewed head: d63322ce251a775b04ccd0457bb3459d4a79a541

Before merge

None.

Findings

None.

Agent review details

How this fits together

The bundled oc-path plugin parses workspace files and translates oc:// CLI addresses into resolved values, search results, or explicit file edits.

flowchart LR
  A[Path CLI] --> B[YAML parser]
  B --> C[Document AST]
  C --> D[Resolver and finder]
  D --> E[Values and logical paths]
  D --> F[Existing YAML editor]
  F --> G[Rendered file bytes]
Loading

Technical review

Best possible solution:

Land the focused shared-resolver repair after the existing current-head CI gates pass.

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

Current-main source directly explains the reported misses, and the supplied paired built-CLI runs reproduce them on the baseline; no target code was executed during this review.

Is this the best way to solve the issue?

The patch repairs alias handling at the existing resolver/finder owners, retains logical edit addresses and write restrictions, and adds only the cycle bookkeeping needed for alias traversal.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • YAML resolution and editing keeps the original intent (0b708a2: Restore uniform YAML addressing through the existing yaml dependency; later native-key edits preserve resolved logical addresses.)
  • Recursive finder memoization keeps the original intent (5b022ac: Preserve zero-segment matches, distinct reusable paths and bounded repeated-recursive traversal.)
  • Numeric preservation tests and assertion baseline keeps the original intent (1817fab: Preserve untouched numeric source tokens; this PR retains the assertions while compacting setup and shrinking obsolete allowances.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Gio Della-Libera: Raw commit 0b708a2 adds extensions/oc-path/src/oc-path/yaml/resolve.ts:48 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/resolve.ts)
  • Zhiqi Zhang: Raw commit 5b022ac adds extensions/oc-path/src/oc-path/find.ts:237 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5b022ac2404d; files: extensions/oc-path/src/oc-path/find.ts)

PR surface

Source +15, Tests 0, Docs +6, Other 0. Total +21 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 49 34 +15
Tests 1 15 15 0
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 2 0
Total 5 72 51 +21

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #189774
Summary: This PR implements the concrete YAML alias failure reported by the same author in the linked open issue.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The bug affects YAML files using aliases within an optional workspace-file CLI surface, 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 (4 earlier review cycles)
  • reviewed 2026-10-31T21:58:02.627Z sha b1cd4c5 :: needs changes before merge. :: [P2] Stop recursive wildcard traversal at cyclic alias edges | [P2] Prune the assertion allowances reduced by this patch
  • reviewed 2026-10-31T22:22:24.792Z sha bf5995c :: needs maintainer review before merge. :: none
  • reviewed 2026-10-31T23:15:07.088Z sha 5ee9e27 :: needs changes before merge. :: none
  • reviewed 2026-10-31T23:26:44.497Z sha c070af8 :: needs maintainer review before merge. :: none

Reviewed October 31, 2026, 7:34 PM ET / 23:34 UTC (Revision 5).

@jerome-queck

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added 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: 🦐 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 Oct 31, 2026
@obviyus

obviyus commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Independent built CLI proof — real YAML anchors and aliases

Candidate: 5ee9e274e6df321875a17883f85d4de02eeb05c8; production unchanged from contributor bf5995c158617ca872a73953fb1687199530e7a9. Main baseline: 79ef1c6d17e04545a3d39eee300e086c4ae2ab8b. All three contributor commits preserved.

Independently installed and built both source snapshots in secretless Linux node:24.22.1 Docker using the canonical runtime build. Each run used fresh task-owned HOME/state/config/workspace/profile, real YAML files, and the shipped node openclaw.mjs --profile ... path ... entry. Plugin inspection confirms each arm loads its own compiled dist/extensions/oc-path/index.js; no direct resolver/helper replay or mocked filesystem.

                                        main #1/#2       candidate #1/#2
resolve scalar alias fallback           miss / miss     large / large
resolve intermediate map alias          miss / miss     small / small
find wildcard through map alias         0 / 0           1 / 1
predicate includes alias-backed row      1 / 1           2 / 2
separate noncyclic alias logical paths   0 / 0           2 / 2
set alias slot --dry-run                 unresolved      success, anchor retained
write through aliased map               refused         refused
cyclic **/label find                     finite, 1       finite, 2
ordinary direct read                    small / small   small / small

The candidate predicate returns classify and alias-backed rerank, not just the direct field. Distinct copies of the same anchored map remain two different logical find results. Concrete finite reads through repeated self aliases resolve ok on candidate.

For set oc://workflow.yaml/fallback medium --dry-run, both candidate captures produce fallback: medium while retaining model: &big large and with: *defaults in the rendered bytes. The actual file remains byte-identical. Attempts to write steps/0/with.model return ok:false, reason:unresolved on both arms and preserve the original file. SHA-256 of the workflow file is identical in all four runs: 8711ec681b4c290af6caf63d0811cc6eff036cd41da6732069534e69538a84a0.

The cyclic file is root: &root {label: ok, self: *root} in block YAML. Candidate recursive find returns exactly root/label and root.self/label, then stops. Main already stays finite by ignoring the alias; no claim that current main hangs. Every real CLI command has a bounded timeout and retained raw output/timing.

129 existing tests passed across YAML-kind, shared find, and resolve suites, including non-YAML/deep traversal controls. Targeted formatting passed. Added contributor tests were removed to meet the explicit zero-net-new-test ceiling; existing tests and assertions are unchanged. Final production delta +49/-34, docs +6/-0, tests +0/-0; existing assertion allowances shrink 9→3 and 2→1, not expanded.

Simplification review: the shared YAML document context is used only during synchronous traversal and cleared in finally; concrete result resolution receives the document explicitly afterwards. Kept this bounded existing owner rather than introducing a per-walk factory or new context API. Branch-scoped cycle memo preserves independent logical alias paths. No new YAML grammar, merge-key expansion, SDK, schema, or write-through behavior.

@obviyus

obviyus commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Oct 31, 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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 31, 2026
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 31, 2026
@obviyus

obviyus commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Review follow-up: committed regressions, zero test growth

Final head: c070af869d081ac0411d663cf56c4907331bf710.

Addressed the exact-head review's remaining committed-coverage item without a test allocation or violating the zero-growth ceiling:

  • Kept all existing test assertions; simplified the numeric-source setup and malformed-insertion callback.
  • Added an anchor/alias to the existing YAML fixture and compact alias read/replacement rows to the existing tables.
  • Retained a compact cyclic-search regression asserting both root and root.self logical paths.
  • yaml-kind.test.ts is still 148 lines, with whole-PR test delta +15/-15.

Observed in secretless Docker:

Frozen main 79ef1c6d17e04545a3d39eee300e086c4ae2ab8b + same test file:
  alias-slot replacement: unresolved (FAIL)
  alias resolve: null instead of anchored value (FAIL)
  cyclic find: [root] instead of [root, root.self] (FAIL)
  3 failed / 37 passed

Final candidate:
  YAML + shared find + resolve suites: 132 passed across 3 files
  formatting: PASS

This follow-up changes tests only. The production owner sources and built artifacts used by the four shipped CLI runs are unchanged and retain the previously recorded SHA-256 identities. That before/after evidence and its dry-run, refusal, distinct-path, cycle, and ordinary controls remain applicable; no claim that the test-only commit changes runtime behavior. Earlier 129-test totals belong to the prior revision and are superseded by the 132-test result here.

@obviyus

obviyus commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 31, 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-repro Preliminary submission classification; full source review pending. 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 31, 2026
@obviyus

obviyus commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Owned CI lint correction

Head d63322ce251a775b04ccd0457bb3459d4a79a541 fixes the preceding head's check-lint-core-4 failure: the new cyclic regression destructured path, shadowing the existing test helper. This was ours, not inherited. Renamed that local binding to p; assertions, behavior, and the 148-line test budget are unchanged.

Final targeted YAML suite: 40 passed; targeted oxlint and formatting: PASS. The preceding full focused batch remains 132 passed across 3 files, with base 3 intended failures / 37 existing passes. Only the local test binding name changed afterwards. Production and built artifacts remain unchanged, so the four shipped CLI captures and controls and zero-growth red/green coverage receipt still apply. No hosted job was manually rerun.

@obviyus

obviyus commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 31, 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-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 31, 2026
@obviyus
obviyus merged commit 183327d into openclaw:main Oct 31, 2026
113 checks passed
@obviyus

obviyus commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Landed in 183327d. Thanks @jerome-queck. CLI path reads and searches now follow YAML aliases.

github-actions Bot pushed a commit to jonasbkk1188/openclaw that referenced this pull request Oct 31, 2026
…784)

fix(cli): resolve YAML aliases when reading and searching paths

Fixes #189774.

CLI path reads and searches didn't dereference YAML aliases, so a path through an alias (`*name`) returned the alias node instead of the anchored value, and `find` missed matches behind aliases. Reads and searches now follow aliases. Dry-run replacement keeps the anchor, writing through an alias is still refused, cyclic aliases stay finite in search, and distinct alias paths are reported separately.

Evidence: built CLI in secretless Node 24.22.1 Docker on real YAML files. Main missed scalar and intermediate aliases and the search matches behind them (twice); with this change they resolved (twice). The dry-run anchor, write-through refusal, cyclic-search, distinct-path and ordinary-read controls passed. Details: openclaw/openclaw#189784 (comment).

Thanks @jerome-queck.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 1, 2026
…189855)

fix(cli): use the effective last key when a JSON file repeats a key

Fixes #189835.

When a JSON, JSONC or JSONL object repeated a key, CLI path resolve, find and set used the first occurrence. Runtime parsing takes the last one, so set reported success while the value OpenClaw actually used stayed the same. Path tools now select and rewrite the effective last key and keep the shadowed copies. Files without duplicates produce byte-identical output. JSONC comments and formatting, and JSONL BOM, CRLF and literal tokens, are preserved. The human-readable recovery text points to consolidating the duplicates. This works together with YAML alias resolution from #189784.

Evidence: built CLI in secretless Node 24.22.1 Docker on real JSON, JSONC and JSONL files, rebuilt after merging current main. Main selected the first key and reported writes that didn't change the effective value; with this change the effective last key was selected and actually rewritten. A combined YAML and JSON workspace kept aliases, scalar aliases, finite cycle traversal and unchanged YAML bytes across actual JSON writes. Details: #189855 (comment) and #189855 (comment).

Thanks @jerome-queck.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 1, 2026
…claw#189784)

fix(cli): resolve YAML aliases when reading and searching paths

Fixes openclaw#189774.

CLI path reads and searches didn't dereference YAML aliases, so a path through an alias (`*name`) returned the alias node instead of the anchored value, and `find` missed matches behind aliases. Reads and searches now follow aliases. Dry-run replacement keeps the anchor, writing through an alias is still refused, cyclic aliases stay finite in search, and distinct alias paths are reported separately.

Evidence: built CLI in secretless Node 24.22.1 Docker on real YAML files. Main missed scalar and intermediate aliases and the search matches behind them (twice); with this change they resolved (twice). The dry-run anchor, write-through refusal, cyclic-search, distinct-path and ordinary-read controls passed. Details: openclaw#189784 (comment).

Thanks @jerome-queck.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 1, 2026
…penclaw#189855)

fix(cli): use the effective last key when a JSON file repeats a key

Fixes openclaw#189835.

When a JSON, JSONC or JSONL object repeated a key, CLI path resolve, find and set used the first occurrence. Runtime parsing takes the last one, so set reported success while the value OpenClaw actually used stayed the same. Path tools now select and rewrite the effective last key and keep the shadowed copies. Files without duplicates produce byte-identical output. JSONC comments and formatting, and JSONL BOM, CRLF and literal tokens, are preserved. The human-readable recovery text points to consolidating the duplicates. This works together with YAML alias resolution from openclaw#189784.

Evidence: built CLI in secretless Node 24.22.1 Docker on real JSON, JSONC and JSONL files, rebuilt after merging current main. Main selected the first key and reported writes that didn't change the effective value; with this change the effective last key was selected and actually rewritten. A combined YAML and JSON workspace kept aliases, scalar aliases, finite cycle traversal and unchanged YAML bytes across actual JSON writes. Details: openclaw#189855 (comment) and openclaw#189855 (comment).

Thanks @jerome-queck.

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: 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.

[Bug]: oc-path YAML resolve/find/set report "not found" for values reached through aliases (*anchor)

2 participants