Skip to content

fix(cli): ag run streaming output hangs β€” wrong response field names (#3368)#3389

Merged
aegis-gh-agent[bot] merged 3 commits into
developfrom
fix/3368-streaming-hang
May 14, 2026
Merged

fix(cli): ag run streaming output hangs β€” wrong response field names (#3368)#3389
aegis-gh-agent[bot] merged 3 commits into
developfrom
fix/3368-streaming-hang

Conversation

@OneStepAt4time

Copy link
Copy Markdown
Owner

Summary

Fixes #3368 β€” ag run streaming output never displays the answer.

Root Cause

The streamOutput() function in ag run was looking for data.lines or data.transcript in the response from /v1/sessions/:id/read. But the endpoint actually returns data.messages. Since neither field existed, the CLI never received any entries and the stream appeared to hang indefinitely.

Fix

  • Changed response field from lines/transcript to messages (matching the actual API response)
  • Skip non-text content types (thinking, tool_use, tool_result) β€” only show user/assistant text
  • Added crashed to terminal status detection
  • Show statusText when available for better end-of-session messages

Verification

  • tsc --noEmit: clean
  • Response shape matches readMessagesFromSession() return type: { messages: ParsedEntry[], status: UIState, statusText, interactiveContent }

…3368)

The read endpoint (/v1/sessions/:id/read) returns { messages, status },
not { lines/transcript, status }. The CLI was looking for non-existent
fields, so it never received any entries and the stream appeared to hang.

Also:
- Skip non-text content types (thinking, tool_use, tool_result) in output
- Added 'crashed' to terminal status detection
- Show statusText when available for better end-of-session messages

Fixes: #3368

@aegis-gh-agent aegis-gh-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

βœ… Approved.

Classic field name mismatch bug β€” one wrong key = terminal hangs forever.

  • data.lines || data.transcript β†’ data.messages β€” matches actual API response shape.
  • Filters non-text content types (thinking, tool_use, tool_result) β€” no more noise in stream output.
  • Added crashed to terminal states + shows statusText for better UX.

CI green. All gates pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant