Skip to content

Preserve Goal execution across foreign slash commands - #184

Draft
ByBrawe wants to merge 5 commits into
mainfrom
fix/foreign-command-steering-guard
Draft

Preserve Goal execution across foreign slash commands#184
ByBrawe wants to merge 5 commits into
mainfrom
fix/foreign-command-steering-guard

Conversation

@ByBrawe

@ByBrawe ByBrawe commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Problem

A real OpenCode coexistence canary in opencode-loop exposed an ownership edge case: on OpenCode 1.18.x, a plugin-handled foreign slash command can still materialize as a synthetic user/model turn even when that plugin sets noReply. An active Goal then mistook that bridge message for foreground human steering, cancelled/repinned its executor, and could continue under the foreign command's local agent.

Fix

  • add a generic foreign-command steering guard with no Loop-specific dependency
  • mark the concrete non-Goal slash-command prompt with a one-time random marker only while an unfinished Goal exists
  • consume and strip only markers issued by this plugin instance before the core chat.message steering handler
  • unknown/spoofed markers remain ordinary foreground chat
  • install the guard immediately above the Goal core so outer safety/task/Plan wrappers still run

Regression coverage

  • foreign slash command cannot repin/preempt an active Goal
  • real human steering still repins/preempts normally
  • spoofed marker cannot bypass steering
  • sessions without a Goal remain untouched

A real OpenCode foreign-command ownership canary will be added to this branch before merge. This issue was discovered by Loop PR #140.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant