Skip to content

fix(process): keep native cleanup pending after resource failure - #177526

Merged
steipete merged 1 commit into
mainfrom
fix/fix10-broker-resource-initialization
Oct 19, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/fix10-broker-resource-initialization

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

A native resource import can fail and close over the worker socket before the parent IPC channel has delivered the same failure. If the parent has started awaiting cleanup in the meantime, resource-failed rejects that pending close with the original import error, even though the broker can still confirm native closure. This intermittently fails resource-transport.test.ts in hourly 39286736487 and can misreport cleanup to real snapshot/resource callers.

Keep failure reporting and native cleanup settlement independent in the existing BrokerResourceClaims owner. A resource failure still reaches the original error callback; only the native close receipt, explicit close error, or broker transport failure settles cleanup. No protocol, configuration, schema, dependency, or timeout changes.

This is a latent ordering bug in the branch introduced by #160946 (9c93bc347cec). #173154's documented contract says “Execution completion and physical resource closure are now settled independently.” The regression models the lagging parent IPC sequence through the real claims API and requires the original error, retained custody, and successful close/release.

Evidence

  • New deterministic owner regression fails on unchanged production: cleanup settles with original resource import failure before its native close receipt. Seven existing owner cases pass. Fixed regression passes.
  • Focused owner, real resource transport, and broker-retirement files: 30/30 passed under Bun (44.84 s wrapper) and 30/30 passed under Node (17.13 s wrapper), each with --maxWorkers=1. These are the same 30 cases on two runtimes. The owner regression itself takes under 1 ms; its eight-case owner file took 869 ms on the red baseline. CI seconds are not yet available.
  • Targeted process test typecheck (including the production owner), typed lint, boundary lint, formatting, and git diff --check pass.
  • Independent P2 autoreview: scoped-clean, no actionable P0–P2 findings. Manual review also traced both error transports and the native resource caller.
  • The original transport case passed standalone under both runtimes before the fix; those passes are not claimed as reproduction. Its Linux/Bun hourly log was fetched once. The deterministic test establishes the race without retries or sleeps.
  • A local original-order prefix replay was stopped after the owning race was identified. A Linux Testbox attempt was stopped during local source-capsule preparation before any allocation; no remote proof or lease is claimed. PR CI supplies broad/platform proof.

Production delta: one comment updated and two incorrect cleanup-settlement lines removed. Test delta: one 36-line case using the existing fixture. The unrelated process-census mock-export red is already fixed on main by cc942bc04e1c; this PR does not duplicate it.

A resource failure may arrive over parent IPC after the worker socket has
already observed it and finished native cleanup. Do not reject the parent's
pending close with that delayed failure; keep reporting the original error
and wait for the independent close receipt or actual cleanup failure.

Add a deterministic delayed-failure regression with retained custody and
close/release assertions. This preserves the separate execution and native
settlement contract from #160946 and #173154.

Validation: regression red on the old owner; 30 focused cases pass under
Node and Bun with one worker. Targeted types, lint, format and P2 review pass.
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review ended

ClawSweeper stopped reviewing this revision because the pull request closed.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 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-19T17:18:57.075921Z 07bcb3f 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 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 19, 2026
@steipete
steipete merged commit dfff19c into main Oct 19, 2026
117 of 121 checks passed
@steipete
steipete deleted the fix/fix10-broker-resource-initialization branch October 19, 2026 17:27
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
…nclaw#177526)

A resource failure may arrive over parent IPC after the worker socket has
already observed it and finished native cleanup. Do not reject the parent's
pending close with that delayed failure; keep reporting the original error
and wait for the independent close receipt or actual cleanup failure.

Add a deterministic delayed-failure regression with retained custody and
close/release assertions. This preserves the separate execution and native
settlement contract from openclaw#160946 and openclaw#173154.

Validation: regression red on the old owner; 30 focused cases pass under
Node and Bun with one worker. Targeted types, lint, format and P2 review pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant