Repository navigation
refactor(sessions): use archived projection for maintenance - #123896
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 8:20 PM ET / August 15, 2026, 00:20 UTC. ClawSweeper reviewWhat this changesThe PR replaces the SQLite stale-session probe’s raw JSON predicate with the typed Merge readinessNo blocking findings. This small maintainer-authored cleanup correctly uses the session projection already owned by the canonical writer and migration path; wait for exact-head CI before merging. Priority: P3 Review scores
Verification
How this fits togetherSQLite session writes invoke maintenance to detect and prune stale, removable sessions. The maintenance probe filters indexed session metadata before loading canonical session records and preserving archived or otherwise protected history. flowchart LR
A[Session write] --> B[Session node writer]
B --> C[Archived timestamp projection]
C --> D[Maintenance probe]
D --> E[Load eligible sessions]
E --> F[Prune stale rows]
E --> G[Preserve archived history]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -8. Total -8 across 1 file. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving query refactor; current owner-boundary tests define the relevant stale-pruning and archived-history invariants. Is this the best way to solve the issue? Yes. Reading the promoted column follows the canonical writer and migration contract, while the alternative keeps maintenance coupled to raw SQLite JSON parsing. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ad508a51c285. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Related: #123081
What Problem This Solves
The SQLite stale-session probe added in #123081 queried
archivedAtby parsing the canonical JSON payload with a raw SQLiteCASEexpression, even though the session schema already promotes and backfills that value into the typedarchived_atquery column. This left routine maintenance code harder to read and unnecessarily dependent on SQLite JSON1 behavior.Why This Change Was Made
Use the existing
session_nodes.archived_atprojection through Kysely's typed query builder. The projection is maintained by the canonical session write and migration paths; malformed entry payloads remain isolated by the existing row parser.This is an AI-assisted, maintainer-requested cleanup follow-up to #123081.
User Impact
No intended behavior change. Archived sessions remain protected from stale-session pruning, while the maintenance query becomes smaller and follows the schema's promoted-column contract.
Evidence
oxfmt,oxlint, andgit diff --checkpassed.