You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
plan_exit in a child session asks and switches the child, not the root session #637
Found while reviewing #545 at 64007a4 / base 04c93b3; the behavior is in dev-vibecoded (packages/opencode/src/tool/plan.ts) and not introduced by #545, which only changes which plan path is named.
PlanExitTool.execute resolves the plan file from the session, but Question.ask and the synthetic "work" user message both use ctx.sessionID. When plan_exit runs in a delegated child session, the approval question and the synthetic switch-to-work message land on the child, so the child switches to Work, not the root session that owns the plan. Existing test coverage reads the child's messages (test/session/reminders.test.ts, plan_exit tests).
Currently latent: plan_exit is not in the Work/Think inspection set (packages/core/src/work-flow.ts), so it is stripped in programming/uncertain sessions (registry.ts:312-322), and subagent permissions (subagent-permissions) do not deny it, so it is reachable only where tool admission does not strip it.
Expected: decide whether plan_exit may run in a child at all; if it may, ask and post the switch on the root session. If not, deny it in subagent permissions.
Fixed by #642, squash c20f0bf. Decision: plan_exit is not allowed in a child session. It now refuses with a clear error, asks no question and posts no message, so neither the child nor the root is switched. Root behaviour is unchanged. New test/tool/plan.test.ts covers child refusal, root pass and the adversarial cases; the child test fails with the src change reverted. Not covered: the tool is still advertised to child sessions (the guard errors safely at call time), and the subagent permission list is unchanged.
Activity
fix(tool): plan_exit refuses delegated child sessions (Refs #637) (#642)
agenteinstinct1-max commentedon Oct 26, 2026
Fixed by #642, squash c20f0bf. Decision: plan_exit is not allowed in a child session. It now refuses with a clear error, asks no question and posts no message, so neither the child nor the root is switched. Root behaviour is unchanged. New test/tool/plan.test.ts covers child refusal, root pass and the adversarial cases; the child test fails with the src change reverted. Not covered: the tool is still advertised to child sessions (the guard errors safely at call time), and the subagent permission list is unchanged.