Repository navigation
Description
The workflow
An agent starts work in one checkout, then needs to move the thread to another checkout or worktree to finish the same task. For example: “Switch this thread to /path/to/worktree and continue fixing the failing test there.”
The directory change should be a handoff, not a point where the user has to send another “continue” message.
What happens today
update_environment_directory changes the thread's environment for future turns and instructs the agent to end the current turn. Once the agent follows that instruction, work waits for another user message.
The successful tool response explicitly says:
This applies to future turns; stop work in this turn so the next turn can run from the updated directory.
The running provider keeps its old working directory, so continuing filesystem work in that same turn would be unsafe.
What you would expect
After a successful switch, let the agent end its current turn, then automatically resume the task in a new turn using the selected directory.
- Allow an explicit opt-out when switching directories is the end of the task.
- Keep the handoff unobtrusive: no generated prompt in the composer queue, at most a small timeline marker.
- Respect Stop and replacement turns so preparation finishing late cannot restart cancelled work.
- Preserve user messages queued or steered while the switch is being prepared.
Context and alternatives
A prototype implements this using BB's durable queue, with an optional continue flag defaulting to true. It is a reference for discussion, not a request to accept that design unchanged. I am seeking sign-off here before opening an upstream PR.
In isolated bb runs, a real tool call produced one continuation in the new directory without another user send. Cancellation, concurrent dispatch, steering, and queue boundaries have regression coverage. The prototype's Stop API/CLI cancels pending continuation even when idle; it does not add an idle composer Stop button.
Related work checked:
- PR #3336 proposed continuing in the same turn using explicit paths. It was closed without merging; this proposal instead keeps the next-turn working-directory boundary.
- Issue #3187 and PR #4346 concern Pi tool delivery/session-directory failures. This request is about the extra user interaction after an otherwise successful switch.
The workaround is to send another “continue” message.
Checks
- I searched open and closed issues for the same request.
- If an agent wrote this, the body ends with
> AGENT GENERATED.
AGENT GENERATED
Activity
bb-slop-cop commentedon Oct 2, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotApplied classification: Type: Feature · Priority: Medium · Effort: High. Added labels:
threads,workspaces. No existing classification values or labels were replaced; the final Type was re-read and verified.Trusted upstream
mainexplicitly instructs the agent to stop after a successful directory change. Automatic next-turn resumption therefore adds behavior rather than fixes an unexpected failure. Medium priority reflects a workflow interruption with a manual workaround; High effort reflects continuation-policy design and cancellation/queue interactions.No bug report or pull request: this is a feature requiring product/design decisions, not an eligible simple bug fix.
hxy91819 commentedon Oct 3, 2026
I have an independent implementation of this on a fork, rebased on
desktop-v0.45.0(129f6217): desktop-v0.45.0...hxy91819:bb:fix/environment-switch-auto-continue (20 files, +540/−56)Differences from the prototype described above:
continueCurrentTaskis a required boolean on the tool input rather than an optional default-true flag; the tool description tells the agent to set it true when unfinished work should resume and false when switching is the whole task.environment-switched) created in the same transaction as the environment switch. It carries the thread's resolved model, reasoning level, permission mode, and service tier captured before the switch, so the continuation turn runs with the same settings.Not addressed: whether the composer queue UI hides the generated continuation; the fork uses the system-notice queued row as is.
Happy to align with whichever design the maintainers prefer and open a PR once there is sign-off here and I am on the contributor list.
Record upstream issues get-bb#4811, get-bb#4812 and the get-bb#4778 c…
Record upstream issues get-bb#4811, get-bb#4812 and the get-bb#4778 c…