Repository navigation
refactor(sessions): remove file-era transcript runtime - #113233
Conversation
4b816ac to
126f6a0
Compare
126f6a0 to
f5d10af
Compare
810c6f2 to
10a66c5
Compare
2b7971b to
3304c7d
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 27, 2026, 10:27 PM ET / July 28, 2026, 02:27 UTC. ClawSweeper reviewWhat this changesThis PR removes active JSONL transcript runtime behavior, moves persisted sessions to SQLite identity targets, and gives temporary helper runs in-memory transcript managers while preserving doctor import and export artifacts. Merge readinessKeep this PR open for explicit maintainer review. Its SQLite-only direction matches the repository’s runtime-storage policy and the supplied real-session/Testbox evidence is substantive, but this is a 430-file refactor of persisted session identity, plugin SDK compatibility, compaction, exports, and channel-adjacent paths; the protected Priority: P2 Review scores
Verification
How this fits togetherAgent and channel runs create or resume sessions, whose active transcript state is then used by compaction, plugin hooks, status/diagnostics, memory indexing, and trajectory export. The PR replaces file-path-based runtime identity in that shared pipeline with structured SQLite session targets, while retaining legacy files only as import or export artifacts. flowchart LR
A[Agent and channel runs] --> B[Session identity target]
B --> C[SQLite active transcript store]
C --> D[Compaction and session lifecycle]
C --> E[Plugins, memory, and diagnostics]
C --> F[Trajectory and JSONL artifacts]
G[Legacy JSONL files] --> H[Doctor import and export only]
Decision needed
Why: The patch intentionally changes a shared persisted-state contract and preserves selected legacy values for external consumers; whether those compatibility values and rollout semantics are the desired long-term public boundary requires maintainer intent beyond automated checks. Before merge
Agent review detailsSecurityNone. Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase onto current Do we have a high-confidence way to reproduce the issue? Not applicable: this is a refactor PR, not a bug report with a standalone failure to reproduce. The supplied after-fix QA scenario is relevant behavioral proof for the changed session lifecycle. Is this the best way to solve the issue? Unclear: removing file-era runtime state is aligned with the repository’s SQLite-only ownership policy, but the final public compatibility and upgrade boundary needs a maintainer decision after a current-main refresh. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6de4b47203a3. 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
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
636394b to
1f86d72
Compare
What Problem This Solves
OpenClaw still carried a second, partially reachable JSONL transcript runtime beside the canonical SQLite session store. Six ephemeral helper agents were the final JSONL producers, while file repair, rotation, snapshot caches, successor transcripts, and marker-based identity plumbing kept the obsolete branch alive and made session ownership difficult to reason about.
This is a maintainer-requested refactor. AI-assisted implementation and review were used; the code and proof were manually adjudicated against the SQLite ownership contract.
Why This Change Was Made
runtime transcript state is SQLite-only; files are artifacts
The six one-shot helper agents now use
SessionManager.inMemory, JSONL persistence/repair/rotation/snapshot code is deleted, and the embedded runner and public session facade share oneSessionManagertree implementation. Runtime, gateway, worker, cron, BTW, TTS, trajectory, and plugin call sites now carry structured{ agentId, sessionId, sessionKey, storePath }identity instead of rediscovering it from a transcript filename.Deletion inventory
TranscriptFileStateimplementationGitHub PR stats at head
38a4f131d6a: +11,194/-23,603 across 430 files (net -12,409). The non-test production diff remains strongly LOC-negative by thousands.Identity conversion
sessionTargetplus canonical session keySessionEntry.sessionFileremovedCompatibility boundaries retained deliberately:
legacy-sqlite-marker.tsremains only for shipped Plugin SDK consumers, doctor/import, QA/test fixtures, and named artifact paths. It is not a runtime storage fallback.SessionManager.create/openFileadapters remain intest/setup-openclaw-runtime.tsso legacy fixtures keep write-through semantics without reintroducing production file persistence.sessionFileresult/hook values that cannot be removed in bounded Plugin SDK scope carry the canonical session key, not a filesystem path.SessionManager.newSession()rejects in-place identity mutation; high-level AgentSessionctx.newSession()replaces the session instead.truncateAfterCompactionno longer mints or rotates a successor JSONL transcript. Typed context-engine successor session IDs remain supported within the active key/store binding.User Impact
There is no intended visible UI change. Operators get one canonical runtime transcript store, less repair/rotation ambiguity, and lower maintenance risk during compaction, reset, worker, and plugin flows. One-shot helper agents no longer create temporary transcript files.
Legacy transcript files remain importable through doctor, and trajectory export/archive files remain supported product artifacts.
Evidence
Attribution experiment: clean main
2bffce62daapassedsubagent-completion-direct-fallbacktwice (runs30183683527and30183731563), proving the original branch hang was introduced by this refactor rather than pre-existing or environmental.Root cause and fix: SQLite cleanup admission waited on
promptSettledwhen the SDK omitted reacquire, relative to the controller extraction in refactor(agents): split embedded session lock lifecycle #113779. The owning lock boundary now distinguishes terminal abort from yield handoff and admits cleanup without waiting for an event that will never fire.Exact QA branch proof: runs
30184279357and30184337537passed after the fix. A fresh final-head-adjacent Testbox rerun30317351401also passed after a prior checksum-sync attempt failed before task creation because trackedIDENTITY.mdwas absent on the remote box.Final focused proof after the conflict-only rebase: 289 gateway, agent, session-manager, compaction, truncation, and context-engine tests passed. The CI repair then passed 10 targeted legacy-read tests; it preserves strict append validation by seeding malformed historical rows through
SessionManager.fromEntries.Blacksmith Testbox changed gate: run
30315702051, exit 0 in 27m20s; formatting, typecheck, lint, SDK surface, storage, import-cycle, and boundary lanes passed.Blacksmith Testbox build:
pnpm buildpassed in 2m20s with no[INEFFECTIVE_DYNAMIC_IMPORT]warning.Exact-head CI: run
30322406346for38a4f131d6apassed with 0 pending and 0 failures.Review-loop hardening: lease ownership is fenced by incarnation; append paths are failure-atomic; successor rebinding is CAS-safe; structured transcript targets are checked at ownership boundaries; and late prompt/yield cleanup is fenced from newer holders.
Autoreview: the final committed branch review covered five bounded passes. Findings were either fixed or rejected after caller/callee inspection: doctor/import deliberately owns legacy transcript-version migration; the reset-memory hook runs before the reset boundary; and the explicit reset-archive usage-reader claim has no production caller. The final CI-fix patch received a clean uncommitted review.
git diff --checkclean.ClawSweeper rank-up moves
30322406346. Earlier runs exposedruns.tsformatting drift, stale malformed-transcript setup, file-path runner fixtures, and loaded-runner timing flakes; each was fixed at its owning test/format boundary before the final green head.Named follow-ups