Skip to content

fix(files): use a monotonic clock for processing timeout - #2657

Merged
HAYDEN-OAI merged 3 commits into
openai:mainfrom
mukeshr06:fix/file-processing-monotonic-timeout
Sep 8, 2026
Merged

HAYDEN-OAI merged 3 commits into
openai:mainfrom
mukeshr06:fix/file-processing-monotonic-timeout

Conversation

@mukeshr06

Copy link
Copy Markdown
Contributor
  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

files.waitForProcessing() measures maxWait with Date.now(). A system clock correction can therefore cause a premature timeout or allow a response after the elapsed-time budget.

Use performance.now() in the handwritten src/lib/file-processing.ts helper to measure elapsed time. Preserve the existing polling interval, terminal statuses, initially terminal response behavior, and strict > timeout check after retrieval.

Add public-client regression cases for forward and backward clock corrections, and update the existing elapsed-time mocks. Both new cases fail with the previous implementation and pass with this change. No generated SDK files or dependencies change.

Additional context & links

Validation on Node.js 24.19.0:

  • ./scripts/test tests/lib/file-processing.test.ts: 18 passed.
  • ./scripts/lint: passed.
  • ./node_modules/.bin/tsc: passed.
  • ./scripts/build: passed.
  • ./scripts/test: all 7,751 handwritten tests passed. Generated tests could not start locally because the pinned Steady installation failed while fetching the @std/cli manifest from JSR.
  • git diff --check: passed.

AI assistance: Codex was used to prepare and test this patch.

@mukeshr06
mukeshr06 requested a review from a team as a code owner September 6, 2026 07:38
gh-actions-shared Bot pushed a commit to xf-qubit/openai-node that referenced this pull request Sep 6, 2026
## Summary

- Use Node's monotonic clock for the Steady cache lock's existing
10-second acquisition budget.
- Add two regression tests through the actual cache CLI for backward and
forward wall-clock corrections. The test preloads and child program are
static; paths and clock direction are passed as data.
- Keep the 50-ms polling interval, cancellation, lease ownership,
separate cleanup acquisition, and wall-clock file-aging timestamps
unchanged. No generated files, SDK runtime code, dependency pins, or
cache policy changes.

## Reproduction

On current main, hold the lifecycle lock and release it after 12 real
seconds. With no clock adjustment, the wrapper rejects the command with
its existing lock-timeout error. With a single 60-second backward
`Date.now()` correction after the acquisition deadline is established,
the same wrapper incorrectly launches the command after roughly 12.1
seconds and exits successfully.

This unaccelerated command-boundary reproduction fails before the fix on
Node 22.0.0, 24.19.0, and 26.7.0. After the fix, both the normal-clock
and corrected-clock cases reject late execution on all three runtimes,
preserve the existing owner's lock until it is released, and leave no
leases. The separate cleanup lock explains why the final process exit
occurs after the fixture releases the lock; that lifecycle behavior is
not changed here.

## Validation

- Both new regressions failed before the production change and passed
afterward.
- New clock and existing cancellation tests: 8 passed on Node 22.0.0,
22.22.3, 24.19.0, and 26.7.0. An independent reviewer also repeated the
clock tests five times successfully.
- Canonical cache expiry, active-lease, and cleanup checks passed on
Node 22.0.0, 24.19.0, and 26.7.0.
- Full canonical handwritten suite on the final files: 7,800 tests
passed across 205 files.
- Canonical lint/format, TypeScript checking, CJS/ESM build, and `git
diff --check` passed.
- Independent adversarial review found no security, compatibility,
lock-ownership, cancellation, or regression-test issues. Windows was
reviewed for path/spawn compatibility but not executed locally; the
generated suite will run in CI.

This is separate from openai#2657's file-processing timeout and retains
openai#2636's Steady cancellation behavior.

@HAYDEN-OAI HAYDEN-OAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed d9c8f96. No actionable findings. The clock change preserves polling order, terminal-status handling, and the strict > timeout boundary. Source review only; tests were not run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-08T17:07:53.056107Z c5d027a New commits
🔒 Security Review ✅ Completed 2026-09-08T17:10:01.752081Z c5d027a New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

32 mixed files remain; 0 existing customizations changed.

Compared 80ce89f355dd → c5d027a0bd50. Generated baselines verified.

32 existing customizations unchanged
  • api.md
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py
  • src/client.ts
  • src/resources/audio/transcriptions.ts
  • src/resources/audio/translations.ts
  • src/resources/beta/assistants.ts
  • src/resources/beta/beta.ts
  • src/resources/beta/index.ts
  • src/resources/beta/responses/internal-base.ts
  • src/resources/beta/responses/responses.ts
  • src/resources/beta/threads/index.ts
  • src/resources/beta/threads/runs/index.ts
  • src/resources/beta/threads/runs/runs.ts
  • src/resources/beta/threads/threads.ts
  • src/resources/chat/completions/completions.ts
  • src/resources/chat/completions/index.ts
  • src/resources/conversations/index.ts
  • src/resources/embeddings.ts
  • src/resources/files.ts
  • src/resources/fine-tuning/checkpoints/permissions.ts
  • src/resources/images.ts
  • src/resources/responses/internal-base.ts
  • src/resources/responses/responses.ts
  • src/resources/skills/skills.ts
  • src/resources/skills/versions/versions.ts
  • src/resources/vector-stores/file-batches.ts
  • src/resources/vector-stores/files.ts
  • src/resources/webhooks/index.ts
  • src/resources/webhooks/webhooks.ts
  • tests/lib/data-residency.test.ts

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 34255106618 --repo openai/openai-node \
  --name castiron-custom-code-34255106618-1 --dir /tmp/castiron-custom-code-34255106618-1
git apply --stat /tmp/castiron-custom-code-34255106618-1/custom-code.patch
cat /tmp/castiron-custom-code-34255106618-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin 80ce89f355ddb2ea74e48da0284a85d536597446 c5d027a0bd5022d48a005eeacda3239a83f8efb7
python3 scripts/castiron/custom_code_report.py report \
  --base 80ce89f355ddb2ea74e48da0284a85d536597446 \
  --head c5d027a0bd5022d48a005eeacda3239a83f8efb7 --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-c5d027a0bd50
cat /tmp/castiron-custom-code-c5d027a0bd50/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@HAYDEN-OAI
HAYDEN-OAI added this pull request to the merge queue Sep 8, 2026
Merged via the queue into openai:main with commit bb0f51b Sep 8, 2026
24 checks passed
@openai-sdks openai-sdks Bot mentioned this pull request Sep 8, 2026
gh-actions-shared Bot pushed a commit to xf-qubit/openai-node that referenced this pull request Sep 9, 2026
Automated Release PR
---


##
[7.12.0](openai/openai-node@v7.11.0...v7.12.0)
(2026-09-08)


### Features

* **api:** add GPT Image 2.5 models and image options
([openai#2705](openai#2705))
([6500a16](openai@6500a16))


### Bug Fixes

* **assistants:** reject root IDs in run-step deltas
([openai#2698](openai#2698))
([63dfa4c](openai@63dfa4c))
* **files:** use a monotonic clock for processing timeout
([openai#2657](openai#2657))
([bb0f51b](openai@bb0f51b))
* preserve suppressed workload authorization
([openai#2699](openai#2699))
([57bbfd3](openai@57bbfd3))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: openai-sdks[bot] <284451331+openai-sdks[bot]@users.noreply.github.com>
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