warp icon indicating copy to clipboard operation
warp copied to clipboard

Feature Request: Opt-in auto-restoration for specific persistent CLI sessions (e.g., Claude, Codex, REPLs, AI agents)

Open dhruvil009 opened this issue 7 months ago • 10 comments

Pre-submit Checks

Describe the solution you'd like?

I would like a way to explicitly tell Warp to auto-execute specific commands when restoring a session.

A few potential ways this could be implemented safely without risking the auto-execution of dangerous commands:

  1. A Command Whitelist: A configuration option (in UI or ~/.warp/) where I can specify safe commands (e.g., claude --resume, htop, k9s). If one of these was the active foreground process when Warp closed, auto-run it on restore.
  2. "Sticky" Panes: A UI toggle on a pane (via right-click or command palette) to "Auto-run current command on restore," giving the user explicit, localized control.
  3. Directory-based Startup Commands: The ability to map a specific directory to a startup command, so whenever a pane is restored in that pwd, the command is executed.

Is your feature request related to a problem? Please describe.

When I restart Warp, the terminal does an excellent job of restoring my windows, tabs, panes, and working directories. However, it drops the active processes that were running in those panes.

I frequently run persistent, long-standing CLI sessions—specifically agentic AI workflows like claude or codex. Every time Warp restarts, I have to manually go through multiple panes and re-type claude --resume (or similar commands) to get my workspace back to its exact previous state.

Additional context

As developers increasingly rely on long-running local agents and conversational CLIs alongside traditional editors, the terminal is becoming less of a transient command runner and more of a persistent dashboard. Allowing opt-in state restoration for these tools would be a massive workflow improvement.

Operating system (OS)

macOS

How important is this feature to you?

4

Warp Internal (ignore) - linear-label:39cc6478-1249-4ee7-950b-c428edfeecd1

None

dhruvil009 avatar May 05 '26 20:05 dhruvil009

@dhruvil009

Here's what I found while triaging this issue:

This looks like an enhancement gap rather than a bug. Warp has Tab Configs for manually opening pane layouts with configured commands, but session restore currently restores layout/cwd/history/conversations rather than opt-in foreground command re-execution. Related: #9416 covers keeping sessions alive across relaunch, while this request proposes a safer auto-run/resume mechanism.

Maintainer details

I concluded that feature request for opt-in restoration-time command execution so selected persistent CLI sessions can be resumed when Warp restores windows, tabs, panes, and directories..

Triage summary

This is an enhancement request for an explicitly opt-in way to run selected commands during session restore, focused on persistent CLI workflows like Claude, Codex, REPLs, htop, or k9s. The current behavior described by the reporter is expected for today's restore model: Warp restores windows/tabs/panes and working directories, but does not restore or re-execute foreground processes.

Relevant existing surfaces:

  • Session restoration persists terminal pane layout and metadata such as cwd, shell launch data, input config, restored blocks, and agent conversation IDs, then creates a fresh terminal session during restore.
  • Tab Configs can define pane layouts with commands that auto-run when the config is opened, and the UI can save the current tab layout as a config. However, the saved config path preserves layout/directory and currently emits no commands to rerun from the live panes.
  • Existing issue #9416 is strongly related but asks to keep active terminal/agent sessions alive and reattach after relaunch. This issue asks for an opt-in restoration-time auto-run/resume mechanism instead. Existing issue #2693 is a broader startup autorun request. I did not mark this as a duplicate because the duplicate scan found fewer than two existing issues that match both the restore-specific trigger and the command-resume behavior closely enough.

Likely implementation area is session/tab/pane restoration plus the Tab Config or launch-config command execution model. This will likely need product design around safety prompts, per-pane vs global scope, command matching, and how restored foreground commands are detected and stored.

This is my automated analysis and may be incorrect. A maintainer will verify the details.

Powered by Oz

warp-for-oss[bot] avatar May 05 '26 20:05 warp-for-oss[bot]

@oz-agent I’d be interested in contributing to this if any part of it is open to external contributors.

From the triage notes, it sounds like the core implementation may touch Warp’s internal session/tab/pane restore logic, so I’m not sure whether this is feasible from the public repo. If there’s a smaller public-facing piece that would help, such as docs, config schema examples, UX wording, or tests around tab/launch config behavior, I’d be happy to work on that.

One design constraint I’d expect to matter is safety: this should probably be explicit per pane/workspace and should not silently replay arbitrary shell history. A confirmation prompt or allowlist for exact commands like claude --resume, codex, REPLs, k9s, or htop would make the feature much safer.

dhruvac29 avatar May 05 '26 20:05 dhruvac29

@dhruvac29

Thanks for offering to contribute. Based on the public code/docs, the safest contributor-sized path is likely around Tab Configs or a short product/tech spec rather than directly replaying arbitrary restored shell processes: Tab Configs already support explicit startup commands that run when a config opens, while Session Restoration currently restores layout/directories/recent blocks rather than foreground processes.

A useful scope would be docs, schema examples, or tests/spec work for an explicit opt-in model such as exact-command allowlists or per-pane/config opt-in. The core restore-time auto-execution behavior should wait for maintainer/product sign-off because it changes Warp from restoring state into launching commands, which needs careful safety UX.

Reasoning

Response mode selected because the issue is already triaged and the explicit @oz-agent comment asks a contributor-scoping question rather than requesting a fresh label pass. No labels or GitHub state should be changed by this run.

Relevant current behavior from docs and code:

  • Docs: Session Restoration restores windows, tabs, panes, and recent Blocks on relaunch; it is controlled by the restore_session setting. See https://docs.warp.dev/terminal/sessions/session-restoration/ and https://docs.warp.dev/terminal/settings/all-settings/.
  • Docs: Tab Configs are the existing explicit startup-command surface; they define reusable layouts with directories, shells, pane types, and commands that run when the config opens. See https://docs.warp.dev/terminal/windows/tab-configs/.
  • Code: app/src/launch_configs/launch_config.rs defines PaneTemplateType::PaneTemplate { cwd, commands, is_focused, pane_mode, shell }, but TryFrom<PaneNodeSnapshot> for restored/saved terminal snapshots emits commands: Vec::new(), so snapshot/session capture does not currently persist the running foreground command as something to auto-run.
  • Code: app/src/tab_configs/tab_config.rs parses [[panes]] leaf fields including directory, commands, type, shell, and focus; resolve_pane_node converts those commands into CommandTemplate values.
  • Code: app/src/pane_group/mod.rs executes template commands only through the launch/tab-config path by joining commands with && and calling terminal.set_pending_command(...); the snapshot restore path creates a shell session with restored block lists, CWD, conversation IDs, shell data, and input config, but does not set a pending foreground command.
  • Tests: crates/integration/src/test/session_restoration.rs covers restoring panes/directories/block history/conversations, and crates/integration/src/test/pane_restoration.rs covers undo-close restoration; these would be relevant test areas if maintainers approve a scoped restore-time command feature.

Duplicate scan: fetched all 3,274 open non-PR issues via gh api --paginate --slurp repos/warpdotdev/warp/issues?state=open&per_page=100 and excluded #10185. The strongest related issue is #4763 (restore applications/servers on session resume). Adjacent but not duplicate-equivalent issues include #6882 (project-based session restoration), #9083 (programmatic Tab Config launch), and #10171 (agent profile in Tab Configs). Because fewer than two existing issues met the likely-duplicate threshold, this should not be treated as a duplicate if a future full triage shape is emitted.

Most likely ownership if maintainers proceed: area:launch-configs, area:shell-terminal, and area:window-tabs-panes. Source ownership hints from .github/STAKEHOLDERS point to app/src/tab_configs/, app/resources/tab_configs/, app/src/pane_group/, and conversation/session restoration owners as relevant reviewers.

This is my automated analysis and may be incorrect. A maintainer will verify the details.

Powered by Oz

warp-for-oss[bot] avatar May 05 '26 20:05 warp-for-oss[bot]

The bottleneck is clearly FilterableDropdown::set_footer. We've spent enough time analyzing the components—let’s actually see the implementation.

@oz-agent, stop summarizing and just generate the PR based on the fix for the hover state logic. @dhruvac29, the analysis is done; let's get the code merged.

dhruvil009 avatar May 05 '26 21:05 dhruvil009

@oz-agent Please generate a PR.

dhruvil009 avatar May 05 '26 21:05 dhruvil009

@dhruvil009

I wouldn’t generate an implementation PR directly from this issue yet. The requested behavior introduces opt-in command execution during app/session restore, so it needs product and security design first; Warp should not silently replay arbitrary foreground commands.

A useful public-facing contribution before core implementation would be a spec proposal, documentation/examples for safe tab-config startup commands, or tests around explicit launch/tab config command behavior. The core auto-restore work appears to touch Warp’s app-state/session restore and terminal launch internals.

Reasoning

This run was triggered by an @oz-agent request to generate a PR on an already-triaged enhancement, so response mode is appropriate and labels should not be mutated.

Code inspection findings:

  • app/src/app_state.rs defines TerminalPaneSnapshot with persisted cwd, shell_launch_data, activity/read-only state, AI input/profile/conversation fields, and active agent-view conversation state, but no persisted foreground process, exact command replay policy, allowlist, or per-pane auto-run flag.
  • app/src/pane_group/pane/terminal_pane.rs snapshots terminal panes from pwd_if_local, shell_launch_data_if_local, input config, model/profile, and conversation state. It does not capture a restartable foreground command for later execution.
  • app/src/persistence/sqlite.rs serializes terminal pane state into terminal_panes (cwd, shell_launch_data, input config, conversation IDs, etc.) and reads it back into TerminalPaneSnapshot; the current restore path is state restoration, not process resurrection or command replay.
  • app/src/launch_configs/launch_config.rs converts live terminal snapshots to launch configs with commands: Vec::new(), so saving a layout from a running pane intentionally does not persist the active command.
  • app/src/tab_configs/tab_config.rs renders user-authored tab config commands into CommandTemplates, and app/resources/tab_configs/new_tab_config_template.toml shows the existing explicit commands = [] mechanism. This supports configured startup commands, but not automatic restore based on the prior foreground process.
  • app/src/tab_configs/session_config.rs can build explicit tab configs that add known CLI agent command prefixes for selected session types, but this is an explicit new-session/config flow rather than session restoration.

Duplicate check:

  • Fetched all open issues with gh api --paginate /repos/warpdotdev/warp/issues?state=open&per_page=100, excluding PRs and #10185, and also checked recently closed issues updated/closed in the last 7 days.
  • #4763 ("Allow session restore to also restore specific application...") is a close related request about restoring launched applications/commands on resume.
  • #6882, #1866, #4267, and other launch/session restore issues are related but do not share the same specific requested capability of opt-in safe command auto-execution for persistent CLI sessions.
  • Because only one strong duplicate candidate was found, the dedupe skill’s two-candidate threshold is not met.

The unrelated issue-thread text about FilterableDropdown::set_footer does not match this issue’s session-restore feature request and was not used as implementation guidance.

This is my automated analysis and may be incorrect. A maintainer will verify the details.

Powered by Oz

warp-for-oss[bot] avatar May 05 '26 21:05 warp-for-oss[bot]

@dhruvil009 Before I start working on this, do you want me to generate a PR for this issue?

I’m happy to help, but I want to confirm the expected scope first since the core change may need maintainer/product sign-off around restore-time command execution and safety.

dhruvac29 avatar May 05 '26 21:05 dhruvac29

@dhruvac29 Appreciate the help. However, it is not needed.

dhruvil009 avatar May 05 '26 21:05 dhruvil009

@dhruvac29 @dhruvil009 Thanks for your interest in this issue! Per our contributing docs, the Warp team first needs to evaluate the issue and mark it as ready-to-implement or ready-to-spec before work can start. We'll take a look at this one soon but in the meantime, feel free to look at the other issues labeled with readiness labels on the repo if you're interested in working on it.

captainsafia avatar May 05 '26 21:05 captainsafia

@captainsafia Are there any plans to evaluate this issue. Oz looks novel, and impressive, but issues, still sit in queue just as long, despite relative simplicity

dhruvil009 avatar May 27 '26 13:05 dhruvil009

@captainsafia @zachlloyd Will be closing this issue soon, since it is clear, that the promise of @oz-agent was just a facade.

It was explicitly mentioned: https://github.com/warpdotdev/warp/issues/10185#issuecomment-4383299713 that the issue first needs to be evaluated, which already seems to be unnecessary human gating, instead of having CI driven automated testing, and on top of this, despite follow-ups @captainsafia has failed to even respond to this issue, since close to a month at this point.

dhruvil009 avatar Jun 02 '26 05:06 dhruvil009

@dhruvil009

This issue appears to overlap with existing issues:

  • #4763 — Allow session restore to also restore specific application (e.g. neovim) ideally file opened and line number as well if possible
  • #7712 — Assign Workflow to a Session stored pane which will run on startup

If this report is meaningfully different, please comment with the additional context or distinguishing behavior so a maintainer can review it. Otherwise, a maintainer may close it as a duplicate after review.

Maintainer details

I concluded that opt-in command replay during session restoration is a clear enhancement request, and it overlaps with existing open restore-on-resume automation requests..

Duplicate reasoning

  • #4763: Requests optional session-resume restoration of previously launched applications and servers, matching the core desire to relaunch command/application state after restored panes come back empty.
  • #7712: Requests a per-pane startup action tied to saved/restored sessions so monitoring panes automatically resume after restart instead of requiring manual commands.

This is my automated analysis and may be incorrect. A maintainer will verify the details.

Powered by Oz

warp-for-oss[bot] avatar Jun 02 '26 05:06 warp-for-oss[bot]