Add JSON stream parsing for the opencode provider#375
Open
asterixcapri wants to merge 2 commits intomattpocock:mainfrom
Open
Add JSON stream parsing for the opencode provider#375asterixcapri wants to merge 2 commits intomattpocock:mainfrom
asterixcapri wants to merge 2 commits intomattpocock:mainfrom
Conversation
|
@asterixcapri is attempting to deploy a commit to the Matt Pocock's projects Team on Vercel. A member of the Team first needs to authorize it. |
mattpocock
added a commit
that referenced
this pull request
Apr 24, 2026
…pty (#422) When an agent exits non-zero and stderr is empty, the AgentError message was blank after the exit code. This is the primary case for OpenCode, whose parseStreamLine is a no-op (resultText always empty), but also applies to structured parsers that capture error details via stream events. The fallback chain in invokeAgent is now: stderr → resultText → tail of raw stdout (last 20 non-empty lines). Key decisions: - Fix is in Orchestrator's invokeAgent, not in provider-specific parsers - OpenCode's parseStreamLine remains unchanged (still returns []) - Complements PR #375 (OpenCode JSON parsing) — works regardless of parser - Same pattern as #420 (Pi) and #421 (Codex) but at the Orchestrator level Files changed: - src/Orchestrator.ts — stderr→resultText→stdout fallback in error path - src/Orchestrator.test.ts — 3 tests: no-op parser stdout fallback, structured parser resultText fallback, stderr-present preserved - .changeset/agent-error-stdout-fallback.md — patch changeset Closes #422 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Switch the
opencodeprovider to JSON stream parsing.This replaces raw stdout passthrough with structured parsing so Sandcastle can surface streamed text,
supported tool calls, and a final result from
step_finish.Validation
npm run buildnpm test -- src/AgentProvider.test.ts src/Orchestrator.test.tsopencode run --format json ...smoke test