Repository navigation
fix(tests): restore wake ordering and native usage settlement - #184427
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. |
|
Codex review: needs maintainer review before merge. What this changesThis PR ignores top-level session-field order during comparison and updates the restored-wake test to match recovery-owned reservation ordering. Example: After two asynchronous session-entry replacements, the current writer persists totalTokens: 13357.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review This PR fixes a current session-entry comparison defect and preserves the intended recovery ordering; no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherSession patch preparation borrows retained entry facts, then the worker compares them with authoritative SQLite state before committing and publishing the result. flowchart TD
A[Session patch caller] --> B[Retained entry facts]
B --> C[Callback patch preparation]
C --> D[Worker transaction]
E[Current SQLite entry] --> D
D --> F[Logical field comparison]
F --> G[Commit and publication]
Technical reviewBest possible solution: Keep the shared comparator independent of top-level insertion order while preserving value conflicts, participant exclusions, and existing recovery ownership. Do we have a high-confidence way to reproduce the issue? Source inspection shows replica delta application preserves existing property positions while main compares the remaining entry through whole-object serialization; the PR reports a matching red-on-base store regression, but this review executed no tests. Is this the best way to solve the issue? The focused fix belongs in the existing shared comparison owner and removes the special ordering workarounds without weakening comparisons of owner or content values. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 79798ed63e1d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -16, Tests +18, Docs +2. Total +4 across 4 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 (1 earlier review cycle)
Reviewed October 26, 2026, 5:36 AM ET / 09:36 UTC (Revision 2). |
Compare logical session fields independently of replica insertion order while preserving JSON omission semantics and real conflict detection. Align restored interrupted wake ordering with recovery-owned reservation; retain the exact model capability contract. Reproduced all reported main failures and proved the store regression red on the original comparator.
0891758 to
6831639
Compare
|
Integrated #184372 through main 745e1f6; submitted head is 6831639. The generic field comparator is unchanged from the reviewed candidate and subsumes the upstream owner-specific comparison. Its regression proving changed owners still conflict remains intact. The delivery-order regression still fails against current main. After integration, all 38 session-entry patch tests and both native-usage finalization cases passed locally. The prior-head CI passed; the new exact-head CI is running. The PR body now records the integration, proof, and net 16-line production deletion. Independent review of the conflict resolution found no actionable findings. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…aw#184427) Compare logical session fields independently of replica insertion order while preserving JSON omission semantics and real conflict detection. Align restored interrupted wake ordering with recovery-owned reservation; retain the exact model capability contract. Reproduced all reported main failures and proved the store regression red on the original comparator.
Compare logical session fields independently of replica insertion order while preserving JSON omission semantics and real conflict detection. Align restored interrupted wake ordering with recovery-owned reservation; retain the exact model capability contract. Reproduced all reported main failures and proved the store regression red on the original comparator. (cherry picked from commit 6f94c2a) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit afafabf831c462415dbac05526eeef1c18be736b)
Compare logical session fields independently of replica insertion order while preserving JSON omission semantics and real conflict detection. Align restored interrupted wake ordering with recovery-owned reservation; retain the exact model capability contract. Reproduced all reported main failures and proved the store regression red on the original comparator. Beta.5 baseline adaptation: Retain the native beta.5 owners, fixtures and public contracts; add focused regression controls and bounded fixture extraction; apply checkout formatting. (cherry picked from commit 6f94c2a) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 78cb890169c01edca2b7fd719b939402f76368a4)
What Problem This Solves
Fixes false session-entry conflicts during native usage finalization and updates a stale restored-wake ordering expectation.
User Impact
A valid current writer can persist native usage after a session entry is replaced, even when the retained replica and the database decode insert identical fields in a different order. Replaced writers still cannot finalize usage. No schema, configuration, retention, or permission changes.
Why This Change Was Made
Three contracts were traced to their original changes:
642b31d1993b) deliberately derives scalar reasoning support from an explicit effort ladder. The matching exact expectation was independently corrected by fix: align reasoning compatibility consumer tests #184414 (b20034955814) while this investigation ran. The required rebase retains that upstream fix without duplicating it here.d57631395e45) deliberately reserves interrupted recovery announcements after reconciliation. Ready cohorts retain FIFO, followed by exactly one recovered historical announcement; the saved-result coverage introduced in fix(agents): let recovered terminal results deliver after their child session is reused #184069 remains intact. The source restores ready reservations before starting interrupted reconciliation, so this is deterministic contract drift rather than a timing workaround.bb92103e5698) reuses current replica facts for callback preparation. Delta publication from perf(sessions): transfer changed fields for warm entry patches #183276 preserves old property positions. After two asynchronous replacements,deliverycan appear before new lifecycle/usage fields in the host and after them in the worker. Diagnostics showed identical field values and only that insertion-order difference. Compare serialized field values independently of top-level order, retaining JSON omission semantics, participant projection exclusions, and real owner/content conflict detection. The original current/replaced-writer integration assertions from fix: native Codex session usage stays zero after /new #133441 remain unchanged.This removes the whole-entry serialization and separate cold-field ordering workaround: production +12/−28, net −16 lines. The smaller comparator still checks every non-participant field. It also subsumes #184372's separate hydrated-owner comparison; that PR's owner-reassignment regression remains unchanged. This is a correctness repair, not a performance claim; allocation/CPU and whole-Gateway stress measurements are not used as evidence.
Credit: the automatic-primary regression was contributed by @obviyus in #148167; the subsequent compatibility, wake recovery, replica preparation, and native-usage contracts were authored by @steipete in the linked PRs.
Evidence
Baseline
2499f2be3e88e025735268fb622e569d69fcd369reproduces all four reported failing assertions: model metadata, interrupted predecessor order, and both native-usage writers. A new store-boundary regression also fails on the original comparator after two asynchronous replacements followed by a callback patch.Local validation: 313 tests pass across the complete model-switch (109), shared-run integration (156), entry-revalidation (21), and entry-patch (27) files. The infra shard took 372.66 s; the final entry-patch file took 27.50 s (32.88 s including wrapper). A final red control restored only the original comparator and reproduced
session-entry.patchin the committed regression (36.13 s). Changed-file oxfmt, production/test oxlint, andgit diff --checkpass.The complete requester-wake E2E file passed five consecutive runs of 39 tests each, with
OPENCLAW_E2E_SKIP_BUILD=1and one worker. Durations: 100.88, 71.45, 67.68, 63.36, and 63.62 s. No retries, timeout increases, or assertion relaxation. These full-file runs preceded the latest-main integration. Ordinary PR CI selects the wake and session-patch regression files. Its bounded planner omitted the unchanged model-switch and shared-run integration files on both submitted heads, so their full-file results above are local evidence, not a claim of direct CI coverage. No CI reruns.Independent subagent review (autoreview route unavailable): the configured-route preflight refused before inference; configuration was left unchanged. A fresh reviewer received only the diff and relevant contract/owner context and found no actionable P0–P2 findings.
Main integration
ClawSweeper identified a real merge conflict with #184372, without identifying an introduced code defect. Integrated main through
745e1f6f21fd; the resulting comparator is byte-for-byte identical to the independently reviewed candidate and preserves the upstream owner-reassignment coverage. The committed delivery-order regression still fails with that main comparator (session-entry.patch, 56.76 s), proving the residual after the owner-specific repair. Independent review of the resolution found no actionable findings. ClawSweeper also re-reviewed exact head68316392beaea722665618d4b646a13528bcc57fwith no findings and no before-merge items. Post-integration validation passed all 38 tests in the complete entry-patch and entry-patch.operations files (69.90 s), plus both native-usage finalization cases (41.49 s). The prior head0891758d2ce60d7d87c5963aea9861668d7edfdapassed CI; submitted head68316392beaea722665618d4b646a13528bcc57fpassed exact-head CI, includingopenclaw/ci-gate, all selected test/type/lint checks, the artifact build, and all three PostgreSQL conformance shards. No CI reruns or inherited-failure exceptions were needed.Direct exact-head job logs confirm 39/39 requester-wake tests and 27/27 session-entry-patch tests. The unchanged model-switch, shared-run integration, and upstream owner-reassignment files were not selected by ordinary PR CI; their focused local results are reported above. No shipped Gateway run or performance measurement is claimed.
The PR is intentionally left ready and unmerged for the coordinating maintainer.