Skip to content

fix: Clamp negative timedelta in _get_remaining_time()#818

Merged
vdusek merged 2 commits intomasterfrom
fix/clamp-negative-remaining-time
Mar 2, 2026
Merged

fix: Clamp negative timedelta in _get_remaining_time()#818
vdusek merged 2 commits intomasterfrom
fix/clamp-negative-remaining-time

Conversation

@vdusek
Copy link
Contributor

@vdusek vdusek commented Mar 2, 2026

Summary

_get_remaining_time() could return a negative timedelta if the Actor's timeout had already passed. This clamps the result to timedelta(0) so callers never receive a negative remaining time.

Test plan

  • Added unit test verifying that a past timeout_at returns timedelta(0) instead of a negative value
  • Added unit test verifying that a future timeout_at returns a positive timedelta
  • CI passes

🤖 Generated with Claude Code

When `timeout_at` is already in the past, the subtraction produces a
negative timedelta that would be passed to API calls via `start`,
`call`, or `call_task` with `timeout='inherit'`. Clamp to zero instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Mar 2, 2026
@vdusek vdusek self-assigned this Mar 2, 2026
@vdusek vdusek requested a review from Pijukatel March 2, 2026 08:09
@github-actions github-actions bot added this to the 135th sprint - Tooling team milestone Mar 2, 2026
@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.92%. Comparing base (8e0e88d) to head (1371067).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #818      +/-   ##
==========================================
+ Coverage   85.88%   85.92%   +0.03%     
==========================================
  Files          46       46              
  Lines        2778     2778              
==========================================
+ Hits         2386     2387       +1     
+ Misses        392      391       -1     
Flag Coverage Δ
e2e 37.07% <0.00%> (ø)
integration 58.63% <0.00%> (ø)
unit 73.43% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the tested Temporary label used only programatically for some analytics. label Mar 2, 2026
Copy link
Contributor

@Pijukatel Pijukatel left a comment

Choose a reason for hiding this comment

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

Was there some issue connected to this?

@vdusek
Copy link
Contributor Author

vdusek commented Mar 2, 2026

Was there some issue connected to this?

Not aware of that, I noticed this while working on something else.

@vdusek vdusek merged commit 69b8af9 into master Mar 2, 2026
31 checks passed
@vdusek vdusek deleted the fix/clamp-negative-remaining-time branch March 2, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants