Skip to content

[codex] Handle sync timeout without fallback#7

Merged
chengzeyi merged 2 commits into
mainfrom
codex/sync-timeout-errors
Jun 16, 2026
Merged

[codex] Handle sync timeout without fallback#7
chengzeyi merged 2 commits into
mainfrom
codex/sync-timeout-errors

Conversation

@chengzeyi

Copy link
Copy Markdown
Member

What changed

  • Removed the Python SDK's sync-to-async fallback on gateway timeout.
  • Added sync-timeout error formatting that preserves the task ID and result URL.
  • Kept successful run() return shape unchanged (outputs only).
  • Updated README/docstrings to describe sync mode as a best-effort initial wait.
  • Added a regression test proving sync timeout does not fallback, poll, or resubmit even with max_retries set.

Why

When sync mode times out, the submitted prediction continues processing asynchronously and can be queried later. The SDK should surface that fact instead of silently changing execution mode.

User impact

run(..., enable_sync_mode=True) now raises an actionable error on server-side sync timeout. The error includes the task ID/result URL so users can query the prediction later.

Validation

  • PYTHONPATH=src python -m pytest tests/test_api.py
  • git diff --check

@claude

claude Bot commented Jun 16, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@claude

claude Bot commented Jun 16, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@chengzeyi chengzeyi marked this pull request as ready for review June 16, 2026 17:35
@chengzeyi chengzeyi merged commit 19c2efa into main Jun 16, 2026
1 of 2 checks passed
@chengzeyi chengzeyi deleted the codex/sync-timeout-errors branch June 16, 2026 17:35

@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: 2384fbb608

ℹ️ 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".

try:
request_id, sync_result = self._submit(
model, input, enable_sync_mode=use_sync, timeout=timeout
model, input, enable_sync_mode=enable_sync_mode, timeout=timeout

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 Stop resubmitting timed-out sync requests

When enable_sync_mode=True and the initial POST ends with an HTTP 504/502 sync timeout, _submit raises a RuntimeError containing HTTP 5, so _is_retryable_error() treats it as task-retryable and this call resubmits the same sync job on every max_retries attempt. That undermines the new no-fallback/no-resubmit behavior for sync timeouts and can create duplicate predictions for users who configure task retries.

Useful? React with 👍 / 👎.

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