Repository navigation
improve(codex): reduce database reads when listing sessions - #151979
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 18, 2026, 1:19 PM ET / 17:19 UTC. ClawSweeper reviewWhat this changesThe Codex plugin batches session-binding reads during catalog listing, preserves sequential fallbacks, and adds freshness, ordering, and query-budget coverage. Merge readiness✅ Ready for maintainer review This remains a useful optimization: current main still reads adoption bindings individually. No actionable introduced correctness or security defect was found, and the maintainer-protected PR should remain open. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s Codex session catalog combines native thread listings with local session metadata. Binding checks identify which native threads already have an adopted OpenClaw chat. flowchart TD
A[Session catalog request] --> B[Eligible local sessions]
B --> C[Bulk read or scalar fallback]
D[Plugin state SQLite] --> C
C --> E[Validate binding and session generation]
E --> F[Adopted session map]
G[Native thread listing] --> H[Catalog response]
F --> H
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +113, Tests +266. Total +379 across 13 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep batching within the existing plugin-state owner while preserving fresh per-list generation checks, ordered decoding, and scalar compatibility. Do we have a high-confidence way to reproduce the issue? Not applicable to a functional bug: this is a performance optimization. Current source confirms repeated scalar acquisition, and the composed benchmark supplies a concrete query-count comparison. Is this the best way to solve the issue? Yes. Reusing the existing bounded storage API and canonical decoder avoids a new cache or competing state owner while retaining existing compatibility behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 31044b634cdd. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* origin/main: test(gateway): isolate session resolution channel fixtures (#151945) fix(clickclack): drain discussion opens before shutdown (#151978) fix(test): restore trusted packaging harness startup (#151967) improve(codex): batch session adoption binding reads (#151979) improve(cron): reduce allocations for busy stream sources (#151956) fix(file-transfer): avoid repeated directory record encoding (#151987) fix: avoid session-list rebuilds when authentication availability changes (#151920) fix(updates): explain externally managed update refusals (#151942) improve(heartbeat): avoid unused config work in membership checks (#151867) fix(android): keep status text readable and label accessibility actions (#151342) improve(ui): show OS and size in the environment selector (#151947) fix(android): keep tool errors visible in collapsed chat activity (#151332)
Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Listing Codex sessions repeats the same SQLite freshness, schema, and binding-authority reads for each adopted session.
User Impact
Catalog listing performs fewer database reads while preserving current binding checks and returned session results. No migration or operator action is required.
Why This Change Was Made
Read eligible adoption bindings together through the existing bounded plugin-state store, and carry that capability through the registered lazy adapter. Decode rows in traversal order, retain scalar fallbacks, and keep registration free of state access. The binding scope helper and read tests move into focused sibling modules to keep their owners within the existing file-growth limits.
A terminal bulk database error can surface before an earlier per-row domain error; successful acquisition still preserves traversal-order validation. The change adds no schema, cache, transaction, or retention policy.
Evidence
73a7705d8841a3c6ed26e06988119fbfd8085d40.