feat: review-first session opens (gate agent spawn behind explicit Resume button)#63
Merged
milisp merged 1 commit intomilisp:masterfrom Apr 27, 2026
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Opening a session in codexia currently spawns a full agent process (Codex
app-serverthread orclaude-agent-sdkconnection) 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
activeSessionIds/activeThreadIds): no change. Composer renders, you can send messages immediately, existing live context preserved.ccResumeSession/codexService.threadResumefires → 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
— 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.ts—setCurrentThreadno longer awaitsthreadResume. It just setscurrentThreadId(and derivesactiveTurnIdfor live threads from streaming events). Theoptions.resumeparameter is preserved for API compat but is now a no-op. The Resume button callscodexService.threadResume()directly.src/components/codex/ChatInterface.tsx— renders a smallResumeThreadButtonin place ofComposerwhencurrentThreadIdis set but not inactiveThreadIds.src/components/cc/CCView.tsx— the previous auto-resumeuseEffectis split: JSONL load stays (so review works without the agent), theccResumeSessioncall is removed.Composeris swapped forResumeSessionButtonwhenactiveSessionIdisn't inactiveSessionIds. The button replicates the original resume options (cwd,permissionMode,model,resume: sid,continueConversation).Test plan
bunx tsc --noEmitcleanbun run buildcleanhandleNewSession/handleNewThread) still works — these callccResumeSession/threadResumedirectly so they're unaffectedps)🤖 Generated with Claude Code