Repository navigation
refactor(state): share prepared read and diagnostic types - #159128
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: needs maintainer review before merge. Reviewed September 26, 2026, 11:02 PM ET / September 27, 2026, 03:02 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch shares diagnostic recovery activity types and derives the SQLite read-context type from its capture function. Merge readiness✅ Ready for maintainer review Keep this PR open. Current main still contains the duplicated declarations, and the revised branch is a coherent type-only cleanup. The earlier runtime change associated with a shutdown concern was withdrawn; the pinned diff shows no introduced functional defect. Priority: P3 Review scores
Verification
How this fits togetherDiagnostic events feed a session activity tracker that produces health snapshots. SQLite read requests use a captured admission context before worker-backed reads; this PR changes the types describing those two flows. flowchart LR
A[Diagnostic events] --> B[Session activity]
B --> C[Recovery activity contract]
C --> D[Health snapshot]
E[SQLite read request] --> F[Admission capture]
F --> G[Read context contract]
G --> H[Worker reader]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -10. Total -10 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one type owner for each flow while preserving the existing recovery and SQLite admission checks. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR addresses duplicated type declarations rather than a runtime bug. The pinned source diff establishes the cleanup target. Is this the best way to solve the issue? Yes. The proposed aliases use the existing type owners and leave the runtime recovery and read-admission paths intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2e09d9e2e60a. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
CI investigation: the failure in The failing assertion is The fixture waits for an empty ingress queue, but transport adoption clears the queue before replay-claim commit and reply delivery complete. A controlled deferred-adoption schedule reproduces the exact assertion failure on main Bounded comparison after a frozen dependency install:
Source inspection confirms the runtime change here reuses the same captured admission checks, in the same order; the remaining changes are TypeScript type ownership. A passing replay alone is not claimed as a fix. The separate fixture repair is tracked in #159168; a controlled deferred-adoption schedule fails before the fix and passes after it. The repaired original shard passes all 308 tests, and independent review is clean through P2. Requesting exactly one targeted rerun of job 108477660650 on this unchanged head under the documented unrelated-fixture exception. Squash auto-merge remains enabled. Rerun outcome: job 108480618180 passed on the unchanged head (20:25:59–20:34:54 UTC). The workflow remains canceled because 81 sibling checks were canceled by the original fail-fast; the only remaining failed job is the aggregate gate 108482055203. No second test rerun has been requested. Resuming the canceled coverage is with the coordinator under the stated single-job rerun limit. |
Restore the original snapshot admission assertion callback while investigating the Linux Gateway restart timeout. Retain only type-shape consolidation with identical emitted JavaScript.
…59128) * refactor(state): reuse prepared admission and diagnostic facts * refactor(state): keep D4 consolidation type-only Restore the original snapshot admission assertion callback while investigating the Linux Gateway restart timeout. Retain only type-shape consolidation with identical emitted JavaScript.
What Problem This Solves
Removes duplicated state read-context and diagnostic activity type definitions left in the performance campaign's session/state owners.
User Impact
No runtime behavior change. The remaining three changed modules emit identical JavaScript to the branch base after TypeScript erasure and repository formatting. Authority checks, freshness, queue ordering, diagnostic cutoffs, schemas, stored data, and update behavior remain unchanged.
Why This Change Was Made
Diagnostic session activity includes the recovery owner's existing five-map shape instead of declaring it again. Its three marker types become private because the duplicate declaration was their only outside consumer. The state read-context alias derives from the capture owner's explicitly declared return type.
The snapshot-reader callback consolidation was withdrawn after investigating a Linux CI shutdown hang.
agent-deletion-journal.read.tsis now byte-identical to the branch base. This deliberately leaves the PR entirely type-only; it does not claim to repair the latent shutdown hang.D4 reviewed the thirteen supplied merged commits and their owners, plus D1a/D1b (#158656 and #158834). Distinct WAL ownership, worker settlement/cleanup ordering, label validation, physical identity checks, and resident-authority fallbacks remain intact. No shared worker-operation framework was introduced.
Evidence
oxfmtproduces byte-identical JavaScript for all three changed files against main base0a9fa7dafabec7ce52c5dac5bd71b9e3c1bcc784. The restored snapshot-reader source matches that base exactly.node scripts/run-vitest.mjs src/logging/diagnostic-run-activity-owners.test.ts src/logging/diagnostic-run-activity.test.ts src/state/agent-deletion-journal.snapshot.test.ts src/state/openclaw-state-db-async-lifecycle.test.ts src/config/sessions/startup-migration.registry-recovery.test.ts— 68 passed, 58.30 s wall.d0b610346fc6f30f7d952873cd47fe1132ba1577: the original 26-file Linux shard passed 92/92 in 130.40 s wall, without diagnostic probes or timeout changes. The four touched/originally touched files passed lint with 0 warnings and 0 errors, productiontsconfig.core.jsonpassed, andcore-test-state-logging/core-test-gateway-serverpassed (41.3 s / 40.2 s). The first test-type invocation used noncanonical graph names and was rejected before compilation; the corrected invocation passed. Final Testbox workflow, leasetbx_01m3gb1c6xat19rb8bjntrhw4a; the earlier investigation lease completed and final lease was stopped after validation.git diff --checkpassed. Independent Codex review through P2 found no accepted/actionable findings.The original failing CI job on
64a12451f897first timed out inresumes admitted but unprocessed input after a Gateway restartafter 120 seconds; subsequent cases found the fixture still closing, and suite cleanup timed out. Thegateway closed (1006)log belonged to a passing sibling replay test.The recorded 26-file/92-test shard passed locally on both that PR head (265.18 s) and main
d9c7aa507db1(265.37 s). On one Linux Testbox, the original PR head reproduced the hang (483.06 s), while that main revision passed all 92 tests (136.25 s). The exact embedded main base0a9fa7dafabealso passed the unmodified Linux shard (119.68 s). Temporary shutdown-stage and timeout-only probes passed and were removed. The precise intermittent shutdown mechanism remains unestablished; passing replays are not presented as a fix. The conservative correction removes the PR's only runtime change.A possible maintainer design follow-up remains a typed operation descriptor within the shared read owner. Its four plumbing files total 2,208 production lines, including 101 standalone repeated success/admission envelope lines. An estimated 100–200 net lines might be recoverable while retaining explicit validation, capture, byte budgets, and authority checks. This is an unimplemented estimate requiring a maintainer design decision.