Skip to content

refactor(sessions): separate transcript read owners - #149670

Merged
vincentkoc merged 3 commits into
mainfrom
fix/history-read-owners-20260915
Sep 16, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
fix/history-read-owners-20260915

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Related: #143610

What Problem This Solves

Cold chat-history reads share module entry points with projection maintenance and general session-file operations, preventing the read-only query path from being loaded independently.

User Impact

Internal prerequisite for history-worker isolation. This preserves current behavior and requires no schema migration or operator action. Native cold-history latency remains to be validated with the worker integration.

Why This Change Was Made

Extract the canonical SQLite history, projection, and raw-delta readers, plus transcript-message and archive readers. Migrate callers while preserving normalization, validation, ordering, read fences, errors, and cleanup. Store acquisition and reconciliation remain with their existing owners.

Reuse the existing record guard and remove two obsolete assertion-baseline allowances. Production: +1,755/-1,650 (net +105), justified by explicit database-bound read APIs. Tests: +38/-8; baseline: -2. Existing query and cache implementations retain one owner.

Evidence

Current integrated head: 2c12a1c1f2e096f4c0ab5a6e63c622e430e5072c, tree b3d582d25cfe68ce0d486af12111ac48d48cab7a.

Merged frozen main b6bbf1f5215a68f91c0e55eb2783ecbd9703db16. The import-only conflict resolution preserves main's question-answer custody checks and compiled history-count readers, together with the read-only SQLite owner boundary. Targeted formatting, diff checks, and independent resolution review passed. Fresh full integrated-branch review found no actionable P0–P2 findings.

Prior source 8d5a64e306586955bd5b0318d31ac0367be6cf7d passed 37 focused runtime files / 635 tests, all 6 import-boundary cases, all 31 changed gates, and a private qaRuntime build with matching source-carrier stamps. Its emitted relative-import inventory resolved. These results are retained in a private complete capture; the associated runner-allocation workflow does not independently expose that command proof. They do not qualify the integrated head or establish latency.

Current-head hosted CI passed: 195 successful jobs and 6 intentional skips, including the required aggregate, build, type, and runtime checks. The runtime-config shard passed 368 files / 5,732 tests, including all 9 incoming question-answer custody cases, all 3 history-count/cache cases, and all 6 import-boundary cases. The single Windows-job retry and its dependent aggregate passed on unchanged source; the other 199 job results carry forward from attempt 1. Both previously failing native argv-lookup cases passed; the initial failure's cause remains unknown.

After the ready transition, normal PR CI also passed: 124 successful jobs and 16 skips, including its required aggregate. This run tested GitHub merge commit bec38bb6befb94819a8d5970b2660c8475006027, tree b797228f0f7c582834d77699a78d885d55985730, combining source 2c12a1c1f2e096f4c0ab5a6e63c622e430e5072c with main 92e81af8ba60aa49c560e066753d52dad2893b73. This merge-result proof is separate from the direct-source release-gate run above.

The iOS/macOS stack still requires composed native cold-history proof. No measured latency claim.

@vincentkoc vincentkoc self-assigned this Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Sep 16, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 1:34 AM ET / 05:34 UTC (Revision 3).

ClawSweeper review

What this changes

Separates transcript queries and archive readers from database acquisition and message display decoration while preserving existing chat-history behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this remains a useful, maintainer-sponsored prerequisite for history-reader isolation. No actionable introduced defect was found, and the cited hosted CI passed on the reviewed head.

Priority: P3
Reviewed head: 2c12a1c1f2e096f4c0ab5a6e63c622e430e5072c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving extraction with migrated callers, useful architecture coverage, and verified successful CI on the reviewed head.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored internal extraction is exempt from the external-contributor proof gate and introduces no material authority change. Exact-head CI supports the moved readers and callers; native cold-history latency remains unproven and is explicitly outside this PR's claim. No target code was executed during this read-only review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored internal extraction is exempt from the external-contributor proof gate and introduces no material authority change. Exact-head CI supports the moved readers and callers; native cold-history latency remains unproven and is explicitly outside this PR's claim. No target code was executed during this read-only review.
Evidence reviewed 8 items Snapshot and lifecycle ownership preserved: The extracted snapshot reader retains deferred transactions, cold-storage rejection, projection freshness checks, and the connection-bound query cache. The existing adapter still owns database acquisition, read-only selection, reconciliation, and unavailable errors.
Read fences and cursor behavior preserved: Raw-delta reads retain limit normalization, agent/session/generation checks, admission-fence validation, byte bounds, and cursor progression. The fence change replaces the existing Kysely wrapper with its underlying factory; it does not change admission or question-answer custody decisions.
Archive extraction and caller cutover: Comparison with the pinned base showed the archive implementation moved without behavioral changes. Gateway callers use the new owner, retaining archive-only fallback, source validation, file-handle cleanup, and message projection.
Findings None None.
Security None None.

How this fits together

Gateway history requests read stored conversations from SQLite or transcript archives, then project those records into client-visible messages. This change separates the storage readers from lifecycle management and display decoration.

flowchart TD
  A[History request] --> B[Resolve transcript target]
  B --> C[Database acquisition]
  C --> D[SQLite snapshot readers]
  B --> E[Archive reader]
  D --> F[Stored message projection]
  E --> F
  F --> G[Display decoration and response]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +105, Tests +30, Other -2. Total +133 across 33 files.

View PR surface stats
Area Files Added Removed Net
Source 27 1755 1650 +105
Tests 5 38 8 +30
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 2 -2
Total 33 1793 1660 +133

Review metrics

Metric Value Why it matters
Owner separation cost Production net +105 lines; tests net +30 lines The modest net growth is justified by explicit connection-bound reader interfaces while existing query implementations move rather than duplicate.

Technical review

Best possible solution:

Keep one canonical implementation of each transcript reader, with acquisition and reconciliation outside the query modules and native performance claims reserved for the composed integration.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR addresses module coupling rather than a reported runtime defect; source comparison confirms that coupling remains on fetched main.

Is this the best way to solve the issue?

Yes: extracting the existing implementations and migrating their callers is a narrow way to establish independent read modules without changing storage or public contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against db1d5d2dccbc.

Labels

Label justifications:

  • P3: This is an internal ownership refactor with no claimed user-visible behavior change or urgent regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored internal extraction is exempt from the external-contributor proof gate and introduces no material authority change. Exact-head CI supports the moved readers and callers; native cold-history latency remains unproven and is explicitly outside this PR's claim. No target code was executed during this read-only review.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-16T04:19:03.453Z sha 8d5a64e :: blocked before merge. :: none
  • reviewed 2026-09-16T04:31:12.118Z sha 2c12a1c :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc marked this pull request as ready for review September 16, 2026 05:23
@vincentkoc
vincentkoc merged commit 932846b into main Sep 16, 2026
670 of 674 checks passed
@vincentkoc
vincentkoc deleted the fix/history-read-owners-20260915 branch September 16, 2026 05:54
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant