GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(cli): report terminal outcomes for noninteractive runs by rekram1-node · Pull Request #60508 · anomalyco/opencode

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Oct 30, 2026 •
edited by opencodejr Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Problem

opencode run --format=json can exit 1 and emit an error even when an interrupted model response recovers and the execution succeeds. Scripts and CI consumers cannot distinguish a recovered step from a failed run.

Fixes #50062.

Change

 failed model step
-  emit fatal JSON error and set exit 1
+  allow execution to continue
 execution becomes idle
-  treat any historical assistant error as fatal
+  use the terminal execution event or projected idle marker

Keep V1 behavior, real execution failures, SIGINT, and local cancellation exit codes. Wait for the terminal event when the idle marker has not projected yet, even if an assistant already responded. Non-question forms still fail non-interactive runs, now with an explicit diagnostic; question cancellation remains recoverable.

Related: #52885 addresses exit status. This also removes recovered-step JSON errors and uses execution markers, not the last assistant, when terminal events lag or are missing.

Out of scope

No model retry policy, Core/API changes, or new JSON event types. Step usage reconciliation is unchanged.

Verification

  • bun test test/run --timeout 30000 --rerun-each 10 --only-failures: 240 pass.
  • Full CLI bun test --timeout 30000 --only-failures: 364 pass, 9 skip, 0 fail across 54 files.
  • CLI bun typecheck: pass.
  • CLI bun run typecheck:tsc: pass.
  • Root bun run check: pass with existing lint warnings.
  • Regression coverage includes live/projected recovery, terminal failures after a clean assistant, delayed/missing terminal events, stream disconnection, interruption, form cancellation, and V1 behavior.

Visual

<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72">
  <g fill="none" stroke="currentColor" opacity=".5">
    <rect x="4" y="16" width="62" height="36" rx="6"/>
    <path d="M66 34h20m-4-4 4 4-4 4"/>
    <rect x="86" y="16" width="66" height="36" rx="6"/>
    <path d="M152 34h18m-4-4 4 4-4 4"/>
    <rect x="170" y="16" width="66" height="36" rx="6"/>
  </g>
  <g fill="currentColor" font-family="monospace" font-size="10" text-anchor="middle">
    <text x="35" y="38">retry</text><text x="119" y="38">recover</text><text x="203" y="38">exit 0</text>
  </g>
  <circle cx="77" cy="34" r="2" fill="currentColor" opacity=".5">
    <animate attributeName="opacity" values=".2;1;.2" dur="2s" repeatCount="indefinite"/>
  </circle>
</svg>

Added by the opencode bot (AI-generated).

Related: #39573

Public API: opencode run: no error event or exit 1 for recovered steps; adds an explanatory error for cancelled non-question forms (event types unchanged, backwards compatible)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node
fix(cli): report terminal outcomes for noninteractive runs
0f09b7e
@github-actions github-actions Bot added the contributor label Oct 30, 2026
opencodejr[bot]
opencodejr Bot reviewed Oct 30, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recovered runs now exit 0, and I found no blocking issues.

I ran the #50062 repro from source on both checkouts. On the base it emits a provider.transport error event and exits 1 even though the retried step finishes with stop. With this PR the same scenario has no error event and exits 0. One caveat: with the original 300 ms socket drop, the PR runs happened to drop before any output arrived, so core retried quietly. I delayed the drop to 1500 ms so the recovered-after-output path actually ran; the base still exits 1 under that timing. bun test test/run: 24 pass. tsc -b in packages/cli: no errors.

A step failure that core does not retry still ends in an execution failure, so real failures still exit 1. Interrupt (130), permission rejection and V1 behaviour are unchanged.

Public API: no SDK, HTTP, plugin or config changes, and no new event types. The changes are in what opencode run outputs and its exit codes: --format json no longer emits an error event for a recovered step (and default format no longer prints it to stderr); a cancelled form that isn't a question now emits one error event explaining why (it already exited 1); and a run only counts as successful if the execution itself succeeded, not just its last step. Consumers that parse error events are affected but won't break.

Related: #39573

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@opencodejr opencodejr Bot mentioned this pull request Oct 30, 2026
docs(cli): document run --format json records, exit codes and permissions #60543
Open
3 of 6 tasks
@lalith0407 lalith0407 mentioned this pull request Nov 15, 2026
run --format json omits every subagent event (still in 2.x, see #49300) #62380
Open

This branch has not been deployed

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

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

opencode run (v2) exits 1 after a transient provider error that the runner retried and recovered from

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@rekram1-node
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.