feat: add structured stderr output for error diagnostics (#29)

Add StderrOutput schema with head/tail/truncated/total_lines fields to
provide better error diagnostics when agent processes fail.
This commit is contained in:
Nathan Flurry 2026-01-29 07:18:56 -08:00 committed by GitHub
parent 82ac0b3880
commit c7d6482fd4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 247 additions and 3 deletions

View file

@ -436,9 +436,35 @@
"terminated_by"
],
"properties": {
"exit_code": {
"description": "Process exit code when reason is Error",
"type": [
"integer",
"null"
],
"format": "int32"
},
"message": {
"description": "Error message when reason is Error",
"type": [
"string",
"null"
]
},
"reason": {
"$ref": "#/definitions/SessionEndReason"
},
"stderr": {
"description": "Agent stderr output when reason is Error",
"anyOf": [
{
"$ref": "#/definitions/StderrOutput"
},
{
"type": "null"
}
]
},
"terminated_by": {
"$ref": "#/definitions/TerminatedBy"
}
@ -450,6 +476,41 @@
"metadata": true
}
},
"StderrOutput": {
"type": "object",
"required": [
"truncated"
],
"properties": {
"head": {
"description": "First N lines of stderr (if truncated) or full stderr (if not truncated)",
"type": [
"string",
"null"
]
},
"tail": {
"description": "Last N lines of stderr (only present if truncated)",
"type": [
"string",
"null"
]
},
"total_lines": {
"description": "Total number of lines in stderr",
"type": [
"integer",
"null"
],
"format": "uint",
"minimum": 0.0
},
"truncated": {
"description": "Whether the output was truncated",
"type": "boolean"
}
}
},
"TerminatedBy": {
"type": "string",
"enum": [