Repository navigation
improve(sessions): reduce pending-input read work - #148208
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 14, 2026, 9:56 AM ET / 13:56 UTC (Revision 2). ClawSweeper reviewWhat this changesReduces SQLite work when reading pending messages while preserving message content, pagination, and session ownership checks. Merge readiness✅ Ready for maintainer review The optimization remains useful on current main, and no introduced correctness defect was found. Updated integration evidence resolves the previous counter-prerequisite concern. Priority: P2 Review scores
Verification
How this fits togetherPending-input storage holds accepted messages before they enter the conversation transcript. Gateway message lookups and pending-message lists read this storage, which also records interruptions when a session no longer owns queued input. flowchart TD
A[Accepted messages] --> B[Pending-input storage]
C[Gateway message requests] --> D{Single message or list}
D --> E[Bounded SQLite reads]
B --> E
E --> F[Current ownership check]
F --> G[Record stale interruptions]
F --> H[Return messages and page metadata]
G --> H
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests +64. Total +66 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the optimization in the existing pending-input owner, preserving full payload reads for callers and fresh custody checks during reconciliation. Do we have a high-confidence way to reproduce the issue? Not applicable to a functional bug: this is a read-work optimization, and current source confirms both unnecessary reads. Is this the best way to solve the issue? Yes. Removing unused query results inside the existing owner is a narrow solution that preserves public results, persisted formats, and transaction semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 36a725a599bc. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Pending-message lookups and reset reconciliation fetch data their callers do not use.
User Impact
No intended behavior change. Messages retain their full content, pagination, cancellation, and session ownership behavior with less SQLite read work.
Why This Change Was Made
Exact-ID reads skip an unused count. Reset reconciliation rereads only the four custody fields it needs, retaining its fresh transaction and owner checks.
Evidence
72/72 tests pass across all three owner, consumed-input, and registered Gateway handler files on Node 26.8.2, without filtering or an overlay, on main
37f2b34992ffplus this exact patch. The corrected counter from merged #148144 is committed in that base, satisfying the requested integration proof.Two extended cases fail at the intended budgets on original code and verify complete stored-row parity and rollback after the second interruption update fails. Measurements cover pending-table SELECTs and returned text, with no latency or whole-Gateway claim; Gateway tests use isolated SQLite through registered handlers.
Original static proof is a completed composite: 21 canonical commands passed before two line-limit failures; after the repair, four-file lint, 72 tests, the affected config-cli graph and all eight remaining commands passed. Those receipts and clean four-file independent review remain applicable to the unchanged patch after current-context assessment. The fresh 30-command plan was inspected, not executed as another full suite. Original failures and temporary-helper runs remain preserved.
Exact published-head CI passed. These hosted results and the current-main integration runs are separate evidence; native maintainer validation and landing gates still apply.