feat: retry transient chatgpt.com failures in a fresh chat

Timeouts, UI glitches, text-only replies and browser errors get up to
CHATGPT_RETRIES extra attempts with a growing pause; a crashed browser is
relaunched. Usage limits, lost sessions and refusals still fail at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Opus 5.5 committed 2026-10-07 17:24:05 +02:00
1 parent d751acfe63
commit f7e7148135
7 files changed
+83 -15

No files matched your search

+2
View File
@@ -20,6 +20,8 @@ MCP client ──POST /mcp──▶ tools.ts ──▶ JobManager (serial queue,
6. Wait for a new image outside the user message, at least 256 px per side, fully loaded, with a `src` that stays the same for 3 polls and no "creating image" text. ChatGPT shows blurred partial previews first, so the first image seen is not the final one.
7. Download it through the browser request context (it carries the session cookies), validate size and format, store it as `<generationId>-<index>.<ext>`.
Transient failures (`TURN_TIMED_OUT`, `UI_CHANGED`, `NO_IMAGE_RETURNED`, `BROWSER_ERROR`, generic ChatGPT errors) are retried up to `CHATGPT_RETRIES` times, each in a new chat with a growing pause (`CHATGPT_RETRY_DELAY_SECONDS × attempt`); a crashed browser is relaunched first. Usage limits, lost sessions and content-policy refusals fail immediately. The final error message says how many attempts were made.
`image_count > 1` repeats this in a new chat per image. Every job runs alone because the profile can only be used by one browser.
## Lineage