Repository navigation
refactor(gateway): isolate cold history reads - #149876
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: blocked before merge. Reviewed September 16, 2026, 4:56 AM ET / 08:56 UTC (Revision 2). ClawSweeper reviewWhat this changesSeparates Gateway history paging from host initialization and prepares transcript targets before dispatching reads to a retained SQLite worker. Merge readiness⛔ Blocked before merge - 2 items remain The earlier worker-constructor finding is resolved, and no remaining blocking defect was found. This remains a distinct, maintainer-owned prerequisite beyond the merged reader extraction. Priority: P2 Review scores
Verification
How this fits togetherGateway history readers turn stored conversation transcripts into paginated RPC and HTTP responses. This change separates worker-side queries from host-side restoration, profile decoration, and CLI history imports. flowchart TD
A[RPC and HTTP history requests] --> B[Host target preparation]
B --> C[Retained history worker]
C --> D[Database and transcript validation]
D --> E[Shared paging readers]
E --> F[Host decoration and authorization]
F --> G[Conversation history response]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +211, Tests +624, Other +6. Total +841 across 57 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep shared paging and transcript queries behind the narrow reader boundary, with restoration and presentation remaining host-owned and native latency qualification tracked in the linked native work. Do we have a high-confidence way to reproduce the issue? No high-confidence reproduction of the original native timeout was established here; source confirms the import boundary, while the supplied worker observation does not reproduce or benchmark the native failure. Is this the best way to solve the issue? Yes for the bounded isolation goal: the patch shares existing query behavior and preserves host-owned restoration and presentation; its native performance benefit remains unproven. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d0dd991b4c08. 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)
|
|
The two Rank-up moves in the prior review are addressed on
Observed request durations were 432.92 ms for metadata, 67.42 ms for history after metadata, and 3.13 ms for HTTP reuse. This used an existing filesystem cache; it is sequence/custody proof, not a comparative benchmark or native iOS latency result. Retained capture SHA256: |
|
Maintainer disposition for the two remaining checklist items in the current review, at
The reader-test capture SHA256 is |
|
Merged via squash.
|
* refactor(history): isolate worker query kernels * test(history): align fixtures with storage and display contracts * test(history): cover retained reader admission * test(history): preserve fixture session key type * refactor(history): remove obsolete reader exports
Related: #143610
Builds on #149670.
What Problem This Solves
A downstream native history check timed out during a cold worker read. Instrumentation showed substantial time in the history-kernel import; individual dependency costs and the end-to-end benefit of this refactor remain unmeasured.
User Impact
RPC and HTTP history use narrower worker readers while preserving paging, authorization and transcript behavior. Native latency improvement remains unverified. No schema-version change, migration or new operator action is introduced.
Why This Change Was Made
Prepare the physical database and logical transcript target before queueing, share the history kernels, and retain one read-only connection scope. Existing owners retain cache invalidation, question-answer custody, worker-generation checks and canonical session admission. CLI, incognito and profile handling stay with their callers. Remove obsolete reader wrappers and exports, with tests using their canonical owners.
The integration preserves current main's row-presence worker request and imports its retained scope constructor from the canonical scope owner. The separate row-presence request still reaches broad session-entry acquisition; narrowing that dependency closure remains follow-up work while its admission and lifetime contract stays intact.
Production net +217 lines establishes these ownership boundaries; tests and test support net +624 lines cover their shared contracts.
Evidence
Source:
852cf41afeff4e2a010fa42855f23e50f355481b, integrated with0cb61c67b1058c8d96e3d3f78641a72866203bc3.Required hosted CI, including all 19 core test-type graphs and the full side-question and managed-service handoff lifecycle files, remains pending. Composed native cold-history qualification remains in #143610; no measured native improvement is claimed.