test(bedrock): stabilize the cache-point-after-document integ test - #4119
Merged
opieter-aws merged 2 commits intoSep 2, 2026
Conversation
opieter-aws
marked this pull request as ready for review
September 1, 2026 21:38
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
|
Assessment: Approve Well-diagnosed, minimal test-only fix. The two changes cleanly address both root causes of the flake — the raised per-test timeout gives the SDK's throttle backoff room, and the terser prompt removes the slow-generation variable — without altering what the test verifies. Review notes
Nice, focused fix with a clear explanation of both root causes in the description. |
Unshure
approved these changes
Sep 2, 2026
This was referenced Sep 3, 2026
Merged
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.
Description
The
test_a_cache_point_after_a_document_is_accepted[pdf]integration test intermittently failed withTimeout (>90.0s). The global pytest ceiling is 90s, but the SDK's default throttle-retry backoff can reach ~124s on its own (4→8→16→32→64), and the[pdf]case compounds it by sending a ~100 KB document and asking the model toSummarize.— a slow generation. A throttled or slow run therefore outlasts the 90s ceiling before the SDK's own retry can finish.Two changes address both causes: a per-test
@pytest.mark.timeout(300)gives the throttle backoff room (matching other retry-heavy Bedrock tests in the suite), and the trailing instruction becomesReply OK.so the common path returns in seconds. The test only asserts the request is accepted (stop_reason == "end_turn") — it verifies theautocache strategy places a cache point around a document in a shape Bedrock accepts — so the terse prompt keeps coverage identical while cutting generation time.Related Issues
None — surfaced by a flaky CI integration-test run.
Documentation PR
None — test-only change.
Type of Change
Bug fix
Testing
Ran the target test against real Bedrock in
us-east-1, bothcsvandpdfparameters, four times: consistently passes in 5–11s (previously timing out at >90s), reachingstop_reason == "end_turn".ruffandmypyclean.hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.