Repository navigation
fix(panes): Open shell and a fresh Restart agent start in the last known folder (#376) - #411
Merged
Merged
Conversation
…own folder (#376) POST /v1/panes/{id}/respawn started every process in the Pane's launch folder (cwd) and refused with invalid_dir once it was gone. Now a claude or codex resume runs in cwd, the folder its session started in (Claude Code finds a session only from there; Codex asks which folder to use when they differ), and starts fresh once cwd is gone. Open shell, a fresh start and an `other` agent run again start in the last known folder, else cwd, else ~. The folder a respawn starts in becomes the Pane's cwd too, so a later resume finds a session started fresh elsewhere. API_VERSION 29. Co-Authored-By: Claude Opus 5.5 <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.
Closes #376
What changes
POST /v1/panes/{id}/respawn(the exited Pane header's Restart agent and Open shell) no longer always starts in the launch folder (cwd). Before, it also refused withinvalid_dironce that folder was gone.run: "shell")folder, elsecwd, else~cd'd to before it exited, as a Pane restored after a daemon restart already does (#367).otheragent run again)folder, elsecwd, else~--resume <id>, codexresume <id>)cwd, the folder its session started incwdgoneinvalid_dir.The folder a respawn starts in now becomes the Pane's
cwdas well as itsfolder. Without that, a fresh start in another folder would create a session that a later Restart agent then tries to resume from the oldcwd, where it can't be found. A resume after a daemon restart still leavescwdas #378 left it.invalid_dir(400) now means that none of the three folders exists.An agent's own folder never moves, so for an agent Pane
folderandcwdstay equal until a folder is removed. The resume/fresh split only changes what happens in that case.Code
agents::restart::place: a pure function that takes a respawn, the launch folder, the last known folder and$HOME, and returns what to run and the folder to run it in.Respawn::Resumeis now its own variant, separate from anotheragent'sAgain.existing_dirandhomeare shared with the restore path inresume.rs.pane_respawnreads the live folder, usesplace, and answersinvalid_dironly when no folder is left.db::panes::respawnedalso recordscwd.API_VERSION29: the route's behaviour and thecwd/folderfield docs changed.openapi.jsonand the client are regenerated.docs/spec.md: §2 version note, §3 (cwd), the §4 respawn row with the rule and the reasoning, §6 "Where a pane starts", and §11 Open shell.Tests
placecovers resume in the launch folder, resume falling back to fresh, shell and fresh in the last known folder, the launch-folder and~fallbacks, a relative folder skipped, and nothing left.folders::post_v1_panes_id_respawn, a real daemon withshand the stub agents, which now record the folder each launch started in):~once both are gone. An exited agent Pane's Open shell starts in its last known folder.~. Anotheragent runs again in its last known folder.Before the fix, 9 of the 12 new integration tests failed. The other 3 cover behaviour that was already right.
File links in a Pane without OSC 7 still resolve against the launch folder in the GUI. That is tracked in #377 and is not changed here.
🤖 Generated with Claude Code