Skip to content

Goal-mode round driver re-claims blindly after errors/cancel; quit leaves orphan rounds #48239

Closed as not planned

Description

@johnhenry030888

Description

The goal-mode round driver (SessionPrompt.loop) re-claims unconditionally on every normal ensureRunning return, but that return is normal for three different outcomes: the single-flight Runner converts user cancel into its registered onInterrupt value for joiners (so the loop's onInterrupt(pauseOnCancel) never fires), and the processor converts provider failures into error-bearing "stop" results. Net: deterministic provider errors hot-retry burning the round budget, the stop button does not stop the loop, and quit/crash between admit-and-run leaves orphan synthetic goal_round messages with rounds spent.

Reproduction

  1. Run a goal-mode session against a stubbed HTTP 400 provider error (or press stop / quit mid-round)
  2. Observe: the loop re-runs the round instead of pausing (errors), cancel does not pause, quit leaves trailing unexecuted synthetic goal_round messages
  3. Expected: cancel pauses at once; dead rounds pause after 3 consecutive (2 when non-retryable); no orphan rounds after quit

Environment

  • opencode v1.18.29 source build + a local goal-mode extension (same-session round driver + /goal command, cf. [extend] Goal mode: same-session autonomous long-horizon loop #48240) on Linux. The re-claim mechanics (Runner cancel conversion, error-to-stop conversion) live in upstream session core (packages/opencode/src/session/), so the underlying hazard likely affects any driver built on SessionPrompt.loop.

Suggested fix

A GoalDriver.assessRound classifier per round from the last assistant message (productive / cancelled via MessageAbortedError / dead with APIError.isRetryable); a reconcile() retracting trailing unexecuted synthetic rounds via removeMessage + CAS. Fault-injection regression test included in the local patch; available on request.

Activity

  1. github-actions commented on Sep 9, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • No issue template was used. Please use one of the three templates: Bug Report, Feature Request, or Question
    • Bug reports should include reproduction context: environment info (OS, version), steps to reproduce, and observed vs expected behavior — this issue describes the root cause analysis well, but lacks that structure
    • The title prefix [fix] does not match any of the required templates (Bug Report titles have no required prefix; Feature Requests should start with [FEATURE]:)

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of or closely related to existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. changed the title [-][fix] Goal-mode round driver re-claims blindly after errors/cancel; quit leaves orphan rounds[/-] [+]Goal-mode round driver re-claims blindly after errors/cancel; quit leaves orphan rounds[/+] on Sep 9, 2026
  3. johnhenry030888 commented on Sep 9, 2026

    @johnhenry030888
    Author

    Body reshaped to the Bug Report template and title de-prefixed per the compliance check. Environment now discloses the local goal-mode extension explicitly.

  4. github-actions commented on Sep 9, 2026

    @github-actions
    Contributor

    Thanks for updating the issue — it now includes a clear description, reproduction steps, and environment details. Everything looks good!

  5. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions