Repository navigation
fix: prevent chat stalls during progress-card saves - #167396
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 October 8, 2026, 2:58 PM ET / 18:58 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch separates writer-held session target discovery from history searches and updates affected regression fixtures. Example: Save “Concurrent history” while searching history for “concurrent”.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a source-supported deadlock that remains on current main. No actionable introduced defect was found, and the follow-up test correction preserves source-replacement coverage. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway saves progress cards through an ordered database writer. Read-only workers locate session databases and search history; their cleanup must finish without waiting on work that needs the same writer. flowchart TD
A[Progress-card save] --> B[Ordered database writer]
B --> C[Separate target-discovery reader]
C --> D[Save and finish reader cleanup]
E[History search] --> F[Index-status request]
F --> B
D --> G[Writer released]
G --> H[Save and search complete]
Technical reviewBest possible solution: Keep writer-held discovery and cleanup independent of history tasks under the existing database lifecycle owner. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the writer-to-history-cleanup circular wait, and the supplied regression forces that ordering with real SQLite workers. This review did not execute it. Is this the best way to solve the issue? Yes, separating discovery in the shared resource owner removes the circular dependency while preserving FIFO, target identity, authorization, and caller-selected read lanes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d81169b0c996. Provenance checked
TestingProof path: in-process harness. Added test files: 3. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +7, Tests +71, Docs +9. Total +87 across 6 files. View PR surface stats
Review metrics
LabelsLabel changes: No label 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)
|
|
Merged via squash.
|
* fix: prevent chat stalls during progress-card saves * test: follow dedicated session target discovery lane
What Problem This Solves
Fixes chat and other database writes becoming stuck when a progress-card save overlaps a history search.
User Impact
Messages and progress-card updates can finish during concurrent history reads. No configuration, schema, stored-data, or migration changes are required.
Why This Change Was Made
Writer-held session target discovery now uses a separate read-only worker lane, so its awaited cleanup cannot join a history task waiting for that same writer. The lane uses the existing lifecycle owner and starts on demand; the tradeoff is one additional lazy reader worker. FIFO ordering, current-target authorization, reader custody, and write settlement remain unchanged.
Evidence
A real progress-card/history regression timed out at the existing 120-second deadline before the fix and completed in about 1.04 seconds afterward.
All 153 focused tests passed, including write ordering, authority rollback, aliases and physical identity, lifecycle cleanup, cancellation, forks, incognito state, and uncertain-commit handling.
Core production types and all 27 core-test type graphs passed.
pnpm test src/gateway/progress-card-store.worker.test.ts --maxWorkers=1: 25.05 seconds wall time after the patch (7 tests, 6.47 seconds test time, including the 1.04-second regression). The failing-before command took 143.41 seconds including cold compilation. Hosted CI timing is not yet available.Formatting, targeted lint, diff checks, and remaining changed-scope guards passed.
The full changed-check run stopped at an unused
ClientVoiceToolEffectexport in untouchedsrc/talk/client-voice-session-store.ts. Its source matches the base exactly; no clean-baseline full scan was run, so this is unchanged-source attribution, not a claimed baseline reproduction.Independent scoped review completed with no P0/P1 findings.
CI follow-up
The initial hosted changed-test job caught a stale interception in
conversation-list.test.ts: its source-replacement case still waited for target discovery on the history lane. The same failure reproduced locally (1 failed, 9 passed). The fixture now intercepts the lane appropriate to each read phase, retaining real worker execution, file replacement, awaited cleanup, and the source-change rejection. All 10 conversation-list tests pass after this correction (node scripts/run-vitest.mjs src/gateway/conversation-list.test.ts --maxWorkers=1: 9.10 seconds wall time). No production change was needed. The initial failed CI remains failed; this is a repaired fixture, not a rerun-only claim.Independent P0/P1 review of the test correction passed. A separate read-only sibling audit found no further stale discovery interceptions.
The correction also passes its Gateway test type graph, targeted lint, formatting, and changed-scope guards. The broader dead-export scan still stops on the same untouched voice export disclosed above.