Skip to content

Stream Dot task turns so long tasks bridge their prompt and answer - #37

Merged
iFixRobots merged 2 commits into
mainfrom
indent/chatgpt-dots-stream-task-turns
Nov 1, 2026
Merged

iFixRobots merged 2 commits into
mainfrom
indent/chatgpt-dots-stream-task-turns

Conversation

@indent

@indent indent Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

What the logs show. With the decode logging from #36 on stable, every Could not bridge ChatGPT task replies failure in the last day (105 lines, 5 tasks, 4 accounts) is /v2/threads/<id>/turns with truncated=true, bytes_read=4194304, decode_error=unexpected eof and a chunked body (content_length=-1). All 5 attempts fail the same way, and the cycle repeats whenever the task's turn changes or the bridge restarts. The task's prompt and answer never reach the chat.

Cause. TaskTurns asks for itemsView=full, which includes every tool call, reasoning item and command output in the turn. Client.request decodes the whole body through a 4 MiB LimitReader, so long tasks get cut off.

Change. Responses whose target implements a stream decoder are walked token by token with a 64 MiB cap. The turns page keeps only the items the bridge uses (user/agent messages and the send_message delegation output) and skips the rest. Items that don't match the expected shape are still skipped, as before. Other endpoints keep the 4 MiB decode.

View in Indent
Tag @indent to continue the conversation here.

A task turn fetched with itemsView=full carries every tool call and command
output, and long tasks exceed the 4 MiB response cap, so the decode hit an
unexpected EOF on every attempt and the task's prompt and answer were never
bridged. Walk the turns response token by token, keep only the items that are
bridged, and allow up to 64 MiB for streamed responses.
@indent

indent Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Issues

All clear! No issues remaining. 🎉

1 issue already resolved
  • A streamed task-turns body truncated between tokens returns plain io.EOF, so the failure is logged as decode_error="empty body" even after megabytes were read. Map io.EOF to io.ErrUnexpectedEOF in the stream helpers once the opening delimiter is consumed. (fixed by commit 38efb6d)
    Found by Indent Review Agent

CI Checks

All CI checks passed on 38efb6d.

Review agents

Select any unchecked box below to run or rerun that agent.

Passed (1)
  • Indent Review Agent · No issues found
Full results

Indent Review Agent

  • Summary: No issues found
  • Last ran on commit: 38efb6d6
  • Latest result
    {
      "summary": "No issues found",
      "findings": []
    }

@indent indent Bot added the to be tested label Nov 1, 2026
Comment thread pkg/chatgpt/jsonstream.go Resolved
@iFixRobots
iFixRobots merged commit 707124d into main Nov 1, 2026
5 checks passed
@iFixRobots
iFixRobots deleted the indent/chatgpt-dots-stream-task-turns branch November 1, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants