feat(parser): detect opencode bash tool failures from metadata.exit - #1257
Merged
mjacobs merged 3 commits intoJul 24, 2026
Merged
Conversation
roborev: Combined Review (
|
Non-zero exit codes in bash tool metadata indicate tool failure, even when output text lacks Linux-style 'exit status N' pattern. This is especially important on Windows where cmd.exe and PowerShell use different error output formats.
The parser now emits errored result events for opencode bash tool calls whose state metadata records a non-zero exit. Without a dataVersion bump, unchanged opencode sessions keep their stale parse and never gain the failure signal, so tool-health analytics stay wrong indefinitely. Bump dataVersion to 73 so existing rows are re-parsed and historical sessions backfill the failure events. Record the format evidence in the provenance doc: the bash tool's structured output carries the child exit code, that output is persisted as the tool part's state.metadata, and the output text never carries an "exit status N" marker, so text matching alone misses these failures on every platform. Verified against a live opencode.db where all 24 bash parts with a non-zero exit lacked the marker. Expand the parser test to a table covering non-zero exit, zero exit, metadata without an exit key, and absent metadata.
mjacobs
force-pushed
the
feat/opencode-metadata-exit-failure-detection
branch
from
July 24, 2026 18:41
69274d4 to
03ade78
Compare
roborev: Combined Review (
|
Contributor
|
found an edge case that should be handled, updating PR soon |
roborev: Combined Review (
|
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
OpenCode bash tool failures leave
metadata.exit > 0in the tool state but the output text does NOT contain theexit status Npattern that AgentsView'sisBashFailure()checks. This is not Windows-specific: on a Linuxopencode.db, all 24 bash parts with a non-zero exit (1, 127, 128) had output text with noexit statusmarker, while all 81 successful parts recordedexit=0. Example outputs from real sessions:'choco' is not recognized as an internal or external command- exit=1, no "exit status" textrsync error: some files could not be transferred- exit=1The exit code is reliably recorded in
metadata.exitby the agent, but the parser never reads it.Impact
On a Windows machine with 273 opencode sessions, 1233 bash tool failures are missed because they lack the
exit statusoutput pattern. Only 51 are currently detected (via thetool:"invalid"fix). The remaining ~1200 are invisible to signals, insights, and health scoring.Fix
In
extractOpenCodeToolCall(), after parsing the tool state, checkmetadata.exit:This is opt-in per agent - only opencode records metadata.exit. Other agents are unaffected.
dataVersionmoves to 73 so existing opencode rows are re-parsed and historical sessions backfill the failure events, and the format evidence is recorded indocs/internal/session-format-sources.md.Branch
https://github.com/ajinkyajacob/agentsview/tree/feat/opencode-metadata-exit-failure-detection
Risk
grepreturns 1 for no match). However, AgentsView's existingexitStatusRealready makes the same assumption via output text. This just adds parity for the metadata path.metadatakey exists in the tool state (opencode format), so other agents are isolated.