fix: strip markdown fences and prose from opencode batch payloads - #738
Open
dopamine-pixels wants to merge 1 commit into
Open
dopamine-pixels wants to merge 1 commit into
dopamine-pixels wants to merge 1 commit into
Conversation
OpenCode frequently wraps the requested review JSON in `json fences or
prefixes it with prose. The payload parser required bare JSON, so those
batches were reported as failures ('Runner returned 0 but output file is
missing') even though the model produced a complete, valid payload.
Normalise model output before parsing: strip surrounding fences, then
fall back to the outermost {..} slice of the text.
github-actions Bot
pushed a commit
to citizenadam/desloppify
that referenced
this pull request
Sep 15, 2026
…ose from opencode batch payloads Source: peteromallet#738
github-actions Bot
added a commit
to citizenadam/desloppify
that referenced
this pull request
Sep 15, 2026
dopamine-pixels
commented
Sep 16, 2026
Author
There was a problem hiding this comment.
Tiny coverage nit: the fenced tests look like they’re actually exercising the {...} fallback since there’s prose before the fence. Could be worth adding one pure json ... case so the fence-stripping branch gets hit directly.
This branch has not been deployed
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
desloppify review --run-batches --runner opencode reports valid batches as failed when the model wraps its JSON output in markdown fences or prefixes it with prose. The run log shows "Runner returned 0 but output file is missing" and the batch lands in the failed list even though a complete, valid payload exists in the stream.
Fix
Normalise model output before parsing in _persist_opencode_payload_text:
Verification
un_opencode_batch and direct _extract_json_payload_text cases (fenced, prose-prefixed, non-JSON).