fix(plan): harden plan mode — deny escape, show preview, guard empty#21866
Open
BYK wants to merge 3 commits intoanomalyco:devfrom
Open
fix(plan): harden plan mode — deny escape, show preview, guard empty#21866BYK wants to merge 3 commits intoanomalyco:devfrom
BYK wants to merge 3 commits intoanomalyco:devfrom
Conversation
…plan Read the plan file content and append it as a markdown preview in the plan_exit question. Also guard against empty plan files — return an error telling the agent to write the plan first.
The question text in the dock was rendered as plain text, making plan content from plan_exit unreadable. Use the Markdown component to render it properly.
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.
Issue for this PR
Closes #18515
Type of change
What does this PR do?
Three plan-mode hardening fixes:
1. Deny plan_exit/plan_enter in subagent sessions (task.ts)
Subagents spawned by the task tool can call
plan_exitorplan_enter, escaping the current plan mode context. Adds deny rules to both the session permission array and the tools map, alongside the existingtodowrite/taskdeny rules.2. Show plan content as markdown preview in exit prompt (plan.ts)
When
plan_exitfires, the question dock now shows the full plan file rendered as markdown below the prompt. This lets the user review the plan before approving the switch to build mode.3. Guard against empty plan files (plan.ts)
If the plan file is empty or missing,
plan_exitreturns an error telling the agent to write the plan first, instead of showing an empty approval prompt.How did you verify your code works?
Checklist