refactor: add session accessor seam#88840
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 4, 2026, 4:47 PM ET / 20:47 UTC. Summary PR surface: Source +819, Tests +552, Generated 0. Total +1371 across 7 files. Reproducibility: not applicable. this is a refactor PR, not a bug report. The merge blockers are source-visible: the public SDK export at src/plugin-sdk/session-store-runtime.ts:25 and the contributor proof gate. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the file-backed accessor seam internal and behavior-neutral, remove or defer the SDK lifecycle cleanup export unless maintainers approve it separately, then require redacted runtime/session proof before merge. Do we have a high-confidence way to reproduce the issue? Not applicable; this is a refactor PR, not a bug report. The merge blockers are source-visible: the public SDK export at src/plugin-sdk/session-store-runtime.ts:25 and the contributor proof gate. Is this the best way to solve the issue? No; the internal accessor seam is a plausible first slice, but adding lifecycle cleanup to the public SDK in this slice is not the best boundary. Keep that helper internal or split it into a maintainer-approved SDK API PR. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 3d168074b473. Label changesLabel justifications:
Evidence reviewedPR surface: Source +819, Tests +552, Generated 0. Total +1371 across 7 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
f18f99c to
b39023f
Compare
|
Superseded by #90463, which bundles this accessor seam with its first gateway production consumer. That keeps the branch-by-abstraction landing unit reviewable while avoiding a temporary dead-code allowlist entry for the intentionally-new seam. |
Summary
What problem does this PR solve?
Why does this matter now?
The core session/transcript SQLite migration is broad because many callers currently depend on file-era shapes. This creates a stable internal boundary first so storage changes and caller modernization can land separately.
What is the intended outcome?
A behavior-neutral internal seam over current file storage that later SQLite store modules can satisfy.
What is intentionally out of scope?
SQLite schema/store modules, runtime storage flip, doctor migration, and subsystem caller modernization.
What does success look like?
The seam is additive, tested against file storage behavior, and safe to build subsequent migration PRs on.
What should reviewers focus on?
Transcript write locking, topic/session path resolution, normalized session keys, metadata-only insert behavior, and whether the seam avoids runtime dual-read/fallback behavior.
Linked context
Which issue does this close?
Does not close an issue.
Which issues, PRs, or discussions are related?
Refs #88838.
Related #79902.
Was this requested by a maintainer or owner?
Yes. This follows Josh's Path 3 SQLite decomposition plan for the core session/transcript migration.
Path 3 implementation map
This PR is the PR 3.1a base seam for the broader #88838 SQLite migration. The current open PRs in the stack are:
Real behavior proof (required for external PRs)
node scripts/run-vitest.mjs src/config/sessions/session-accessor.test.ts src/config/sessions/transcript.test.tspnpm exec oxfmt --check src/config/sessions/session-accessor.ts src/config/sessions/session-accessor.test.ts src/config/sessions/transcript-append.tsnode scripts/run-oxlint.mjs src/config/sessions/session-accessor.ts src/config/sessions/session-accessor.test.ts src/config/sessions/transcript-append.tspnpm tsgo:corepnpm tsgo:core:test/Users/phaedrus/Projects/prompts/skills/autoreview/scripts/autoreview --mode localTests and validation
Which commands did you run?
node scripts/run-vitest.mjs src/config/sessions/session-accessor.test.ts src/config/sessions/transcript.test.tspnpm exec oxfmt --check src/config/sessions/session-accessor.ts src/config/sessions/session-accessor.test.ts src/config/sessions/transcript-append.tsnode scripts/run-oxlint.mjs src/config/sessions/session-accessor.ts src/config/sessions/session-accessor.test.ts src/config/sessions/transcript-append.tspnpm tsgo:corepnpm tsgo:core:test/Users/phaedrus/Projects/prompts/skills/autoreview/scripts/autoreview --mode localWhat regression coverage was added or updated?
Added
src/config/sessions/session-accessor.test.tscovering file-backed load/list/upsert, metadata-only insert ids, transcript event load/append, secure transcript file creation, topic fallback paths, and normalized session-key persistence.What failed before this fix, if known?
Autoreview caught several seam risks before this PR was opened: unsafe fallback session ids, insecure raw transcript file creation, missing topic fallback handling, cache mutation outside the writer, non-canonical session-key persistence, and raw appends bypassing the transcript lock/FIFO. Those were fixed before opening this PR.
If no test was added, why not?
Tests were added.
Risk checklist
Did user-visible behavior change? (
Yes/No)No.
Did config, environment, or migration behavior change? (
Yes/No)No.
Did security, auth, secrets, network, or tool execution behavior change? (
Yes/No)No.
What is the highest-risk area?
The new raw transcript event append helper could become a reusable write path, so it must preserve existing transcript locking and file-permission behavior.
How is that risk mitigated?
The helper routes through the existing transcript append FIFO and session write lock, creates new files with
0600, and has focused regression coverage.Current review state
What is the next action?
Maintainer review of the additive seam shape and safety constraints.
What is still waiting on author, maintainer, CI, or external proof?
CI and maintainer review. The broader migration remains tracked in #88838.
Which bot or reviewer comments were addressed?
No PR comments yet. Local autoreview findings were addressed before PR creation.