fix(doctor): skip legacy main transcript check for SQLite-owned sessions (#119940)

* fix(doctor): skip legacy main transcript check for SQLite-owned sessions

After the SQLite session import, the main session's legacy .jsonl is
archived and 'sessions cleanup' prunes it as unreferenced, but doctor
still warned 'Main session transcript missing' because the main-session
check required the legacy file. The sibling recent-session check already
skips SQLite-owned keys; apply the same ownership guard to the main
session so doctor and cleanup agree. (#119926)

* style(doctor): condense SQLite ownership comment

Co-authored-by: 李琪0668001400 <li.qi16@xydigit.com>

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
licheer-zte
2026-08-09 04:24:02 +08:00
committed by GitHub
parent 8afd126577
commit bb23b6b5ca
2 changed files with 8 additions and 1 deletions
@@ -617,6 +617,10 @@ describe("doctor state integrity oauth dir checks", () => {
const cfg: OpenClawConfig = {};
setupSessionState(cfg, process.env, process.env.HOME ?? "");
const storePath = resolveStorePath(cfg.session?.store, { agentId: "main" });
await upsertSessionEntry(
{ agentId: "main", sessionKey: "agent:main:main", storePath },
{ sessionId: "sqlite-main-session", updatedAt: Date.now() },
);
await upsertSessionEntry(
{ agentId: "main", sessionKey: "agent:main:sqlite-only", storePath },
{ sessionId: "sqlite-only-session", updatedAt: Date.now() },
@@ -628,6 +632,7 @@ describe("doctor state integrity oauth dir checks", () => {
});
expect(stateIntegrityText()).not.toContain("recent sessions are missing transcripts");
expect(stateIntegrityText()).not.toContain("Main session transcript missing");
});
it("does not auto-archive orphan transcripts from non-interactive repair mode", async () => {
+3 -1
View File
@@ -1474,7 +1474,9 @@ export async function noteStateIntegrity(
const mainKey = resolveMainSessionKey(cfg);
const mainEntry = store[mainKey];
if (mainEntry?.sessionId) {
// SQLite-owned transcripts live in the agent DB after import.
// Do not require the archived legacy JSONL for those sessions.
if (mainEntry?.sessionId && !sqliteSessionKeys.has(mainKey)) {
const transcriptPath = resolveSessionFilePath(
mainEntry.sessionId,
mainEntry,