Skip to content

Fix timeout error message and use time.monotonic() in openai batch trigger#69759

Open
magic-peach wants to merge 1 commit into
apache:mainfrom
magic-peach:fix-openai-trigger-timeout
Open

Fix timeout error message and use time.monotonic() in openai batch trigger#69759
magic-peach wants to merge 1 commit into
apache:mainfrom
magic-peach:fix-openai-trigger-timeout

Conversation

@magic-peach

Copy link
Copy Markdown

Fix a logic bug in the OpenAI batch trigger timeout error message. The previous code computed time.time() - self.end_time which produces a negative number since end_time is already in the past when the timeout fires. Replace with a clear message stating the batch did not complete within the configured timeout.

Also switch to time.monotonic() for the timeout check to align with the project coding standard (AGENTS.md: "time.monotonic() for durations, not time.time()").

Changes:

  • openai/triggers/openai.py: Fix timeout error message and use time.monotonic()
  • openai/operators/openai.py: Use time.monotonic() when setting the trigger end_time

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.7)

Generated-by: Claude Code (Opus 4.7) following the guidelines


Drafted-by: Claude Code (Opus 4.7) (no human review before posting)

The timeout error message computed time.time() - self.end_time which
produces a negative number since end_time is already in the past.
Replace with a clear message stating the batch did not complete within
the configured timeout.

Also switch to time.monotonic() for the timeout check to align with
the project coding standard.

Signed-off-by: Akanksha Trehun <akankshatrehun@gmail.com>

@SameerMesiah97 SameerMesiah97 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.

CI is failing for this one as well. My comment on PR #69758 broadly applies here too. In particular, I don't think time.time() should be replaced with time.monotonic() for the serialized trigger deadline, as this appears to introduce the same class of issue we previously fixed in #67616.

I also don't think the timeout error message change is an improvement, as it removes useful context (the configured timeout duration) that's helpful when debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants