Skip to content

refactor: share runtime parsing and routing owners - #180175

Merged
steipete merged 2 commits into
mainfrom
deslop/z33-72-runtime-readers-20261015
Oct 22, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/z33-72-runtime-readers-20261015

Conversation

@steipete

@steipete steipete commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Measured clone families repeat field readers, CLI option parsing, heartbeat targets, filesystem fallback, string filtering, bounded scanning, and FIFO bookkeeping across core and package consumers.

User Impact

No user-visible change is intended. Alias precedence, false/zero handling, parsing offsets, path containment, session routing, cache bounds, and public signatures remain intact. No migration or operator action is required.

Why This Change Was Made

Use the existing responsibility owners instead of repeating their algorithms. A shared heartbeat-target leaf serves the two core consumers; the standalone root CLI scanner stays import-free. Plugins do not acquire core-private imports, and no public Plugin SDK export is added.

This is the runtime/readers area of the originally proposed 505-net-runtime-production-line cleanup split by ownership area for CI attribution. This slice changes 63 source paths plus their shrink-only assertion baseline and removes 248 net runtime production lines, or 241 after charging seven handwritten declaration lines. The other areas touch disjoint files. Settlement #180148 was withdrawn without merging; its LOC is not credited. The adapter area is #180221.

Best-effort tradeoffs accepted

No new unlikely-event tradeoff: the private catalog reader drops a repeated internal auth preparation already performed by its owning outer operation. Security-effect authorization, external-input validation, cleanup/settlement, lexical escape checks, fallback ordering, and realistic concurrency behavior remain in place.

The whole-path asynchronous realpath fallback and synchronous existing-ancestor projection remain separate contracts. FIFO duplicates do not promote entries; the existing 64/200 limits remain. No config, schema, transaction, retention, permissions, protocol, dependency, or public SDK contract changes. The standalone session-memory backend is untouched.

Evidence

All 63 originally applied postimages matched the signed accumulated cleanup. Reused per-family focused evidence covers carriers, heartbeat routing, paths, CLI/usage, bounded scanner/FIFO, string consumers, records/catalog, ordered field readers, and discovery/logger/TTS consumers. These are historical focused results, not a fresh nine-family replay or a full transitive-graph certification.

Proof reuse explicitly excludes five captured-input differences: unrelated additive dependency-lock metadata; an unselected wrapper-inventory entry; the current stronger approval test; an unselected installer factoring; and the current stronger service-command timing test. No unselected change is copied into this PR. The current approval selection and complete timing suite have been rerun successfully. The wizard regression independently exercises the retained spread prompter adapter; no real-installation proof is claimed.

Current composed targeted native types, typed lint, formatting, wrapper closure, all 14 suppression cases, and planner dry-run passed. Runtime and static cycle checks each report zero cycles. Fresh isolated review completed three full context passes with no actionable P0–P2 findings. Local commands are low-priority, serial, one-worker, and isolated from operator state. Hosted exact-head CI is the broad gate; no broad local suite, build, E2E, live Gateway/provider, or device proof is claimed. No timeout, retry, skip, suppression, or retained assertion is weakened.

Initial exact-head CI correctly required shrinking four stale assertion allowances after this cut removed those assertions. The repair lowers three counts and removes the zero-count row, without changing production source or expanding any allowance. The exact-base native assertion ratchet and all 14 suppression cases pass; independent review of that mechanical repair found no actionable P0–P2 issue. The initial UI shard also has the “Reorder Beta” focus timeout independently observed on scheduled main run 39707038848. Current-head hosted CI remains the broad gate, not a claimed passing replay of the earlier red.

GitHub subsequently reported CONFLICTING, so the branch was rebased onto main c5a6a30. Both rewritten commits are signed. Every production postimage remains byte-identical to the independently reviewed 9e477 head. Main's wizard/path test consolidations are retained; the distinct spread-prompter regression remains instead of resurrecting the removed plain progress-order test. Original independent reviews are reused for the unchanged production patch, with the conflict composition inspected directly.

Fresh conflict-graph proof passed on f72e238: 27 path cases and 35 wizard cases, production/test native types, typed lint, formatting, wrapper closure, both cycle checks (zero), all 14 suppression cases and planner. Ten receipts/150 captures/15 unique inputs match the final signed head. The native checkout's missing compiler install and its pinned-pnpm download timeout were setup failures; proof ran instead in the lane's existing qualified installation on that exact head. No alternate compiler or shared-install reconciliation was used. Prior-head CI remains prior-head evidence; the new exact-head CI is the gate.

Exact-head CI39714358517 attempt1 has completed with inherited failures; it is not green. The scoped maintainer campaign authorizes the native pre-existing-failure exception. Actual fetched CI merge15c14dc has main parentcce29b2 and headf72e238. Two leaves fail on main's newly introduced physical registry self-handoff; independent main repair52df852cd5be3b3691ef27d0942a4db7b2258eb1 is now ancestry-verified.

Check Failure and attribution
119613285813 compact-small-17 Registration-facts allowlist=true: custody self-transfer error. Raw owner/test source unchanged. Actual merge reproduces it; separate unchanged-main resource regression reproduces exact self-transfer error. Baseline registration case timed out instead, not counted as identical-signature evidence. Main repair makes all seven selected catalog cases pass.
119613285711 compact-small-49 Five pool cases with same custody error, reproduced serially on actual merge and actual main parent under identical pinned Bun.
119619112319 ci-gate Downstream of those two Node leaves; independent security-fast119613284297 passed.
119612816932 provider scaffold (separate run39714358522) External ClawHub npm-metadata HTTP503, independently matching unrelated run39714349231/job119612785644. Generated plugin build/test passed; no PR change to scaffold/validation inputs.
119612810683 context cancellation Superseded by successful same-head119612983732/run39714407628. No missing runtime suite.

All170 exact-head checks enumerated. No CI rerun, repush for green, timeout increase, retry, skip, auth-guard removal or whole-family rollback. Coordinator flakes and latest six completed scheduled-main runs inspected; no invented matching custody/scaffold scheduled signature. Local replays are macOS/Node26 wrapper with pinned Bun versus hosted Linux/Node24; that platform gap is explicit. The five exact baseline errors, unchanged raw owner and independently proven/fixed main defect support the attribution; the sixth baseline timeout alone does not.

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

@steipete
steipete marked this pull request as ready for review October 22, 2026 02:15
@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 ✅ Completed 2026-10-22T03:06:53.924263Z f72e238 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes commands Command implementations agents Agent runtime and tooling size: XL labels Oct 22, 2026
@steipete
steipete force-pushed the deslop/z33-72-runtime-readers-20261015 branch from 9e477aa to f72e238 Compare October 22, 2026 02:59
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR replaces repeated parsing, routing, filesystem, and FIFO implementations with shared internal owners while preserving existing behavior.

Example: The ops agent uses mainKey "work" and receives a forced heartbeat target of "agent:ops:subagent:child".

  • Before: The duplicated resolver selects "agent:ops:work" and suppresses originating context.
  • After: The shared resolver selects the same session and preserves context suppression.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful consolidation with no identified introduced defect; confidence is limited by internal-only execution evidence and unattributed exact-head CI failures.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor-proof gate; its focused test evidence covers internal contracts, while the inspected linked screenshots belong to the separate adapter PR.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Repeated internal algorithms can drift in alias precedence, session ownership, path fallback, and bounded deduplication behavior.
Reason: The maintainer-approved direction removes duplicated production code without adding settings, storage, public SDK contracts, or intended user-visible changes.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open: the consolidation is useful, and no actionable introduced bug was found; exact-head CI remains unresolved.

Priority: P3
Reviewed head: f72e238b191143d55c2ccc5a7b72a926f7c8c5d8

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not exercise these changed owners through a shipped CLI or Gateway flow or a stable-release upgrade.
Agent review details

How this fits together

These internal helpers sit between CLI arguments, provider payloads, filesystem paths, and session configuration and their runtime consumers, producing parsed values, canonical paths, routing selections, and bounded deduplication state.

flowchart TD
  A[CLI arguments and runtime payloads] --> B[Shared parsing owners]
  C[Session configuration] --> D[Heartbeat target owner]
  E[Filesystem paths] --> F[Shared path owners]
  B --> G[Core and package consumers]
  D --> G
  F --> G
Loading

Technical review

Best possible solution:

Retain the shared internal owners and preserved consumer contracts, with exact-head CI failures attributed before clearance.

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

This PR reports duplicated implementations rather than a broken user flow; source comparison confirms those duplicated algorithms and their shared replacements.

Is this the best way to solve the issue?

The consolidation fits the existing owners, removes replaced implementations, and keeps meaningful differences such as Doctor global-store routing and asynchronous versus ancestor-based realpath fallback.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Heartbeat targeting and Doctor migration keeps the original intent (ec5d369: feat(automations): migrate heartbeat jobs through Doctor #179387 preserved legacy heartbeat ownership and state while migrating execution to Automations; the shared helper retains those selections and Doctor's physical-store exception.)
  • Filesystem probing and path identity keeps the original intent (unknown: History and refactor: share core filesystem discovery policies #174634 establish deliberately different filesystem error and containment contracts; their exact earlier introductions were not established, and the PR retains those distinctions.)
  • CLI option parsing keeps the original intent (unknown: History includes earlier command-dispatch consolidation; base and head preserve required-value consumption, terminators, inline values, and destructive-flag handling, but the original scanner introduction was not established.)
  • Catalog auth preparation keeps the original intent (unknown: Feature history establishes lifecycle-owned catalog and credential preparation; older blame contents were unavailable, but the sole outer caller retains the same awaited preparation removed from the private helper.)
  • Ordered field readers, record coercion, and usage snapshots keeps the original intent (unknown: Path history was searched without establishing every original introduction; direct comparison with the existing normalization owners preserves accepted types, whitespace, alias order, defined falsy values, and fresh nested usage objects.)
  • Tool-call scanning and bounded FIFO membership keeps the original intent (unknown: History contains previous scanner and lifecycle consolidations; the original introductions remain unestablished, while source comparison preserves the 120-character limit, invalid offsets, duplicate ordering, and 64/200 entry bounds.)
  • Wizard note composition keeps the original intent (unknown: Earlier wizard refactors explicitly preserved copy and step order; this extraction keeps own enumerable closure-bound methods and avoids dispatch through an overridden spread adapter.)
  • Command-carrier detection keeps the original intent (unknown: Command-analysis history was searched without establishing the original precheck introduction; the unchanged resolver already owns the identical executable dispatch set.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Introduced patch: Reviewed the pinned merge-base-to-head hunks rather than attributing base movement to this PR; the assertion baseline only shrinks. (f72e238b1911)
  • Heartbeat migration contract preserved: The shared target resolver retains forced-target precedence, cross-agent rejection, subagent suppression, and main aliases; Doctor retains its separate physical-owner handling for shared global stores, introduced by feat(automations): migrate heartbeat jobs through Doctor #179387. (src/commands/doctor-heartbeat-session.ts:22, ec5d369a6f66)
  • Auth preparation remains with the outer owner: The removed private preparation repeats the check and awaited preparation already performed by the sole calling policy wrapper before resolving the catalog owner; no final-effect authorization check is removed. (src/agents/prepared-model-catalog.ts:369, f72e238b1911)
  • Carrier checks remain authoritative: The resolver switch accepts exactly the executable families previously checked by callers, including exec, and returns null for other executables. (src/infra/command-carriers.ts:310, f72e238b1911)
  • Exact-head CI failures remain unattributed: Two failing Node shards report "Plugin registration custody cannot transfer: worker-catalog-fixture" in catalog-worker integration tests. Scaffold validation also failed, but its annotation contains only an exit code. These failures were not established as diff-caused or independently reproduced on the base. (src/agents/prepared-model-catalog-worker.ts:555, f72e238b1911)
  • Inspection limits: Historical blame could not read an unavailable old blob; commit/tree history and REST commit patches remained readable. The scaffold job-log request redirected to a blocked artifact host, preventing deeper attribution from that log. (src/agents/prepared-model-catalog.ts, 461123273058)

PR surface

Source -248, Tests +228, Other +6. Total -14 across 64 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 45 263 511 -248
Tests 16 268 40 +228
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 11 5 +6
Total 64 542 556 -14

Review metrics

Metric Value Why it matters
Production versus test LOC Production +271/-512; tests +268/-40 Including handwritten declarations and excluding the assertion baseline, production shrinks by 241 lines; test growth protects parsing, ownership, fallback, ordering, and adapter contracts.

Labels

Label changes:

  • add P3: This is behavior-preserving internal cleanup with no established urgent user-facing defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is behavior-preserving internal cleanup with no established urgent user-facing defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attribute the catalog-worker custody failures and scaffold validation failure against the tested base.

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.

Reviewed October 21, 2026, 11:20 PM ET / October 22, 2026, 03:20 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head inherited failure evidence for #180175

Standing Peter campaign instruction authorizes landing after every failure is attributed. Head f72e238, completed pull_request CI run39714358517 attempt1. Actual fetched checkout15c14dcff37b85e44e18f0bb6bd1099a021375f2 has ordered parents cce29b2 and f72e; treef675da22fd1ade545cd66af2cb62d02804858f15. All170 check runs were enumerated; no pending or missing runtime suite. Independent security-fast119613284297 passed. No failed CI is claimed green.

Check Observed failure Attribution
119613285813 checks-node-changed-compact-small-17 registration-facts explicit allowlist=true; Plugin registration custody cannot transfer: worker-catalog-fixture New main registry self-adoption defect introduced3e42abb61808dd3e80efe9273c301fd1cc48a88a/#162226. Test and raw failing registry/worker owners unchanged in actual merge. Exact merge reproduces error. Baseline registration case timed out at initial catalog wait, NOT an identical error reproduction; this limitation is retained. Separate unchanged-main resource regression reproduces exact self-transfer error. The reviewed owning fix now on main52df852cd5be3b3691ef27d0942a4db7b2258eb1 makes all seven catalog selections pass.
119613285711 checks-node-changed-compact-small-49 five pool cases: queued-auth closure, source A-B-A, credential A-B-A, warm shutdown, warm plugin retirement; same custody error All five reproduce serially on both actual merge and actual main parent under the same checksum-verified pinned Bun. Same raw failing owner, no PR change to resource map transfer or worker handoff.
119619112319 openclaw/ci-gate downstream Node shard failure Exactly the two leaves above; all other planned jobs completed successfully or were unselected.
119612816932 Validate provider scaffold, separate run39714358522 ClawHub npm metadata HTTP503 Generated plugin built and its test passed; external package validation failed. Same HTTP503 independently observed on unrelated head5a5f44ee34c49229f9ce45d777d91f3e2be1c432/run39714349231/job119612785644. Both logs previously read once. PR changes no scaffold or ClawHub validation inputs. Not a product-suite waiver.
119612810683 PR context and evidence superseded bookkeeping cancellation Successful same-head successor119612983732/run39714407628; no cancelled runtime suite.

Merge replay141568ms and actual-parent baseline131416ms each run the same seven selected cases plus eight existing selector exclusions. Both pass allowlist=false. CI Linux/Node24 versus local macOS/Node26-wrapper difference is explicit; both local sides use identical environment and pinned Bun. Five exact errors on base, six on merge; the sixth baseline timeout is not evidence by itself. The stronger causal proof is the actual physical-owner regression: unchanged production throws transferRegistrationTo160/adopt99; the four-line no-op after live-owner validation fixes that regression plus every selected catalog case. Distinct-owner collision/transfer and authority/disposal guards unchanged.

Actual main-parent→merge only catalog-reader change removes private duplicate auth preparation already performed by its outer owner. It does not change the self-transfer owner; fixture warm auth and outer boundary preparation remain. No speculative auth restoration, whole-family rollback or security-guard deletion selected. The current-main bug fix is separate from this cleanup and receives no deletion credit.

Coordinator main-flakes checked; no matching custody/scaffold entry. Last six completed scheduled ci.yml runs refreshed:39712703143,39707038848,39703131373,39693906280,39687169253,39679539559. Earlier six inventories were read; newest39712703143 has its own Windows/macOS/dependency/core failures and is not asserted matching. Source equality, serial five-case baseline reproduction and independently proven main-owner defect establish this attribution, not a job-name match. No CI reruns or branch update just for green.

Original scoped proof stays valid: exact conflict packet has production/test native types, typed lint,27 path+35 wizard cases, wrapper closure,zero runtime/static cycles,14 suppression cases and planner passing;150 captures/15 unique inputs match signed head. Earlier composed proof and independent full-context reviews retained in native review.json. Phase E untouched; no SDK/config/schema/protocol/dependency contract change.

@steipete
steipete merged commit 5f69b18 into main Oct 22, 2026
176 of 182 checks passed
@steipete
steipete deleted the deslop/z33-72-runtime-readers-20261015 branch October 22, 2026 03:37
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 22, 2026
* refactor: share runtime parsing and routing owners

* chore: shrink assertion allowances after reader consolidation
amittell added a commit to amittell/openclaw that referenced this pull request Oct 22, 2026
Merges upstream main at 3cd9bdd. No textual conflicts.

- src/media/media-reference.ts: main moved relativePathEscapesBase to infra/path-guards as relativePathEscapesRoot and dropped this file's node:fs/promises import (openclaw#180175). The grounding helpers this branch added still call both, so they now use relativePathEscapesRoot and the import is restored.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

1 participant