refactor: add gateway sessions.create lifecycle seam#93691
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 16, 2026, 7:45 PM ET / 23:45 UTC. Summary PR surface: Source +58, Tests +122, Other +53. Total +233 across 6 files. Reproducibility: not applicable. This is an internal migration/refactor PR, so the review path is source inspection plus focused accessor/gateway/boundary coverage rather than a failing current-main bug reproduction. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land a refreshed exact-head version that keeps gateway creation on the accessor seam, preserves current file-backed JSON/JSONL behavior, and leaves the SQLite transaction implementation tracked by #88838. Do we have a high-confidence way to reproduce the issue? Not applicable. This is an internal migration/refactor PR, so the review path is source inspection plus focused accessor/gateway/boundary coverage rather than a failing current-main bug reproduction. Is this the best way to solve the issue? Yes, mostly. Moving gateway AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f94a2506d218. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +58, Tests +122, Other +53. Total +233 across 6 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
|
64ff5e3 to
02334d4
Compare
02334d4 to
0d3c543
Compare
…5651) (#1038) * refactor(agents): hide update plan gating helper * fix(e2e): keep live plugin pack paths local * refactor(agents): drop mcp fetch type re-export * refactor(agents): hide mcp oauth redirect classifier * refactor(agents): remove catalog browse timer test hooks * refactor(agents): hide execution contract resolver * fix(e2e): reject unsafe Docker pack names * clawdbot-d02.1.9.1.31: add sessions.create lifecycle seam (openclaw#93691) * refactor(agents): hide assistant stream delivery types * refactor(agents): hide message handler helpers * fix: clean agent lint failures * refactor(agents): hide compaction reconcile wrapper * refactor(agents): hide context cache reset helper * refactor(agents): hide copilot routing constants * refactor(agents): hide subagent outcome helpers * refactor(agents): hide tool mutation helpers * refactor(agents): hide transport error extractor * refactor(agents): remove video task status wrappers * refactor(agents): hide custom api source id helper * refactor(agents): hide docs path helpers * fix(codex): sync app-server dynamic tool protocol * refactor(agents): hide timeout seconds helper * fix(gemini): bridge OAuth profiles into CLI runtime * fix: persist Gemini CLI auth homes * fix: preserve Gemini CLI project binding * fix: scope CLI auth epochs to agent stores * fix: fail closed on unstaged Gemini profiles * fix: preserve runtime auth alias scope * fix: keep CLI auth fallback scoped * fix: accept Google API keys for Gemini CLI * fix: honor Google auth order for Gemini CLI * test: type Gemini CLI auth refresh mock * fix: forward pinned Gemini CLI auth for validation * fix: bind Gemini CLI epochs to profile homes * fix: keep CLI prepare credentials private * fix: ignore stale auto auth for Gemini CLI * fix: stage resolved Gemini OAuth profiles * fix: clear ambient Google ADC for Gemini CLI * fix: stage adopted Gemini OAuth credentials * fix: isolate Gemini CLI system auth settings * fix: enforce Gemini CLI profile auth precedence * fix: keep Gemini CLI system settings per run * fix: clean Gemini bundle settings on prepare failure * fix: preserve ambient Gemini system auth * fix: honor inherited Gemini auth policy * test: fix Gemini CLI auth test types * test: narrow Gemini CLI setup agent dir * fix: pass prepared CLI env to spawned process * fix: expose CLI runtime env diagnostics * fix: load staged Gemini CLI auth profiles * fix: log Gemini CLI runtime env activation * fix: select CLI auth profile for runtime prep * fix: keep CLI env diagnostics opt-in * fix: align Gemini CLI home path * fix: add CLI empty response diagnostics * fix: parse Gemini CLI stream output * fix: allow Gemini CLI file edits * docs: update Gemini CLI backend defaults * fix: use OpenClaw temp root for Gemini CLI settings * fix: clean up Gemini CLI backend checks * fix: keep Gemini CLI auth out of warmup * refactor(agents): hide cleanup timeout helpers * refactor(agents): hide stale run cutoff * refactor(agents): hide compaction timeout internals * refactor(agents): remove stale compaction grace helper * refactor(agents): hide idle timeout default * refactor(plugins): hide cleanup timeout internals * refactor(qqbot): hide response timeout default * refactor(feishu): hide timeout config type * refactor(browser): hide cdp reachability defaults * docs: add Gemini CLI auth changelog entry * refactor(agents): hide context window thresholds * refactor(agents): hide fallback skip cache internals * fix(agents): tolerate uncloneable adjusted tool params * refactor(cli): hide compile cache and media internals * fix(slack): preserve completed native progress titles * refactor(acp): hide test helper internals * refactor(tests): hide helper-only types * refactor(tests): hide gateway state helper types * fix(deps): remediate Dependabot alerts (openclaw#93857) Merged via squash. Prepared head SHA: 51ece24 Co-authored-by: vincentkoc <[email protected]> Co-authored-by: vincentkoc <[email protected]> Reviewed-by: @vincentkoc * refactor(commands): hide doctor harness mocks * refactor(commands): hide doctor e2e mock internals * refactor(commands): hide doctor service install mock * refactor(commands): hide gateway readiness types * refactor(commands): hide health summary internals * refactor(commands): trim health type reexports * refactor(commands): trim migrate option reexports * refactor(commands): trim backup type exports * test(codex): refresh dynamic tool snapshots * refactor(commands): hide onboarding install result * fix(ui): harden chromium test runner * refactor(commands): hide status task helper types * refactor(commands): trim setup type reexports * fix(slack): recognize MiniMax mm: namespaced reasoning tags in monitor preview (openclaw#93874) * refactor(commands): hide doctor repair helper types * feat(providers): add ClawRouter managed proxy * docs(providers): document ClawRouter integration * chore(providers): align ClawRouter package version * fix(providers): preserve ClawRouter native replay policies * chore(deps): register ClawRouter workspace * fix(providers): consume canonical ClawRouter catalog field * fix(providers): restore ClawRouter native runtime routes * fix(providers): isolate ClawRouter runtime credentials * fix(providers): cover ClawRouter runtime auth paths * fix(providers): preserve ClawRouter catalog model ids * fix(providers): require runnable ClawRouter Gemini routes * fix(providers): route ClawRouter direct streams * fix(providers): apply wrappers to direct streams * fix(providers): wrap direct fallback streams * fix(providers): compose ClawRouter native auth * fix(providers): align ClawRouter package boundary * fix(sdk): refresh plugin api baseline * refactor(commands): hide doctor utility types * refactor(commands): hide doctor state helper types * refactor(commands): trim doctor probe type exports * refactor(commands): trim setup barrel type exports * fix(macos): preserve approvals migration data (openclaw#93880) Merged via squash. Prepared head SHA: a8a0dd0 Co-authored-by: vincentkoc <[email protected]> Co-authored-by: vincentkoc <[email protected]> Reviewed-by: @vincentkoc * refactor(flows): hide setup helper types * refactor(commands): trim custom provider type reexports * fix(cron): reject invalid absolute timestamps (openclaw#93903) * fix(cron): reject invalid absolute timestamps * fix(cron): preserve ISO end of day --------- Co-authored-by: Vincent Koc <[email protected]> * refactor(commands): hide custom provider helper types * fix(update): use configured npm registry for update metadata (openclaw#93879) Merged via squash. Prepared head SHA: ae8bbb0 Co-authored-by: vincentkoc <[email protected]> Co-authored-by: vincentkoc <[email protected]> Reviewed-by: @vincentkoc * refactor(commands): trim status type exports * refactor(commands): hide doctor helper types * refactor(commands): hide migrate helper types * refactor(config): hide local helper types * revert(providers): remove ClawRouter provider * refactor(config): hide session helper types * refactor(gateway): hide local helper types * refactor(gateway): hide websocket helper types * refactor(infra): hide local helper types --------- Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: Josh Lehman <[email protected]> Co-authored-by: Shakker <[email protected]> Co-authored-by: Jason O'Neal <[email protected]> Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: Alix-007 <[email protected]> Co-authored-by: ronan-dandelion-cult <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Summary
Add a narrow file-backed session accessor operation for gateway
sessions.createlifecycle creation. The gateway now delegates session entry creation, transcript header initialization, rollback on transcript failure, and normalizedsessionFilepersistence tocreateSessionEntryWithTranscript(...)while keeping key resolution, model validation, command/plugin hooks, initial chat send, responses, and session-change events in the gateway layer.Tracker
Part of the Path 3 session/transcript SQLite migration tracker: #88838
Scope
createSessionEntryWithTranscript(...)tosrc/config/sessions/session-accessor.ts.sessions.createlifecycle storage through that accessor seam.Out of scope: SQLite schema/runtime flip, reset/delete lifecycle work, public plugin SDK semantic changes, doctor migrations, and runtime fallback/dual-read behavior.
SQLite Follow-up
The SQLite adapter should implement
createSessionEntryWithTranscript(...)as one transaction: create or update the session row, initialize transcript/header identity for the resulting session id, persist normalized transcript identity, and fail without leaving a partial session entry when transcript initialization fails.Verification
node scripts/run-vitest.mjs src/config/sessions/session-accessor.test.ts src/gateway/server.sessions.create.test.ts test/scripts/check-session-accessor-boundary.test.tsnode scripts/check-session-accessor-boundary.mjsgit diff --checknode scripts/run-oxlint.mjs scripts/check-session-accessor-boundary.mjs src/config/sessions/session-accessor.ts src/config/sessions/session-accessor.test.ts src/gateway/server-methods/sessions.ts src/gateway/server.sessions.create.test.ts test/scripts/check-session-accessor-boundary.test.tsnode scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfonode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.src.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/test-src.tsbuildinfo.agents/skills/autoreview/scripts/autoreview --mode local --no-web-search --thinking codex=lowReal behavior proof
Behavior addressed:
sessions.createon a live gateway creates a session entry and initializes its transcript through the new accessor-owned lifecycle path.Real environment tested: Local live OpenClaw gateway running from
/Users/phaedrus/Projects/clawdbotafter building the PR and restarting the LaunchAgent-backed gateway on PR head02334d4afcd537d0f6072dde42ceb5ed5eb0f771. The PR was later rebased conflict-free to0d3c543dc36630e67c6319b77f942941de263d12; the rebased branch keeps the same session lifecycle patch and passed focused tests plus Crabbox proof.Exact steps or command run after this patch:
Evidence after fix:
pnpm openclaw --versionreportedOpenClaw 2026.6.9 (02334d4), and the gateway/readyzand/healthzendpoints were ready/live. Thesessions.creategateway call returnedokwith keyagent:main:proof-93691-session-create, session id0a779131-9c42-4fcb-8a8c-cd75eb503770, and transcript file/Users/phaedrus/.openclaw/agents/main/sessions/0a779131-9c42-4fcb-8a8c-cd75eb503770.jsonl. Follow-upsessions.listandsessions.describefound the created session, and the persisted session row plus transcript JSONL header matched that session id. Cleanup viasessions.deletereturnedok/deletedand archived the transcript.Observed result after fix: Live gateway session creation produced a persisted session entry and initialized transcript identity through the patched
sessions.createlifecycle path; no partial session entry was left after cleanup.What was not tested: This live proof used the current file-backed store on the local macOS gateway. It did not test the future SQLite adapter/runtime flip, reset lifecycle work, public plugin SDK semantic changes, doctor migrations, or dual-read/fallback behavior. The post-rebase head
0d3c543dc36630e67c6319b77f942941de263d12was not reloaded onto the live gateway, but it was covered by focused tests and Crabbox after the conflict-free rebase.