openclaw - 💡(How to fix) Fix [Bug]: `doctor --fix --yes` reports orphan transcripts but never archives them (requiresInteractiveConfirmation blocks --yes path)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

openclaw doctor --fix (and --fix --non-interactive --yes, and --repair --yes) reports orphan transcript files in the State Integrity section but does not archive them, even when all confirmation flags are supplied. The flag advertises the action; the action is never performed.

This makes the system-health-check alert "doctor --fix did not reduce orphan count" a permanent false-positive whenever orphans accumulate, and means orphans have to be cleaned up manually.

Error Message

doctor reports only the main .jsonl orphan count but doesn't surface that each orphan typically has a .trajectory.jsonl and a .trajectory-path.json side-file that accumulate the same way. With 1537 orphans on my system, that's ~4600 stale files, not 1537. monthly-cleanup.sh scripts in workspace setups often only sweep *.deleted.*, so the side-files persist indefinitely until manually handled. Worth either (a) having doctor warn about them too, or (b) renaming the side-files alongside their parent during archive.

Root Cause

dist/doctor-state-integrity-BPSD4cAx.js, around lines 1075-1102:

if (orphanTranscriptPaths.length > 0 && !suppressOrphanTranscriptWarning) {
  // ...
  warnings.push([...]);
  if (await prompter.confirmRuntimeRepair({
    message: `Archive ${orphanCount} in ${displaySessionsDir}? ...`,
    initialValue: false,
    requiresInteractiveConfirmation: true   // <-- this
  })) {
    let archived = 0;
    // archive loop
  }
}

requiresInteractiveConfirmation: true causes confirmRuntimeRepair to return false in non-interactive mode regardless of --yes / --non-interactive / --fix. So the archive loop is unreachable in any scripted invocation.

Other repair sections in doctor-state-integrity use requiresInteractiveConfirmation: false (or omit it) and successfully fire with --fix --yes. Only the orphan-transcript path is gated this way.

Fix Action

Workaround

Manual archive using doctor's naming convention:

SDIR=~/.openclaw/agents/main/sessions
TS=$(date +%s%3N)
REF=$(mktemp)
jq -r '.[] | .sessionId // empty' "$SDIR/sessions.json" | sort -u > "$REF"
find "$SDIR" -maxdepth 1 -name "*.jsonl" \
  ! -name "*.deleted.*" ! -name "*.lock" ! -name "*.trajectory*" -printf "%f\n" \
  | awk -F'.jsonl' '{print $1}' \
  | grep -vxF -f "$REF" \
  | while read uuid; do
      for ext in .jsonl .trajectory.jsonl .trajectory-path.json; do
        [ -f "$SDIR/$uuid$ext" ] && mv "$SDIR/$uuid$ext" "$SDIR/$uuid$ext.deleted.$TS"
      done
    done
rm -f "$REF"

(Also handles the .trajectory.jsonl / .trajectory-path.json side-files that doctor itself doesn't touch — separate from this bug, but related.)

Code Example

$ openclaw --version
OpenClaw 2026.5.7 (eeef486)

---

if (orphanTranscriptPaths.length > 0 && !suppressOrphanTranscriptWarning) {
  // ...
  warnings.push([...]);
  if (await prompter.confirmRuntimeRepair({
    message: `Archive ${orphanCount} in ${displaySessionsDir}? ...`,
    initialValue: false,
    requiresInteractiveConfirmation: true   // <-- this
  })) {
    let archived = 0;
    // archive loop
  }
}

---

SDIR=~/.openclaw/agents/main/sessions
TS=$(date +%s%3N)
REF=$(mktemp)
jq -r '.[] | .sessionId // empty' "$SDIR/sessions.json" | sort -u > "$REF"
find "$SDIR" -maxdepth 1 -name "*.jsonl" \
  ! -name "*.deleted.*" ! -name "*.lock" ! -name "*.trajectory*" -printf "%f\n" \
  | awk -F'.jsonl' '{print $1}' \
  | grep -vxF -f "$REF" \
  | while read uuid; do
      for ext in .jsonl .trajectory.jsonl .trajectory-path.json; do
        [ -f "$SDIR/$uuid$ext" ] && mv "$SDIR/$uuid$ext" "$SDIR/$uuid$ext.deleted.$TS"
      done
    done
rm -f "$REF"
RAW_BUFFERClick to expand / collapse

Summary

openclaw doctor --fix (and --fix --non-interactive --yes, and --repair --yes) reports orphan transcript files in the State Integrity section but does not archive them, even when all confirmation flags are supplied. The flag advertises the action; the action is never performed.

This makes the system-health-check alert "doctor --fix did not reduce orphan count" a permanent false-positive whenever orphans accumulate, and means orphans have to be cleaned up manually.

Version

$ openclaw --version
OpenClaw 2026.5.7 (eeef486)

Linux WSL2, Ubuntu, Node v24.15.0.

Reproduction

  1. Accumulate orphan transcripts (any host with long-running sessions will eventually have these).
  2. Run openclaw doctor — see "State integrity: Found N orphan transcript files".
  3. Run openclaw doctor --fix --non-interactive --yes (or --repair --yes, or --fix).
  4. Re-run openclaw doctor — same N orphan transcript files reported.

Observed today on my system: 1537 orphans, ran doctor --fix --non-interactive --yes 3 times, all 3 reported the same 1537, no archive. Manually renaming each <sid>.jsonl<sid>.jsonl.deleted.<ts> using doctor's own naming convention cleared the State Integrity section on the next doctor run.

Root cause

dist/doctor-state-integrity-BPSD4cAx.js, around lines 1075-1102:

if (orphanTranscriptPaths.length > 0 && !suppressOrphanTranscriptWarning) {
  // ...
  warnings.push([...]);
  if (await prompter.confirmRuntimeRepair({
    message: `Archive ${orphanCount} in ${displaySessionsDir}? ...`,
    initialValue: false,
    requiresInteractiveConfirmation: true   // <-- this
  })) {
    let archived = 0;
    // archive loop
  }
}

requiresInteractiveConfirmation: true causes confirmRuntimeRepair to return false in non-interactive mode regardless of --yes / --non-interactive / --fix. So the archive loop is unreachable in any scripted invocation.

Other repair sections in doctor-state-integrity use requiresInteractiveConfirmation: false (or omit it) and successfully fire with --fix --yes. Only the orphan-transcript path is gated this way.

Expected behavior

--fix --yes (or --fix --non-interactive) should run the archive loop. requiresInteractiveConfirmation: true should NOT veto explicit --yes. Either:

  • Remove requiresInteractiveConfirmation: true for this specific repair (the rename is reversible — files are renamed, not deleted), OR
  • Make --yes / --non-interactive override requiresInteractiveConfirmation.

Renaming to .deleted.<timestamp> is intentionally low-risk (recoverable), so it's a reasonable candidate for the --yes path.

Workaround

Manual archive using doctor's naming convention:

SDIR=~/.openclaw/agents/main/sessions
TS=$(date +%s%3N)
REF=$(mktemp)
jq -r '.[] | .sessionId // empty' "$SDIR/sessions.json" | sort -u > "$REF"
find "$SDIR" -maxdepth 1 -name "*.jsonl" \
  ! -name "*.deleted.*" ! -name "*.lock" ! -name "*.trajectory*" -printf "%f\n" \
  | awk -F'.jsonl' '{print $1}' \
  | grep -vxF -f "$REF" \
  | while read uuid; do
      for ext in .jsonl .trajectory.jsonl .trajectory-path.json; do
        [ -f "$SDIR/$uuid$ext" ] && mv "$SDIR/$uuid$ext" "$SDIR/$uuid$ext.deleted.$TS"
      done
    done
rm -f "$REF"

(Also handles the .trajectory.jsonl / .trajectory-path.json side-files that doctor itself doesn't touch — separate from this bug, but related.)

Side note (separate from this issue but worth flagging)

doctor reports only the main .jsonl orphan count but doesn't surface that each orphan typically has a .trajectory.jsonl and a .trajectory-path.json side-file that accumulate the same way. With 1537 orphans on my system, that's ~4600 stale files, not 1537. monthly-cleanup.sh scripts in workspace setups often only sweep *.deleted.*, so the side-files persist indefinitely until manually handled. Worth either (a) having doctor warn about them too, or (b) renaming the side-files alongside their parent during archive.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

--fix --yes (or --fix --non-interactive) should run the archive loop. requiresInteractiveConfirmation: true should NOT veto explicit --yes. Either:

  • Remove requiresInteractiveConfirmation: true for this specific repair (the rename is reversible — files are renamed, not deleted), OR
  • Make --yes / --non-interactive override requiresInteractiveConfirmation.

Renaming to .deleted.<timestamp> is intentionally low-risk (recoverable), so it's a reasonable candidate for the --yes path.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: `doctor --fix --yes` reports orphan transcripts but never archives them (requiresInteractiveConfirmation blocks --yes path)