Skip to content

Hold an error reply's body to the same deadline as a success - #16506

Merged
dhh merged 1 commit into
quattrofrom
agents-error-body-deadline
Oct 25, 2026
Merged

dhh merged 1 commit into
quattrofrom
agents-error-body-deadline

Conversation

@omarchybot

Copy link
Copy Markdown
Collaborator

A follow-up to #14040, from reviewing it at 8d957f3.

open_json in shell/plugins/agents/collectors.py reads a successful reply's body through _read_by, which stops at three times the socket timeout, because the socket timeout bounds only each wait and a server dripping a byte at a time would otherwise hold the collector forever. An HTTP error status skipped that: its body was read with error.read(limit), bounded only per wait. A provider answering 429 or 500 and dripping its body held that collector indefinitely, and since omarchy-agent-usage-update waits on every collector and the panel queues refreshes behind a running update, every later refresh stalled with it.

The error body now goes through _read_by as well. Past the deadline it is left out, and the HttpError still carries the status and headers, which is all any caller reads (Claude's Retry-After handling uses the headers; nothing reads the body). The new check in agent-usage-shared-test.sh serves a 500 that drips its body and fails without the change.

Codex Medium raised the defect in the review of #14040; Codex Medium and muse-spark-1.3 (pi, high) reviewed this change and found nothing to change.

open_json read a successful body through _read_by, bounded by three times the socket timeout, but an HTTP error status read its body with error.read(), which only bounds each wait. A provider answering 429 or 500 and dripping its body held the collector, and the updater's wait held every later refresh behind it. Past the deadline the body is left out and the status still answers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@greptile-apps

greptile-apps Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

open_json now reads HTTP error bodies through the same deadline-aware reader as successful replies.

  • HTTP error replies stop waiting at the shared body-read deadline.

Reviews (1) · Last reviewed commit: "Hold an error reply's body to the same d..." · Reviewed by Greptile

@dhh
dhh merged commit 0e6ca28 into quattro Oct 25, 2026
2 checks passed
@dhh
dhh deleted the agents-error-body-deadline branch October 25, 2026 06:01
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.

2 participants