Skip to content

feat: review-first session opens (gate agent spawn behind explicit Resume button)#63

Merged
milisp merged 1 commit intomilisp:masterfrom
akakabrian:feat/review-first-session-open
Apr 27, 2026
Merged

feat: review-first session opens (gate agent spawn behind explicit Resume button)#63
milisp merged 1 commit intomilisp:masterfrom
akakabrian:feat/review-first-session-open

Conversation

@akakabrian
Copy link
Copy Markdown
Contributor

Summary

Opening a session in codexia currently spawns a full agent process (Codex app-server thread or claude-agent-sdk connection) on click — even if the user just wants to peek at the transcript. With users routinely flipping through old sessions to find one (especially with the new session-manager dialog in #60, but the same is true for sidebar row clicks), this adds up to meaningful memory pressure for a workflow that doesn't need a live agent.

This PR drops the implicit auto-resume. Opening a session loads its on-disk history (JSONL for CC, cached events for Codex) and renders the transcript — but the composer is swapped for a "Resume session" card. Click that to actually spawn the agent.

Behavior

  • Live sessions (in activeSessionIds / activeThreadIds): no change. Composer renders, you can send messages immediately, existing live context preserved.
  • Dormant sessions: composer is replaced by a small Resume card. One click → ccResumeSession / codexService.threadResume fires → agent connects → composer reappears.

Affects every entry point uniformly: sidebar row click, history-icon session-manager rows (#60), URL deep-link (#60), grid card click. Live sessions short-circuit and behave exactly as before — no regression for users currently in a session.

Why

"every time a non-live session is opened, you should review first"
"that will give me better control over memory usage and not trigger a ton of memory usage just from peeking into a session history"

— from a user moving through their session history quickly, where 5+ sessions in a row would otherwise spin up 5+ agent processes.

Implementation

  • src/services/codexService.tssetCurrentThread no longer awaits threadResume. It just sets currentThreadId (and derives activeTurnId for live threads from streaming events). The options.resume parameter is preserved for API compat but is now a no-op. The Resume button calls codexService.threadResume() directly.
  • src/components/codex/ChatInterface.tsx — renders a small ResumeThreadButton in place of Composer when currentThreadId is set but not in activeThreadIds.
  • src/components/cc/CCView.tsx — the previous auto-resume useEffect is split: JSONL load stays (so review works without the agent), the ccResumeSession call is removed. Composer is swapped for ResumeSessionButton when activeSessionId isn't in activeSessionIds. The button replicates the original resume options (cwd, permissionMode, model, resume: sid, continueConversation).

Test plan

  • bunx tsc --noEmit clean
  • bun run build clean
  • Click a non-live session in the sidebar → transcript loads, composer is replaced by "Resume session" card
  • Click Resume → agent spawns, composer appears, sending works
  • Click a live session → composer renders directly (no Resume card)
  • Open the history-icon dialog (feat: URL-param deep-link + clickable session-manager rows #60) → click any non-live row → review mode
  • New session creation (handleNewSession / handleNewThread) still works — these call ccResumeSession/threadResume directly so they're unaffected
  • Memory: open 3-4 dormant sessions in succession → no extra agent processes spawn (verifiable via ps)

🤖 Generated with Claude Code

Drops the implicit agent-resume that fired on every session/thread open.
Opening a session now loads its on-disk history (JSONL for CC, cached
events for Codex) but does not spawn an agent process. A "Resume
session" button rendered in place of the composer fires the actual
resume on demand.

Why: opening a session for review (just to read the transcript) used to
spawn a full agent process — meaningful memory pressure when a user is
peeking at a handful of old sessions in succession. Resume-on-demand
keeps memory low and gives users explicit control over which sessions
are live.

Behavior:

- Live sessions (in activeSessionIds / activeThreadIds): no change —
  composer renders, you can send messages immediately. Existing live
  context is preserved.
- Dormant sessions: composer is replaced by a "Resume session" card.
  Click → ccResumeSession (CC) or codexService.threadResume (Codex)
  fires, agent connects, composer reappears.

Implementation:

- src/services/codexService.ts:
  setCurrentThread no longer awaits threadResume. It just sets
  currentThreadId (and derives activeTurnId for live threads). The
  options.resume parameter is preserved for API compat but ignored.
  The Resume button calls codexService.threadResume() directly.
- src/components/codex/ChatInterface.tsx:
  Renders ResumeThreadButton instead of Composer when currentThreadId
  is set but not in activeThreadIds.
- src/components/cc/CCView.tsx:
  Auto-resume useEffect split — the JSONL load stays (so review works
  without the agent), the ccResumeSession call is removed. Composer is
  swapped for ResumeSessionButton when activeSessionId is not in
  activeSessionIds. Button replicates the original resume options
  (cwd, permissionMode, model, resume id, continueConversation).

Affects every entry point uniformly: sidebar row click, history-icon
session-manager rows, URL deep-link, grid card click. Live sessions
short-circuit and behave as before.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@milisp milisp merged commit ddd4833 into milisp:master Apr 27, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants