Skip to content

fix: archive old transcript files on /new and /reset#14949

Merged
gumadeiras merged 5 commits intoopenclaw:mainfrom
mcaxtr:fix/14869-transcript-cleanup
Feb 13, 2026
Merged

fix: archive old transcript files on /new and /reset#14949
gumadeiras merged 5 commits intoopenclaw:mainfrom
mcaxtr:fix/14869-transcript-cleanup

Conversation

@mcaxtr
Copy link
Copy Markdown
Member

@mcaxtr mcaxtr commented Feb 12, 2026

Fixes #14869

Summary

  • Extract shared archiveSessionTranscripts() helper in session-utils.fs.ts that iterates transcript candidates and archives each with archiveFileOnDisk()
  • Archive old transcript in sessions.reset RPC handler (TUI/webchat path) after creating the new session entry
  • Archive old transcript in initSessionState() (chat channel path) after the session store update when /new or /reset triggers a reset
  • Refactor sessions.delete RPC handler to use the same shared helper (deduplication)

Test plan

  • archiveSessionTranscripts() archives existing transcript file and returns archived path
  • archiveSessionTranscripts() archives transcript found via explicit sessionFile path
  • archiveSessionTranscripts() returns empty array when no transcript files exist
  • archiveSessionTranscripts() skips nonexistent files and archives only existing ones
  • All 4 tests fail before the fix, pass after
  • pnpm build && pnpm check passes

Greptile Overview

Greptile Summary

This PR adds a shared archiveSessionTranscripts() helper to archive on-disk session transcript .jsonl files and wires it into the session reset flows (RPC sessions.reset and chat-channel /new//reset handling) so old transcripts don’t accumulate. It also refactors sessions.delete to use the same helper, keeping transcript archiving behavior consistent across reset and delete paths.

The helper builds transcript path candidates from the session store location, explicit sessionFile, agent transcript location, and the fallback ~/.openclaw/sessions path, then best-effort renames any existing files to .<reason>.<timestamp> suffixes. Tests were added to validate the helper’s behavior across existing/missing files and explicit sessionFile paths.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • Changes are localized, use synchronous best-effort file renames for transcript archiving, and are covered by new unit tests; I did not find any introduced functional regressions in the reviewed paths.
  • No files require special attention

Last reviewed commit: 00b6333

Context used:

  • Context from dashboard - CLAUDE.md (source)
  • Context from dashboard - AGENTS.md (source)

@mcaxtr mcaxtr force-pushed the fix/14869-transcript-cleanup branch 2 times, most recently from 757664e to 05b3a98 Compare February 13, 2026 14:44
@mcaxtr mcaxtr force-pushed the fix/14869-transcript-cleanup branch 2 times, most recently from 27e7309 to c6bf7fc Compare February 13, 2026 16:20
@gumadeiras gumadeiras self-assigned this Feb 13, 2026
@gumadeiras gumadeiras force-pushed the fix/14869-transcript-cleanup branch from c6bf7fc to 98d422b Compare February 13, 2026 19:44
@gumadeiras gumadeiras force-pushed the fix/14869-transcript-cleanup branch from 98d422b to 2e72a64 Compare February 13, 2026 19:45
@gumadeiras gumadeiras force-pushed the fix/14869-transcript-cleanup branch from 92ba340 to 892fe79 Compare February 13, 2026 19:48
@gumadeiras gumadeiras force-pushed the fix/14869-transcript-cleanup branch from 210d484 to 4724df7 Compare February 13, 2026 19:55
@gumadeiras gumadeiras merged commit 31537c6 into openclaw:main Feb 13, 2026
@gumadeiras
Copy link
Copy Markdown
Member

gumadeiras commented Feb 13, 2026

Merged via squash.

Valeu @mcaxtr!

@mcaxtr mcaxtr deleted the fix/14869-transcript-cleanup branch February 13, 2026 23:14
GwonHyeok pushed a commit to learners-superpumped/openclaw that referenced this pull request Feb 15, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4724df7
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 1, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4724df7
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras

(cherry picked from commit 31537c6)

# Conflicts:
#	CHANGELOG.md
#	src/auto-reply/reply/session-resets.test.ts
#	src/gateway/server-methods/sessions.ts
#	src/gateway/session-utils.fs.test.ts
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 3, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4724df7
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras

(cherry picked from commit 31537c6)

# Conflicts:
#	CHANGELOG.md
#	src/auto-reply/reply/session-resets.test.ts
#	src/gateway/server-methods/sessions.ts
#	src/gateway/session-utils.fs.test.ts
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4724df7
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4724df7
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4724df7
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4724df7
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: /new and /reset commands don't delete transcript files, causing context bloat

2 participants