Skip to content

fix(opencode): preserve command scope in subtask continuation message - #41874

Open
jaysonvirissimo wants to merge 1 commit into
anomalyco:devfrom
jaysonvirissimo:subtask-scope
Open

fix(opencode): preserve command scope in subtask continuation message#41874
jaysonvirissimo wants to merge 1 commit into
anomalyco:devfrom
jaysonvirissimo:subtask-scope

Conversation

@jaysonvirissimo

Copy link
Copy Markdown

Issue for this PR

Closes #41866

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The synthetic user message injected after a user-invoked subtask command says "continue with your task".
But for the/review command, that strongly suggests the model should fix any findings the subtask reported.
This is unfortunate, since when you run that command you expect it to review a PR, not try to fix everything wrong with it.

The message itself cannot be removed.
PR #5650 added it because reasoning models like Gemini error when an assistant message has no user message after it.
So this PR keeps the message but changes its text.
The new text names the command that ran, asks for a summary of the output, and defers any further action to the user.
It also restores the code comment from #5650 that explains why the message must exist.

How did you verify your code works?

  • Added tests to packages/opencode/test/session/prompt.test.ts
  • Ran the test suite
  • Ran typecheck

Screenshots / recordings

Not a UI change.

Checklist

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

After a subtask command completes, opencode injects a synthetic user
message that says "continue with your task". The parent agent can read
this as permission to act beyond the command scope. For example, it can
start to fix findings from the review-only /review command. Change the
message to name the command and defer further action to the user. Also
restore the comment that explains why the message must exist.

Fixes anomalyco#41866
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.

task command injects a synthetic user instruction that can override review-only scope

1 participant