Repository navigation
feat: Added plan_exit tool via question to switch from Plan to Build. - #55123
ShogunPanda wants to merge 3 commits into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
The handoff works as described, but there's one bug to fix. I ran Plan with the simulated model in the TUI: plan_exit shows the approval dialog, Approve switches the session to Build, and the selected model is kept. On the base the tool doesn't exist. Both changed test files pass and packages/core type-checks.
Public API: adds a built-in tool plan_exit and a plan_exit permission action, allowed for the Plan agent. Both are additions and backwards compatible.
The bug: after you approve, the session sends an extra model request once the model has finished answering (see the inline comment). The approve test doesn't check how many requests were made, so it misses this.
There was a problem hiding this comment.
The extra model request after approval is gone: I re-ran the TUI flow with the simulated model and Approve now makes exactly two requests. The approve test now checks the request count. Both changed test files pass and packages/core type-checks.
Public API: unchanged since the last review. The PR adds a built-in tool plan_exit and a plan_exit permission action for the Plan agent, both backwards compatible.
One new concern from the fixup: the Build ("leave") reminder is no longer saved for any switch away from Plan, including manual ones. It is now re-inserted near the end of every later Build request. See the inline comment.
There was a problem hiding this comment.
Both earlier concerns are resolved. Approving plan_exit no longer sends an extra model request: in the TUI with the simulated model, an extra queued response went unused. The Build reminder is now saved once for both plan_exit and manual switches, without starting another step, so later requests reuse the same history instead of re-inserting it. The new runner tests cover both cases. Both changed test files pass and packages/core type-checks.
Public API: adds a built-in tool plan_exit and a plan_exit permission action for the Plan agent. Both are additions and backwards compatible.
No further concerns.
c443407 to
4d271f9
Compare
4d271f9 to
6141bda
Compare
There was a problem hiding this comment.
The new commits only rebase this onto the latest dev. plan.ts, the docs and the fixups are unchanged, and the only difference is one moved import in session-runner.test.ts. On the rebased head the handoff still works in the TUI with the simulated model. Approve switches to Build with no extra model turn, and on dev alone the plan_exit call fails. The plan and session-runner tests pass, and the core package type-checks when I run tsgo directly.
Public API: adds a built-in tool plan_exit and a plan_exit permission action for the Plan agent. Both are additions and backwards compatible.
No new concerns.
6141bda to
1d081b0
Compare
Signed-off-by: Paolo Insogna <[email protected]>
Signed-off-by: Paolo Insogna <[email protected]>
Signed-off-by: Paolo Insogna <[email protected]>
1d081b0 to
47e72af
Compare
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |







Issue for this PR
Reimplementation of #49218 on v2.
Type of change
What does this PR do?
Add an explicit, user-approved Plan-to-Build handoff in V2. Plan can request approval through the existing question UI, then continue implementation in the same session while preserving conversation history and the selected model.
Changes:
No plan file or public API changes are required. Ordinary question responses do not switch agents.
How did you verify your code works?
Tested manually.
Screenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist
If you do not follow this template your PR will be automatically rejected.
Assisted-By: OpenAI:GPT-6.1 Sol <openai/gpt-6.1-sol>
Added by the opencode bot (AI-generated).
Fixes #7801
Related: #49879, #43179
Public API: adds the built-in plan_exit tool and plan_exit permission action for the Plan agent (backwards compatible)