Skip to content

fix(tool): plan_exit refuses delegated child sessions - #642

Merged
agenteinstinct1-max merged 1 commit into
dev-vibecodedfrom
m-637
Oct 26, 2026
Merged

agenteinstinct1-max merged 1 commit into
dev-vibecodedfrom
m-637

Conversation

@agenteinstinct1-max

Copy link
Copy Markdown
Collaborator

Issue for this PR

Refs #637

Type of change

  • Bug fix

What does this PR do?

PlanExitTool asked the approval question and posted the synthetic switch-to-Work user message on ctx.sessionID. In a delegated child that switches the child, not the root session that owns the plan. A child has no business switching itself to Work (Work/Think children are stage workers that return results to the coordinator), so plan_exit now fails with a clear message when the session has a parent: no question is asked and no message is written on any session. Root sessions behave as before. This is the "decide whether plan_exit may run in a child" branch of the issue, closed by refusing at runtime rather than editing subagent permission lists (the tool is only registered with the experimental plan mode on the CLI).

How did you verify your code works?

New test/tool/plan.test.ts: a child is refused with zero questions and zero new messages on root and child (fails with src reverted: the child blocks on the question); the root still asks and posts the Work switch on itself. Typecheck is left to CI.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@kilo-code-bot

kilo-code-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/opencode/src/tool/plan.ts
  • packages/opencode/test/tool/plan.test.ts

Reviewed by free · Input: 38.2K · Output: 1.5K · Cached: 85.7K

@agenteinstinct1-max
agenteinstinct1-max merged commit c20f0bf into dev-vibecoded Oct 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant