GeezerVison is showing github.com — docs(cli): document run --format json records, exit codes and permissions by oldantique · Pull Request #60543 · anomalyco/opencode
Conversation
oldantique
commented
Oct 30, 2026
•
edited by opencodejr
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue for this PR
Related: #53207
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
The run docs say --format json emits NDJSON but not what the records contain, so script authors end up reading noninteractive.ts. This adds short sections on the JSON records, exit codes, and how run handles permission requests.
How did you verify your code works?
Checked each statement against noninteractive.ts and the run flags on current dev (including #60475), and the record shapes, the provider.no-route error and the permission behavior against real runs on 2.0.26. astro check, bun run build and prettier pass.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Added by the opencode bot (AI-generated).
Related: #50062, #60278
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
The docs match the current run implementation, apart from one small exit-code case. I checked the record envelope, each record type and its fields (reasoning only with --thinking, tool_use only once a call succeeds or fails, step_finish reasons matching FinishReason), stderr for warnings, exit codes 0/1/130, the provider.no-route error and the permission behaviour against packages/cli/src/run/noninteractive.ts and run.ts. They all line up.
Public API is unchanged; this is documentation only.
One small gap on the exit-code table: see the inline comment. Also note that #60508 (open) would change when a recovered step emits error and exits 1, so these tables may need a touch-up if that lands.
Related: #50062, #60278
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
| Code | Meaning |
|
|
|
| ----- | ----------------------------------------------------------------- |
|
|
|
| `0` | The run completed. Individual tool calls may still have failed. |
|
|
|
| `1` | The run failed. With `--format json`, an `error` record says why. |
|
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.
Not quite always true: when a non-question form (e.g. an MCP elicitation) is cancelled, cancelForm in noninteractive.ts sets process.exitCode = 1 without emitting an error record, so a script can see exit 1 with no error line. Maybe soften this to "usually", or mention that runs needing input they can't get (other than questions) also exit 1.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Done, changed to "usually" (75a2478).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
The new commit addresses the earlier point: the exit-code table now says an error record usually explains exit 1, which matches the non-question form cancellation case. I have nothing further. Public API is unchanged; this is documentation only.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|