Skip to content

Interactive session resume hangs when JSONL accumulates studio.tool_progress entries #3865

Description

@silvaitamar

Quick summary

Interactive studio code sessions resume appears stuck on "Resuming session…" when a session .jsonl has accumulated many studio.tool_progress entries. The same bloat slows studio code sessions list because every session file is fully parsed. Distinct from #3286 (live-UI duplicate progress): progress ticks are still persisted and replayed on resume.

Steps to reproduce

  1. Run a Studio Code session that triggers many tool operations (file search, terminal, etc.) over a modest number of user turns.
  2. Inspect the session .jsonl under the sessions directory — it grows primarily with customType: "studio.tool_progress" lines.
  3. Run studio code sessions resume <id> (interactive TUI).
  4. CLI stays on "Resuming session…" for a long time or appears frozen.

Workaround (confirms root cause): studio code sessions resume <id> "message" --json completes without hanging (skips TUI replay).

Optional: studio code sessions list also becomes slow when multiple session files are similarly bloated.

What you expected to happen

Progress messages are ephemeral UI state. Resume should restore conversation context (messages, tool results, site selection) quickly, without replaying every loader tick stored on disk.

What actually happened

Interactive resume hangs or feels frozen on "Resuming session…" until tens of thousands of studio.tool_progress entries are replayed. Session list is slow because each .jsonl is fully read.

In one affected session: ~25,000 total lines, ~24,900 studio.tool_progress (~99%), ~270 lines of real content after pruning progress only, ~10 MB file size — with relatively few user turns. After removing studio.tool_progress entries (with backup), interactive resume worked immediately.

Impact

Some (< 50%)

Available workarounds?

No but the app is still usable

Platform

Windows

Logs or notes

Environment

  • OS: Windows 10 (pattern should apply to any platform using the CLI TUI)
  • Commands: studio code sessions resume, studio code sessions list
  • Session storage: %APPDATA%\Studio\sessions

Root cause (code path)

  1. Every progress callback is persisted — apps/cli/commands/ai/index.ts:
setProgressCallback( ( message, update ) => {
  ui.setLoaderMessage( message, update );
  if ( ! message.trim() ) return;
  void append( ( sm ) => appendStudioEntry( sm, 'studio.tool_progress', { message } ) );
} );
  1. Interactive resume replays every entry — apps/cli/ai/sessions/replay.ts (studio.tool_progress branch calls setLoaderMessage per line). ~25k entries = O(n) replay of UI noise.

  2. Session list reads full files — tools/common/ai/sessions/store.ts: listAiSessions() calls readPiFileEntries(filePath) for every .jsonl.

Suggested directions (non-prescriptive)

  1. Do not persist studio.tool_progress (live-only setLoaderMessage), or
  2. Persist only the latest progress per tool run / coalesce updates, or
  3. Skip studio.tool_progress in replaySessionHistory, and/or
  4. Derive session summaries for list without parsing entire JSONL bodies.

Workarounds today

  • Headless resume: studio code sessions resume <id> "<prompt>" --json
  • Prune studio.tool_progress from .jsonl (backup first)

Community maintenance tool (not affiliated with Automattic): https://github.com/silvaitamar/wp-studio-session-cleaner

Happy to provide redacted samples or help validate a fix.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions