feat: hold new goals created under a planning-only agent - #64
Merged
Conversation
The idle guard pauses auto-continue when the active agent is Plan, but it only fires on the *next* idle. Setting a goal while in Plan mode therefore created a live goal, and the routed command text still told the model "Start working toward this goal now." — as a work turn. Command text reaches the model as a normal turn on current OpenCode builds, so that line was an escape from the very guard the idle check provides. Hold such a goal instead: record it with the same `plan agent active` stop reason the idle path uses, pause its clock so the budget survives the mode switch, and announce it through a read-only control turn that explicitly tells the model not to begin work. Also generalize the hardcoded Plan check into `restrictedAgents` (default `["plan"]`) with an `allowGoalExecutionFromPlan` opt-out, so a deployment can restrict other planning-only agents or release the restriction. `isPlanAgent` is kept as the built-in case and the existing `plan agent active` stop reason is preserved, so persisted state and existing consumers are unaffected. Pinned by a new mutation-contract entry: hardcoding the opt-out to true fails the suite. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Aug 29, 2026
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.
Problem
The idle guard added earlier pauses auto-continue when the active agent is Plan — but it only fires on the next idle.
So
/goal <objective>while in Plan mode currently:Start working toward this goal now.Command text reaches the model as a normal turn on current OpenCode builds (documented under Limitations), so that line is an escape from the very guard the idle check provides. The model can begin work before any idle occurs.
Change
Hold such a goal instead of starting it:
plan agent activestop reason the idle path already uses, so/goal statusreads identically either waystartsWork: false) that explicitly tells the model not to begin work/goal resumeafter switching to an executing agent starts the work.Also generalizes the hardcoded Plan check into configuration:
restrictedAgents["plan"][]releases the restriction.allowGoalExecutionFromPlanfalseCompatibility
isPlanAgentis retained as the built-in case; theplan agent activestop reason string is unchanged, so persisted state and existing consumers are unaffected.test/host-lifecycle.test.jsencodes that resuming under Plan returns ok while the idle guard still blocks execution, and that property already holds.Verification
npm run release:check→ exit 0mainbefore this change; +7 new)allowGoalExecutionFromPlantotruefails the suitenpm audit --omit=dev --audit-level=high→ 0 vulnerabilitiesThe new tests were verified to actually catch the defect: removing the creation-time hold in a scratch copy fails 2 of them.
Not verified
Not exercised against a live OpenCode host — unit/contract level only. Worth a Plan-mode canary run before the next release.
🤖 Generated with Claude Code