Repository navigation
fix(oc-path): follow YAML aliases in path resolve, find and set - #189784
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesFollow YAML aliases during path resolution and searches while allowing alias-slot replacement and preserving existing write-through restrictions. Example: workflow.yaml contains
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +15, Tests 0, Docs +6, Other 0. Total +21 across 5 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 31, 2026, 7:34 PM ET / 23:34 UTC (Revision 5). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Independent built CLI proof — real YAML anchors and aliasesCandidate: Independently installed and built both source snapshots in secretless Linux The candidate predicate returns For The cyclic file is 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 |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Review follow-up: committed regressions, zero test growthFinal head: Addressed the exact-head review's remaining committed-coverage item without a test allocation or violating the zero-growth ceiling:
Observed in secretless Docker: 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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Owned CI lint correctionHead 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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 183327d. Thanks @jerome-queck. CLI path reads and searches now follow YAML aliases. |
…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]>
…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]>
…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]>
…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]>
Fixes #189774
What Problem This Solves
openclaw path resolve,path find, and alias-slotpath settreat 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 bytry/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.