openclaw - ✅(Solved) Fix [Bug]: TUI /reset can keep reusing a stale generated transcript filename after sessions created by older reset behavior [1 pull requests, 1 comments, 2 participants]

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…
GitHub stats
openclaw/openclaw#77770Fetched 2026-05-06 06:21:45
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Author
Timeline (top)
labeled ×2commented ×1cross-referenced ×1

After upgrading from an older version where /reset reused the generated transcript filename, subsequent TUI /reset calls can continue writing new session transcripts to the old sessionId-based .jsonl filename.

Root Cause

After upgrading from an older version where /reset reused the generated transcript filename, subsequent TUI /reset calls can continue writing new session transcripts to the old sessionId-based .jsonl filename.

Fix Action

Fixed

PR fix notes

PR #77772: fix(gateway): rotate reset transcript paths

Description (problem / solution / changelog)

Summary

  • Problem: TUI /reset created a new logical session but continued reusing the previous generated transcript path in some cases.
  • Why it matters: The active transcript filename could appear to belong to an old session, making session files, reset archives, and trajectory-related artifacts harder to reason about.
  • What changed: Reset now rotates generated transcript paths to the new session id, while preserving explicitly custom transcript paths.
  • What did NOT change (scope boundary): This does not add migration or automatic repair for already-stale historical session entries created by older behavior.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #77770
  • Related #
  • This PR fixes a bug or regression

Real behavior proof (required for external PRs)

External contributors must show after-fix evidence from a real OpenClaw setup. Unit tests, mocks, lint, typechecks, snapshots, and CI are supplemental only.

  • Behavior or issue addressed: TUI /reset should create a fresh session whose generated transcript path is based on the new session id.
  • Real environment tested: Local macOS development checkout, Gateway mode TUI.
  • Exact steps or command run after this patch:
    1. Start the Gateway with pnpm openclaw gateway run.
    2. Start the TUI with pnpm openclaw tui.
    3. Send a normal message.
    4. Run /reset.
    5. Inspect the agent sessions directory.
  • Evidence after fix: In a clean session state, /reset produced a new active transcript named after the new session id, while the old transcript was archived as .jsonl.reset.<timestamp>.
  • Observed result after fix: The new active transcript path changed from <old-session-id>.jsonl to <new-session-id>.jsonl.
  • What was not tested: Automatic repair of already-stale historical session entries where sessionFile had already diverged from the current logical sessionId.
  • Before evidence: Existing affected state showed reset archive files and the active transcript sharing the same stale basename, for example <old-session-id>.jsonl.reset.<timestamp> and <old-session-id>.jsonl.

Root Cause (if applicable)

  • Root cause: The reset path generated a fresh logical sessionId, but passed the previous sessionFile back into session file resolution. For generated transcript paths, that preserved the old filename instead of deriving a path from the new session id.
  • Missing detection / guardrail: Tests covered reset metadata behavior but did not assert that generated transcript filenames rotate with the new session id.
  • Contributing context (if known): Earlier reset behavior appears to have changed over time between always generating fresh transcript paths and preserving explicit transcript paths. The implementation did not distinguish generated transcript paths from custom explicit paths.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/gateway/server.sessions.reset-models.test.ts, plus shared helper coverage in src/config/sessions/session-file-rotation.test.ts.
  • Scenario the test should lock in: Given a session entry with a generated transcript path matching the old session id, sessions.reset creates a new session id and stores a transcript path using the new session id.
  • Why this is the smallest reliable guardrail: The bug lives at the Gateway reset/session-store boundary, so a focused sessions.reset test verifies the actual persisted entry without requiring a full TUI run.
  • Existing test that already covers this (if any): None before this change.
  • If no new test is added, why not: N/A.

User-visible / Behavior Changes

TUI /reset now uses a new generated transcript filename for the new session instead of continuing to write to the old generated filename.

Diagram (if applicable)

Before:
/reset -> new sessionId -> old generated sessionFile basename reused

After:
/reset -> new sessionId -> generated sessionFile basename rewritten -> new transcript path

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Local Node/pnpm development checkout
  • Model/provider: Not provider-specific
  • Integration/channel (if any): TUI via Gateway WebSocket
  • Relevant config (redacted): Default main agent session store under the local OpenClaw state directory

Steps

  1. Start the Gateway with pnpm openclaw gateway run.
  2. Start the TUI with pnpm openclaw tui.
  3. Send a normal message, then run /reset.
  4. Inspect the active transcript file in the agent sessions directory.

Expected

  • The old transcript is archived as <old-session-id>.jsonl.reset.<timestamp>.
  • The new active transcript is written to <new-session-id>.jsonl.

Actual

  • Before this fix, the new active transcript could continue using the old generated filename.
  • After this fix, clean session state resets use a new transcript filename based on the new session id.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: Clean TUI/Gateway reset flow creates a new session and rotates the generated transcript filename.
  • Edge cases checked: Generated default transcript paths, relative generated transcript paths, and custom subdirectory transcript paths.
  • What you did not verify: Automatic migration or repair of historical session entries already polluted by older reset behavior.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: Custom transcript paths could be accidentally rewritten.
    • Mitigation: The rewrite only applies to recognized generated transcript filename patterns, and custom subdirectory transcript paths are covered by tests.

Changed files

  • src/auto-reply/reply/session-updates.ts (modified, +1/-32)
  • src/config/sessions.ts (modified, +1/-0)
  • src/config/sessions/session-file-rotation.test.ts (added, +97/-0)
  • src/config/sessions/session-file-rotation.ts (added, +44/-0)
  • src/gateway/server.sessions.reset-models.test.ts (modified, +131/-0)
  • src/gateway/session-reset-service.ts (modified, +29/-1)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

After upgrading from an older version where /reset reused the generated transcript filename, subsequent TUI /reset calls can continue writing new session transcripts to the old sessionId-based .jsonl filename.

Steps to reproduce

  1. Run pnpm openclaw tui
  2. Send a normal message.
  3. Run /reset.
  4. Send a normal message in new session.
  5. Inspect the agent sessions directory.

Expected behavior

Based on earlier observed behavior and clean-state behavior after the current fix, /reset should create a fresh logical session and use a transcript filename based on the new sessionId, such as <new-session-id>.jsonl.

Actual behavior

The old transcript is archived as <old-filename>.jsonl.reset.<timestamp>, but the new active transcript continues to use the same stale generated filename, for example cc420d76-5fab-465c-8b8e-4415b9fab87e.jsonl, even though the transcript header contains a different new session id.

<img width="1239" height="178" alt="Image" src="https://github.com/user-attachments/assets/2c919075-a046-491c-b3b1-b7b414d11be4" />

OpenClaw version

2026.5.3

Operating system

macOS

Install method

No response

Model

ark/doubao-seed-2-0-pro-260215

Provider / routing chain

openclaw -> TUI

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The issue can be fixed by ensuring that the /reset command generates a new transcript filename based on the new session ID.

Guidance

  • Verify that the sessionId is being updated correctly after the /reset command is executed.
  • Check the code responsible for generating the transcript filename to ensure it uses the new sessionId after a reset.
  • Inspect the agent sessions directory to confirm that a new transcript file is being created with the expected filename format (<new-session-id>.jsonl).
  • Review the logic for archiving the old transcript file to ensure it is not interfering with the generation of the new transcript filename.

Example

No code snippet can be provided without more information about the specific codebase.

Notes

The issue seems to be related to the way the /reset command handles session IDs and transcript filenames. Without more information about the code, it's difficult to provide a more specific solution.

Recommendation

Apply a workaround to ensure that the /reset command generates a new transcript filename based on the new session ID, as this is the expected behavior.

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

Based on earlier observed behavior and clean-state behavior after the current fix, /reset should create a fresh logical session and use a transcript filename based on the new sessionId, such as <new-session-id>.jsonl.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING