Repository navigation
test: make the durable approval timeout test deterministic - #2029
Merged
Merged
Conversation
4pmtong
marked this pull request as ready for review
October 9, 2026 04:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test_durable_approval_wait_outlives_agent_execution_timeoutsometimes fails on CI. It raisesCancelledErroratawait waiter, which surfaces asTimeoutErrorfromasync with ActiveExecutionTimeout(0.02).The test gave the agent a 20 ms budget on the real event-loop clock. Before the approval wait can pause that budget,
authorize_tool_checkpointevaluates the permission policy and writes the approval to SQLite. On a slow runner, that work can take longer than 20 ms. The pause then saves a remaining budget of zero. When the wait resumes after the decision, the timeout fires right away and cancels the test task.Product behavior is correct here. Active work before the wait should count against the budget. Only the test's timing assumption is wrong.
Changes
monkeypatch.context()and restored afterwards. Only the simulated human wait moves the clock, so SQLite writes and task scheduling no longer decide whether the budget runs out.No product code changes.
Testing
uv run pytest tests/app/permission_policy: 152 passed.ruff check,ruff format --check, andgit diff --checkpass.