mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 20:03:11 +00:00
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:
parent
82ac0b3880
commit
c7d6482fd4
9 changed files with 247 additions and 3 deletions
|
|
@ -1465,9 +1465,28 @@
|
|||
"terminated_by"
|
||||
],
|
||||
"properties": {
|
||||
"exit_code": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "Process exit code when reason is Error",
|
||||
"nullable": true
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"description": "Error message when reason is Error",
|
||||
"nullable": true
|
||||
},
|
||||
"reason": {
|
||||
"$ref": "#/components/schemas/SessionEndReason"
|
||||
},
|
||||
"stderr": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/StderrOutput"
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
},
|
||||
"terminated_by": {
|
||||
"$ref": "#/components/schemas/TerminatedBy"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ Every event from the API is wrapped in a `UniversalEvent` envelope.
|
|||
| Type | Description | Data |
|
||||
|------|-------------|------|
|
||||
| `session.started` | Session has started | `{ metadata?: any }` |
|
||||
| `session.ended` | Session has ended | `{ reason, terminated_by }` |
|
||||
| `session.ended` | Session has ended | `{ reason, terminated_by, message?, exit_code? }` |
|
||||
|
||||
**SessionEndedData**
|
||||
|
||||
|
|
@ -54,6 +54,18 @@ Every event from the API is wrapped in a `UniversalEvent` envelope.
|
|||
|-------|------|--------|
|
||||
| `reason` | string | `completed`, `error`, `terminated` |
|
||||
| `terminated_by` | string | `agent`, `daemon` |
|
||||
| `message` | string? | Error message (only present when reason is `error`) |
|
||||
| `exit_code` | int? | Process exit code (only present when reason is `error`) |
|
||||
| `stderr` | StderrOutput? | Structured stderr output (only present when reason is `error`) |
|
||||
|
||||
**StderrOutput**
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `head` | string? | First 20 lines of stderr (if truncated) or full stderr (if not truncated) |
|
||||
| `tail` | string? | Last 50 lines of stderr (only present if truncated) |
|
||||
| `truncated` | boolean | Whether the output was truncated |
|
||||
| `total_lines` | int? | Total number of lines in stderr |
|
||||
|
||||
### Item Lifecycle
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue