Repository navigation
fix(doctor): stop flagging lazily-created session dirs as missing - #130704
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
August 27, 2026 04:53
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 27, 2026
…enclaw#130704) * fix(doctor): stop flagging lazily-created session dirs as missing * test(doctor): split state-integrity suite to satisfy max-lines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
openclaw doctorreports a false alarm on every fresh profile onboarded through the gateway RPC path (openclaw.setup.activate— the path the Mac app uses):The profile is healthy: sessions and transcripts are SQLite-backed in
agents/main/agent/openclaw-agent.sqlite, agent turns work, restart persistence works. Theagents/<id>/sessionsdirectory simply has not been needed yet. A CRITICAL that fires on the default out-of-box path erodes trust in doctor (severity miscalibration on the default path).Why This Change Was Made
The check's invariant is stale. Since the SQLite transcript migration:
src/config/sessions/session-accessor.sqlite-archive.ts:172and:245(fs.mkdirSync(archiveDirectory, { recursive: true, mode: 0o700 })before publishing transcript archives;resolveSqliteTranscriptArchiveDirectorymaps the agent DB path toagents/<id>/sessions).listUsageCountedTranscriptFileStatsinsrc/infra/session-cost-usage-collection.tsreturns[]).setup/onboardflows scaffold the directory eagerly (src/commands/setup.ts,src/commands/onboard-helpers.ts); the gatewaysetup.activateRPC does not and must not need to.The fix removes the missing-dir finding (structured
missing-runtime-dirand legacy interactive CRITICAL + create prompt) forSessions dirandSession store dir. Themissing-runtime-dirlabel union is narrowed to"OAuth dir"so the removed states are unrepresentable. Existing-but-unwritable session directories are still flagged (runtime-dir-not-writable), and OAuth dir behavior is unchanged (it has its ownshouldRequireOAuthDirgate and lifecycle).Production LOC delta: net -4 (+16/-20 in
src/commands/doctor-state-integrity.ts); tests +70.User Impact
Operators who onboard via the Mac app (or any gateway-RPC activation) no longer see a bogus CRITICAL in
doctoron a healthy fresh install. Real problems (unwritable existing dirs, missing OAuth dir when pairing channels are configured) are still reported exactly as before.Evidence
openclaw.setup.activate(codex-cli, inference verified live) → real agent turns →doctorprinted the false CRITICAL whilesessions.listshowed the healthy SQLite store (1 session, 8 transcript events).src/commands/doctor-state-integrity.test.ts: fresh RPC-onboarded profile produces no session-related structured issue, no CRITICAL warning, no create prompt (both fail on pre-fix code); existing-but-unwritable sessions dir still producesruntime-dir-not-writable; OAuth tests unchanged.node scripts/run-vitest.mjs src/commands/doctor-state-integrity: 55 tests green (re-run after rebase onto latestorigin/main).node scripts/check-changed.mjs -- <changed files>: guards, formatting, dead-export scan, production typecheck, focused tests green. Autoreview: clean.