Skip to content

refactor: consolidate measured runtime clone owners - #180552

Merged
steipete merged 2 commits into
mainfrom
deslop/z33-80-runtime-clone-owners-20261015
Oct 22, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/z33-80-runtime-clone-owners-20261015

Conversation

@steipete

@steipete steipete commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Runtime and bundled plugins repeat bounded body readers, JSON parsing, error aggregation, finding reporting, cache TTL preparation, and account diagnostics despite existing owners.

User Impact

No intended user-visible change. Byte limits, validation order, error messages and identities, cancellation, authority, cache scope, and shutdown settlement remain protected.

Why This Change Was Made

Use existing normalization, byte-stream, HTTP-body, error and weak-owner-map operations. Put repeated media parameter preparation and Doctor finding reporting in their existing owners. Consolidate plugin-local diagnostic construction and install-source planning without crossing plugin-private boundaries.

This is the runtime/plugin area slice of a measured 409-net-line cleanup spanning 95 files. The campaign's wide-change rule requires splitting by area; this slice removes 261 net production lines across 39 production files (55 files including tests and a shrink-only assertion baseline repair; 320 net test lines added). The UI slice is #180536. No new SDK export, config key, schema, protocol, dependency, locale, or Phase E memory-backend change.

Best-effort tradeoffs accepted

  • Gravatar overflow cancellation: no longer wait for an arbitrary custom stream's cancellation promise before returning 502 and releasing its reader. The wait gate came from #157976, with synthetic lifecycle evidence rather than an identified human incident. Native cancellation and connection closure remain covered; a non-native cancellation promise may settle later or remain pending, without holding the HTTP response.
  • TypeSafe response cancellation: remove its duplicate reader's extra join of arbitrary body-stream cancellation promises. That join originated with synthetic captured-stream regressions in #152298, not an identified human incident; linked #152234 is a capability-design request. The real transport still aborts its per-request controller and awaits guarded release. A custom stream's delayed cancellation may finish best effort afterward; byte limits, deadlines, effect authority and host callback settlement remain. Existing capture cancellation/release tests pass unchanged.
  • Google Meet CLI default capture: remove the redundant meeting override passed into the existing resolver. No supported caller mutates the prepared defaults during OAuth; such a mutation can now select the newer canonical default instead of the earlier copy. The command's early missing-input validation remains before OAuth. Provenance inspected: #117949 and #178646; no human incident requiring mid-command default snapshots was identified.

Other changes share existing behavior rather than removing guards. Marketplace keeps lazy reader acquisition, bounded staging and awaited outer cleanup. Native hook relay passes the request's native async iterator to preserve overflow socket closure. Error helpers retain zero/single/aggregate shapes and original failure order; security, durability and write settlement are unchanged.

Evidence

The first exact-head CI run 39769638063 correctly rejected four stale assertion-safety allowances in changed paths. The repair only shrinks those entries (xAI web search 2 to 0, capability web 5 to 3, log parsing 1 to 0, Claude invocation 1 to 0). The native assertion ratchet now passes: 2,469 files / 5,649 grandfathered assertions. Fresh independent review of this repair is scoped-clean P0–P2. The suppression audit was repeated and retains the same three unchanged-path inventory failures below. No production code, test, suppression or allowance was broadened to repair CI; the new exact head receives fresh hosted proof.

Fresh-main area formatting, targeted native core/plugin typechecks and both typed-lint passes passed. All 15 changed test files passed (170 seconds serially), as did selected websocket upgrade-error/body-cap, actual Claude CLI output truncation, and PR wrapper/import-closure tests. Runtime and static import cycles are both zero. Independent full-area review found no actionable P0–P2 issue. No new lint suppression.

The local suppression-inventory audit still fails with three unexpected entries in unchanged paths: src/cron/store/job-mutations.ts|unicorn/prefer-structured-clone|1, src/transcripts/library.query-budget.test-support.ts|typescript/unbound-method|1, and ui/src/pages/sessions/view.tsx|typescript/only-throw-error|1. A serial replay on exact clean base 4d270d3bfd708be964b39558cb02b038380cc4f0 reproduced the exact Expected/Received block (head 4.7 seconds, base 6.5 seconds). No baseline or test is weakened. This local failure is not a hosted-CI waiver.

Earlier packet proofs cover affected sibling owners, including TypeSafe native cancellation/release, media limits, cache TTL, install-source selection, Doctor finding order, readonly-worker cleanup and session settlement. Current production bytes match those packet receipts except gateway-client's preserved newer main timer cleanup; its upgrade-error boundary is re-proved separately. No broad local suite/build/live-provider or E2E claim. Exact-head PR CI is the broad gate.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 22, 2026
@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 11:18
@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-22T11:22:35.928075Z 72cce5b Draft marked ready
ℹ️ 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.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 744da4960d88f46ebbd2164528a5794d32d93728
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/security/audit-channel.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.

Carefully review these changes before merging.

@steipete
steipete enabled auto-merge (squash) October 22, 2026 11:40
@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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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
@clawsweeper clawsweeper Bot added 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 duplicated parsing, bounded stream reading, error aggregation, and diagnostic construction with existing shared operations.

Example: Gravatar returns a chunked avatar larger than 1,000,000 bytes.

  • Before: The request waits for the stream's cancellation promise before returning HTTP 502.
  • After: The request returns HTTP 502 and releases the reader while custom-stream cancellation finishes best effort.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is coherent and no introduced defect was identified; confidence is supported by source and reported harness validation rather than inspected shipped-entry-point proof.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; supplied evidence reports focused tests and native transport scenarios, without claiming a shipped-entry-point E2E run, and the diff does not materially change authority.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
Reason: The maintainer-authored direction reduces duplicate implementations while retaining existing owners and explicitly explaining the limited behavior tradeoffs.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored refactor consolidates existing runtime owners, and no actionable introduced defect was found.

Priority: P3
Reviewed head: 744da4960d88f46ebbd2164528a5794d32d93728

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway handlers, agent tools, CLI commands, and bundled plugins consume external bytes and runtime results, then produce bounded payloads, diagnostics, or settled lifecycle outcomes.

flowchart TD
  A[CLI and Gateway requests] --> B[Runtime and plugin owners]
  B --> C[Shared parsing and validation]
  B --> D[Bounded stream readers]
  B --> E[Lifecycle error aggregation]
  C --> F[Results and diagnostics]
  D --> F
  E --> F
Loading

Technical review

Best possible solution:

Retain the existing-owner consolidation and the explicitly accepted cancellation tradeoffs, subject to the normal exact-head CI gate.

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

This is a refactor rather than a reported bug; source inspection verified the affected contracts, and no target code or tests were executed during this read-only review.

Is this the best way to solve the issue?

Reusing the existing readers, normalization helpers, and error owners is appropriate; the diff removes replaced paths without introducing competing state or public APIs.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Verified PR introduction: Reviewed the pinned merge-base-to-head edits rather than attributing base-branch movement to this PR. (744da4960d88)
  • Accepted cancellation tradeoffs: The maintainer-authored body explicitly accepts best-effort custom-stream cancellation for Gravatar and TypeSafe, and the Google Meet default-resolution tradeoff; these are explained departures from earlier behavior. (744da4960d88)
  • Sensitive boundaries retained: Native relay authentication, registration checks after body consumption, target matching, and generation enforcement remain; account-audit consolidation retains flag precedence, synchronous enabled evaluation, awaited configured evaluation, and ordered diagnostics. (src/agents/harness/native-hook-relay-bridge.ts:314, 744da4960d88)
  • Equivalent existing owners: Search TTL and query validation delegate to the same underlying operations; error helpers preserve sole-error identity versus aggregate envelopes, failure order, and existing messages. (src/infra/error-graph-internal.ts:25, 744da4960d88)
  • Current-main context: Current main retains the original implementations in the central TypeSafe, Gravatar, security-audit, and marketplace paths, so the consolidation remains distinct work. (eee5efec4249)
  • Pinned dependency contract: Marketplace now passes Response.body directly to @openclaw/fs-safe 0.26.8, making its stream contract applicable; inspected its repository policy and pinned rootWriteInput implementation, which acquires the iterator lazily and awaits iterator return on incomplete consumption. (src/root-create-input.ts:81, 5c9d7c1b5fbb)

Likely related people:

  • Peter Steinberger: Raw commit 5cf0199 adds src/flows/doctor-health-contribution.ts:128 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5cf01995d4d6; files: src/flows/doctor-health-contribution.ts)
  • Dallin Romney: Raw commit 5e6d56a adds src/flows/doctor-health-contribution.ts:122 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5e6d56ae46f4; files: src/flows/doctor-health-contribution.ts)

PR surface

Source -261, Tests +320, Other -3. Total +56 across 55 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 39 253 514 -261
Tests 15 354 34 +320
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 4 -3
Total 55 608 552 +56

Review metrics

Metric Value Why it matters
Production versus tests Production +253/-514; tests +354/-34 The production reduction comes from removing duplicate implementations; added tests cover distinct parsing, validation, overflow, cancellation, and cache contracts.

Labels

Label changes:

  • add P3: This is maintenance cleanup with no reported current user-facing defect or intended feature change.
  • 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 maintenance cleanup with no reported current user-facing defect or intended feature change.
  • 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.

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 22, 2026, 7:53 AM ET / 11:53 UTC.

@steipete
steipete merged commit 7dadabb into main Oct 22, 2026
184 of 185 checks passed
@steipete
steipete deleted the deslop/z33-80-runtime-clone-owners-20261015 branch October 22, 2026 11:59
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
* refactor: consolidate measured runtime clone owners

* chore: shrink assertion allowances after clone cuts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: a2a channel: discord Channel integration: discord channel: reef Channel integration: reef channel: twitch Channel integration: twitch ci:full Keep ordinary native-locale CI selection on the next PR run. cli CLI command changes extensions: browser extensions: duckduckgo extensions: firecrawl extensions: tavily extensions: xai gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: google-meet plugin: typesafe rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

1 participant