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
Contributor

@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 added a commit to mcaxtr/openclaw that referenced this pull request Feb 13, 2026
gumadeiras added a commit to mcaxtr/openclaw that referenced this pull request Feb 13, 2026
@gumadeiras gumadeiras force-pushed the fix/14869-transcript-cleanup branch from 98d422b to 2e72a64 Compare February 13, 2026 19:45
gumadeiras added a commit to mcaxtr/openclaw that referenced this pull request Feb 13, 2026
gumadeiras added a commit to mcaxtr/openclaw that referenced this pull request Feb 13, 2026
gumadeiras added a commit to mcaxtr/openclaw that referenced this pull request Feb 13, 2026
gumadeiras added a commit to mcaxtr/openclaw that referenced this pull request Feb 13, 2026
gumadeiras added a commit to mcaxtr/openclaw that referenced this pull request Feb 13, 2026
@gumadeiras gumadeiras force-pushed the fix/14869-transcript-cleanup branch from 92ba340 to 892fe79 Compare February 13, 2026 19:48
gumadeiras added a commit to mcaxtr/openclaw that referenced this pull request Feb 13, 2026
gumadeiras added a commit to mcaxtr/openclaw that referenced this pull request Feb 13, 2026
@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!

zhangyang-crazy-one pushed a commit to zhangyang-crazy-one/openclaw that referenced this pull request Feb 13, 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
@mcaxtr mcaxtr deleted the fix/14869-transcript-cleanup branch February 13, 2026 23:14
steipete pushed a commit to azade-c/openclaw that referenced this pull request Feb 14, 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
Hansen1018 pushed a commit to Hansen1018/openclaw that referenced this pull request Feb 14, 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
genehand added a commit to genehand/openclaw that referenced this pull request Feb 14, 2026
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
genehand added a commit to genehand/openclaw that referenced this pull request Feb 15, 2026
genehand added a commit to genehand/openclaw that referenced this pull request Feb 15, 2026
qoli pushed a commit to qoli/openclaw that referenced this pull request Feb 21, 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)
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
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