Skip to content

CI: retry transient HTTP timeouts in Studio smoke probes#7052

Merged
danielhanchen merged 3 commits into
mainfrom
ci-harden-smoke-http-retries
Jul 10, 2026
Merged

CI: retry transient HTTP timeouts in Studio smoke probes#7052
danielhanchen merged 3 commits into
mainfrom
ci-harden-smoke-http-retries

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

The Studio inference smoke workflows (studio-inference-smoke.yml, studio-mac-inference-smoke.yml, studio-windows-inference-smoke.yml) probe the local Studio server with a post() helper that does a single urllib.request.urlopen with a 240s timeout. On shared runners this sporadically raises TimeoutError: timed out while the server is stalled, failing the whole 25 minute job for one transport hiccup.

This is a recurring flake, not a code signal: the same timeout hit the "JSON, images" job on #7042 and #7043 and the "Tool calling Tests" step on a Windows staging run, on unrelated diffs, and every occurrence passed on plain re-run.

Change

Retry the probe in post() up to 3 times, 15s apart, on transport-level failures only: TimeoutError, ConnectionError, and non-HTTP URLError.

  • HTTPError re-raises immediately, so any response the server actually produced (4xx/5xx) still fails on the first attempt and genuine regressions surface unchanged.
  • post_sse() is deliberately untouched: it has a 600s budget and has not flaked.
  • Worst case adds about 8.5 minutes, inside the 25/30 minute job budgets.
  • Same change applied to all 6 post() definitions (2 per OS workflow), plus the time / urllib.error imports.

These probes hit a seeded local test server, so re-sending a request is safe.

Validation

  • YAML parse plus ast.parse of every inline python block in the three workflows.
  • Unit-checked the retry semantics: timeout-twice-then-ok succeeds on attempt 3; HTTP 500 surfaces immediately with no retry; a permanent timeout re-raises after 3 attempts.
  • Ran the three edited workflows end to end on a staging repo before opening this PR (each workflow self-triggers on edits to its own file): all runs green on ubuntu, macos, and windows, 40/40 including the full Studio suites.

The post() helper in the Studio inference smoke workflows does a single
urlopen with a 240s timeout against the local Studio server. On shared
runners this sporadically hits TimeoutError while the server is stalled,
failing the whole job for a transport hiccup; the same flake has recurred
across unrelated PRs on Linux and Windows (JSON/images and tool-calling
jobs) and passes on rerun.

Retry the probe up to 3 times on transport-level failures only
(TimeoutError, ConnectionError, non-HTTP URLError), 15s apart. HTTP
status errors still surface immediately, so genuine server failures are
unaffected. post_sse() is left unchanged: it has a 600s budget and has
not flaked.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc76ce3391

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return resp.status, json.loads(resp.read().decode())
# Shared CI runners stall sporadically, so retry transport-level
# failures only; HTTP status errors surface immediately.
for attempt in range(3):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Cap retries to fit the job timeout

This unconditional three-attempt loop also wraps the JSON/images helper, where the Linux job calls post(..., timeout = 600) while the whole job is limited to 30 minutes. If that probe times out more than once, this step alone can spend about 30.5 minutes before re-raising, after install/model-load time has already elapsed, so the workflow is likely to be killed by the job timeout instead of failing with the Python error and collecting the later logs; the Windows JSON copy has the same risk across its 600-second probes. Please bound the total retry deadline or reduce/disable retries for the long-timeout calls.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in b4c02db: retries now apply only when timeout <= 300s (the observed flaky 180-240s probes), so the 600s json-images calls keep their single attempt and worst-case step time stays well inside timeout-minutes.

Some json-images calls pass timeout=600; three attempts there could spend
30 minutes in one step and hit the job's timeout-minutes instead of failing
with the Python error. Retry (3 attempts) only when timeout <= 300s, which
covers the observed flaky 180-240s probes; longer probes keep the pre-PR
single attempt.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Jul 10, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Jul 10, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4c02db66f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# failures only; HTTP status errors surface immediately. Long
# probes (timeout > 300s) get a single attempt so the worst
# case stays inside the job's timeout-minutes budget.
attempts = 3 if timeout <= 300 else 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retry the long JSON probe instead of disabling it

In this JSON/images block the only raw urllib probe below calls post(..., timeout = 600) (line 1017), so this ternary sets attempts to 1 and the new retry path is never used for the long JSON-mode request. The same pattern exists in the Windows JSON/images job for its raw posts, so a transient TimeoutError in those probes will still fail on the first occurrence despite this change.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in e739dc1: long probes now get one retry with the attempt timeout capped at 300s, so the 600s JSON-mode probes are covered while worst-case wall time still fits timeout-minutes (one long probe 15.25 min; the Windows JSON job's two long probes 30.5 min vs its 35 minute budget).

Round two of bounding the retries: timeout>300s probes previously got a
single attempt, so a transient stall in the 600s JSON-mode probes still
failed on first occurrence. Give them one retry with the attempt timeout
capped at 300s. Worst cases stay inside timeout-minutes: 240s probes
12.5 min, one 600s probe 15.25 min, the Windows JSON job's two long
probes 30.5 min against its 35 minute budget.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Jul 10, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: e739dc1cca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen danielhanchen merged commit fbcd3fa into main Jul 10, 2026
23 checks passed
@danielhanchen danielhanchen deleted the ci-harden-smoke-http-retries branch July 10, 2026 10:07
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