feat: add session resume as agent-level capability with /resume command#78
Merged
yishuiliunian merged 2 commits intomainfrom Apr 4, 2026
Merged
feat: add session resume as agent-level capability with /resume command#78yishuiliunian merged 2 commits intomainfrom
yishuiliunian merged 2 commits intomainfrom
Conversation
Enable agents to hot-swap their conversation context to a persisted session at runtime, following the same ControlCommand pattern as Clear/Rewind/ModelSwitch. Architecture: - ControlCommand::ResumeSession + AgentEventPayload::SessionResumed in protocol layer - AgentLoopRunner::handle_resume_session replaces session identity, context store, and resets counters (runtime layer) - SessionController::resume_session clears display + sends command (session layer) - TUI receives SessionResumed event → loads display history including sub-agents CLI: - `--resume` (no ID) auto-finds latest session for current directory - `--resume <ID>` resumes specific session (backward compatible) - ResumeIntent enum encapsulates the clap sentinel, resume field is private TUI: - `/resume` lists recent sessions for current project - `/resume <prefix>` hot-swaps agent context (prefix match on session ID) - `/sessions` removed (subsumed by /resume) Storage: cwd canonicalized via normalize_cwd for reliable path matching.
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
ControlCommand::ResumeSessionso agents can hot-swap their conversation context to any persisted session at runtime, following the same pattern as Clear/Rewind/ModelSwitch--resumeCLI flag now works without an ID (auto-finds latest session for current directory); typed viaResumeIntentenum instead of rawOption<String>/resume <prefix>triggers real agent-level context swap;/resume(no arg) lists recent sessions;/sessionsremoved as redundantChanges
ControlCommand::ResumeSession,AgentEventPayload::SessionResumedresume_session.rs— hot-swap session identity, ContextStore, counters, tool_ctxSessionController::resume_session(),load_sub_agent_history(), event handler forSessionResumedlatest_session_for_cwd(),list_sessions_for_cwd(),normalize_cwd()(cwd canonicalization)/resumecommand rewrite,CommandEffect::ResumeSession, display reload on event (including sub-agents)ResumeIntentenum,resume_intent()accessor,resolve_resume_for_cwd(), resume param threaded through bootstrapTest plan