refactor: add session reset delete lifecycle seam#93659
Conversation
|
ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed June 16, 2026, 11:01 AM ET / 15:01 UTC. Summary PR surface: Source +206, Tests +116. Total +322 across 5 files. Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. Stored data model Merge readiness This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict. Risk before merge
Maintainer options:
Next step before merge
Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 75cdf22152de. Evidence reviewedPR surface: Source +206, Tests +116. Total +322 across 5 files. View PR surface stats
What I checked:
Likely related people:
How this review workflow works
|
|
Holding this one open rather than forcing it through the batch. It is still a draft, currently conflicts with main, and changes the session-storage lifecycle boundary broadly enough that it needs the owning maintainer's continuation and architecture proof before landing. |
0f99605 to
0911eb4
Compare
0911eb4 to
57b810c
Compare
* refactor: add session reset delete lifecycle seam * refactor: expose session lifecycle seam through accessor
* refactor: add session reset delete lifecycle seam * refactor: expose session lifecycle seam through accessor
Summary
Adds a narrow storage-neutral session accessor boundary for gateway session reset/delete lifecycle mutations so entry changes and transcript artifact transitions are represented as one backend-owned operation.
Why
The SQLite migration needs reset/delete to be expressed as logical storage operations instead of gateway code mutating the session entry and then separately archiving or creating transcript artifacts. This PR keeps the current file-backed behavior while giving the future SQLite adapter a single operation to implement transactionally.
Changes
session-accessor.tsstore.tsTesting
node scripts/run-vitest.mjs src/config/sessions/store.session-lifecycle-mutation.test.ts src/gateway/server.sessions.reset-hooks.test.ts src/gateway/server.sessions.reset-cleanup.test.ts src/gateway/server.sessions.delete-lifecycle.test.ts test/scripts/check-session-accessor-boundary.test.tsnode scripts/check-session-accessor-boundary.mjsgit diff --check upstream/main...HEADnode scripts/run-tsgo.mjs --noEmit --pretty falsenode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/config/sessions.ts src/config/sessions/session-accessor.ts src/config/sessions/store.runtime.ts src/config/sessions/store.session-lifecycle-mutation.test.ts src/config/sessions/store.ts src/gateway/server-methods/sessions.ts src/gateway/session-reset-service.tspnpm exec oxfmt --check --threads=1 src/config/sessions.ts src/config/sessions/session-accessor.ts src/config/sessions/store.runtime.ts src/config/sessions/store.session-lifecycle-mutation.test.ts src/config/sessions/store.ts src/gateway/server-methods/sessions.ts src/gateway/session-reset-service.ts scripts/check-session-accessor-boundary.mjs test/scripts/check-session-accessor-boundary.test.ts/Users/phaedrus/Projects/prompts/skills/autoreview/scripts/autoreview --mode branch --base upstream/main --no-web-search --thinking codex=lowpnpm buildReal behavior proof
Behavior addressed: Gateway
sessions.resetandsessions.deletenow route persisted entry mutation plus transcript artifact transition through the storage-neutral session lifecycle accessor seam while preserving file-backed behavior.Real environment tested: local live gateway from
/Users/phaedrus/Projects/clawdbotat57b810c7c60cecfdabd3773575e54f573c2a98d7(pnpm openclaw --versionreportedOpenClaw 2026.6.8 (57b810c)) on port 18789.Exact steps or command run after this patch:
Evidence after fix:
sessions.resetchangedagent:main:dashboard:path3-proof-resetfrom session ide7aa69e2-89cd-4c9a-b26c-6cf574903406tod53d7988-268e-4477-9674-0c9d74017d89;sessions.jsonpointed that key at/Users/phaedrus/.openclaw/agents/main/sessions/d53d7988-268e-4477-9674-0c9d74017d89.jsonl; the old transcript was archived ase7aa69e2-89cd-4c9a-b26c-6cf574903406.jsonl.reset.2026-06-17T16-26-31.278Z; the new transcript header contained idd53d7988-268e-4477-9674-0c9d74017d89.sessions.deleteremovedagent:main:dashboard:path3-proof-deleteand archived96c88b65-00a2-4b9e-9390-1bda35f90eee.jsonl.deleted.2026-06-17T16-26-31.379Z. Cleanup then deleted the reset proof session throughsessions.delete, removed only the proof transcript archives, and verified both proof keys were absent fromsessions.json. Final/readyzreturned{"ready":true,"failing":[]}.Observed result after fix: The live gateway successfully performed reset and delete through the new lifecycle seam; persisted session metadata, reset transcript header creation, transcript archive naming, delete removal, and cleanup all matched the existing file-backed behavior.
What was not tested: future SQLite adapter implementation, doctor/import migration, runtime storage flip, SDK compatibility surfaces, runtime JSON fallback or dual-read behavior, and off-machine Crabbox/Testbox proof.
Current Review State
Ready for review. Latest head
57b810c7c6is rebased onto currentupstream/main; SQLite implementation remains a separate 3.2 adapter/foundation concern.Related #88838.