Repository navigation
refactor(state): join shared reads through async ownership - #175443
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a87d6e654
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs maintainer review before merge. What this changesThis PR replaces shared-read continuation bookkeeping and source-wide pumping with asynchronous query and cleanup ownership. Example: A caller cancels a shared-state read while its transport is closing.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-directed simplification resolves both earlier findings, and no additional actionable defect was found; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherShared-state callers submit typed reads to worker transports; the read owner retains native handles and snapshot files until query and cleanup settlement, then returns data or the original failure. flowchart TD
Caller[Shared state caller] --> Owner[Async read owner]
Owner --> Snapshot[Retained snapshot or native handle]
Owner --> Transport[Read transport]
Transport --> Worker[Database worker]
Worker --> Cleanup[Transport and snapshot cleanup]
Snapshot --> Cleanup
Cleanup --> Result[Read result or error]
Technical reviewBest possible solution: Retain the simpler asynchronous owner with native cleanup retry and snapshot custody, then land through the existing exact-head CI gate. Do we have a high-confidence way to reproduce the issue? This is a refactor; source inspection verifies the earlier error-ordering defect is repaired, and the maintainer reports its regression failed before the repair and passed afterward. Is this the best way to solve the issue? The change gives one asynchronous operation responsibility for query and cleanup settlement while preserving transport admission, original snapshots, and failed-close retry. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 437db07c97f3. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -308, Tests -102, Other -1. Total -411 across 14 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel 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 (2 earlier review cycles)
Reviewed October 17, 2026, 8:56 AM ET / 12:56 UTC (Revision 3). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Current head: 1844c28. The accepted read-error masking finding is fixed and the PR body/proof/counts are current. Ten lifecycle cases and fourteen suppression cases pass, including the before-failing error-ordering regression and its successful-read authority control. Targeted types, type-aware lint, formatting, whitespace, and independent repair review pass. Hosted CI on this new head remains pending; no prior-head CI waiver is claimed. |
|
🦞👀 Re-review progress:
|
|
Exact-head landing evidence for
This uses the ordinary native landing workflow. No inherited-failure, prior-head CI, or infrastructure exception is requested. |
|
Merged via squash.
|
Restore the captured physical-file check at the shared reader dispatch boundary, after database admission waits. #175443 removed repeated outer checks, but its remaining recorded-authority check does not detect a pathname replacement. Keep native worker validation and release admission on refusal; prepared snapshots retain their existing semantics. Tighten the existing pairing regression to require the identity error. Baseline on 8cfa2ec: replacement case timed out at 120.018 s; after: 0.006 s. Lifecycle file 152.78 s -> 33.22 s including transform. 64 focused cases passed; state-logging/other type graphs, targeted lint, formatting, and independent P2 autoreview passed. No CI rerun or dispatch.
…175443) * refactor(state): join shared reads through async ownership * test(state): retire obsolete read-worker mock baseline * fix(state): preserve read failures before observation
…law#175628) Restore the captured physical-file check at the shared reader dispatch boundary, after database admission waits. openclaw#175443 removed repeated outer checks, but its remaining recorded-authority check does not detect a pathname replacement. Keep native worker validation and release admission on refusal; prepared snapshots retain their existing semantics. Tighten the existing pairing regression to require the identity error. Baseline on 1979379: replacement case timed out at 120.018 s; after: 0.006 s. Lifecycle file 152.78 s -> 33.22 s including transform. 64 focused cases passed; state-logging/other type graphs, targeted lint, formatting, and independent P2 autoreview passed. No CI rerun or dispatch.
consume() only checked the caller signal after a read settled, so an admission revoked while the read was in flight still returned a successful reply. Re-assert the operation authority before returning the value, skipping only operations that close() is already draining, which keeps the accepted-reader settlement contract from openclaw#175443.
consume() only checked the caller signal after a read settled, so an admission revoked while the read was in flight still returned a successful reply. Re-assert the operation authority before returning the value, skipping only operations that close() is already draining, which keeps the accepted-reader settlement contract from openclaw#175443.
consume() only checked the caller signal after a read settled, so an admission revoked while the read was in flight still returned a successful reply. Re-assert the operation authority before returning the value, skipping only operations that close() is already draining, which keeps the accepted-reader settlement contract from openclaw#175443.
What Problem This Solves
Shared-state reads maintain a second producer/cleanup continuation machine around operations that already own their promises and native cleanup. A source-wide synchronous service pump then steps every reader to advance that mirror.
This recovers the read-lifecycle area of closed #174230 and overlapping #173527. Their historical managed-image failure is not waived or reused as proof. The wide donors are being recovered by area under campaign rule 11.
What Changed
No intended user-visible change. Read completion, cancellation, snapshot bytes, failed-close retry, and ordinary shutdown settlement retain their existing owners; this removes internal continuation bookkeeping.
One async operation now joins the query, transport retirement, snapshot cleanup, and producer cleanup before releasing its retained resources. Native transports keep their own progress mechanisms; the outer owner no longer duplicates them. Source registrations own close only. Actual failed-close retry and shutdown joins remain. Retained synchronous snapshots keep their bytes until their last asynchronous child releases them.
Keep physical/source admission, live authority at the actual read boundary, worker command capture/byte accounting, FIFO, caller cancellation after cleanup, original-file snapshots, PostgreSQL connection ownership, and ordinary native settlement. Main's newer PostgreSQL migration regressions are unchanged apart from one obsolete mock member. No schema/column, durability, retention, permission, configuration, public protocol, dependency, or SDK change. Phase E is untouched.
Production delta: 308 net lines removed, five production files (+261/-569). Total fourteen files +466/-877, including one shrink-only mock-baseline entry. Tests/support/baselines are excluded from production accounting. This is an area slice, not additive credit for overlapping donors.
Best-effort tradeoffs accepted
Evidence
Review repair head
1844c2827e78164ce7ea4761fd0652f1e2d4b596: accepted P2 onconsumeerror ordering. An encoded worker failure must not be hidden by a later borrowed-owner observation failure. The repair reports failed outcomes directly, retains receipt phase and all cleanup joins, and still observes successful reads before returning them. The regression failed before the fix for the intended error-identity mismatch; its successful-read control passed. Fresh independent repair review is scoped-clean P0–P2. Targeted two-root types, type-aware lint, formatting and whitespace pass. Both new controls and the complete lifecycle file pass (10 cases), as does the mandatory suppression guard (14 cases): 24 focused cases, overlapping the prior proof below, not 24 additional unique cases. The serial wrapper completed successfully in995.38s, including worker generation preparation and final verification; the lifecycle file was668.43s wall/93%transform, while the two new cases executed in74/77ms. Current-head hosted CI remains required; CI timing is not yet available. No timeout, retry, skip or suppression was added.Prior head
35be9add3c535138fd3826bd82da30c997d0764b: CI run39029010858 completed successfully. The full paginated census has140 completed checks:83success,56eligibility skips,1neutralCodeQL; zero failures, cancellations or pending jobs. Both PostgreSQL conformance suites, baseline ratchets, selected Node tests, security-fast and the aggregate CI gate passed. Neutral CodeQL is not presented as a successful baseline comparison. This is prior-head evidence, not the repaired head's gate. No CI rerun or unchanged-head push was used.Fresh independent review covered the complete area diff. One P2 proposed restoring the metadata command clone; declined after inspecting the actual sole producer and full reference census, for the ownership reason above. No accepted/actionable findings remain; this is not described as a scoped-clean review.
Serial isolated proof passed: targeted types, type-aware lint of all thirteen files, formatting/whitespace, 135 focused tests (82 unit, 39 Gateway-lease integration, 14 suppression guards), zero runtime value cycles, and zero static cycles. All four narrowly selected native PR-wrapper inventory/import-closure cases also passed. Ten existing PostgreSQL-service-dependent cases were skipped because no local service is available; they are not counted as passes. The wrapper-inventory selection excluded eighteen unrelated cases rather than running the broad eager-import suite. Full check-changed, broad suites, whole-graph tsgo, builds, and E2E are not run locally under the host budget. Exact-head hosted CI is the broad gate.
CI repair: the original head's mock ratchet correctly required removing the obsolete unannotated worker-mock fingerprint. The existing controlled-transport mock already names its isolation reason; no annotation, test, assertion, or policy was changed. The one-row shrink passed the real complete-index checker (9,145 grandfathered factories) and independent P0–P2 review with zero findings. That ratchet-only repair did not change production or test inputs. The subsequent error-ordering repair has the separate focused proof above.
The original head's unchanged Gateway role case (
server.roles-allowlist-update.test.ts, “enforces operator and node permissions”) failed with the null-object TypeError/UNAVAILABLE signature. Scheduled main run 39025102777, job 117374543124, independently reports that exact case and signature. Main's health digest requires fields omitted by the unchanged shared health mock; neither path is modified here. This is inherited failure evidence, not a claim of green CI. The repaired exact head still requires its complete hosted check census, including PostgreSQL conformance.