Skip to content

test(bedrock): stabilize the cache-point-after-document integ test - #4119

Merged
opieter-aws merged 2 commits into
strands-agents:mainfrom
opieter-aws:opieter-aws/stabilize-bedrock-cachepoint-test
Sep 2, 2026
Merged

opieter-aws merged 2 commits into
strands-agents:mainfrom
opieter-aws:opieter-aws/stabilize-bedrock-cachepoint-test

Conversation

@opieter-aws

@opieter-aws opieter-aws commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Description

The test_a_cache_point_after_a_document_is_accepted[pdf] integration test intermittently failed with Timeout (>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 to Summarize. — 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 becomes Reply OK. so the common path returns in seconds. The test only asserts the request is accepted (stop_reason == "end_turn") — it verifies the auto cache 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, both csv and pdf parameters, four times: consistently passes in 5–11s (previously timing out at >90s), reaching stop_reason == "end_turn". ruff and mypy clean.

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@opieter-aws
opieter-aws marked this pull request as ready for review September 1, 2026 21:38
@opieter-aws
opieter-aws requested a review from a team as a code owner September 1, 2026 21:38
@opieter-aws
opieter-aws requested a review from mkmeral September 1, 2026 21:38
@opieter-aws opieter-aws changed the title fix: increase timeout for flaky test test(bedrock): stabilize the cache-point-after-document integ test Sep 1, 2026
@github-actions github-actions Bot added chore Maintenance tasks, dependency updates, CI changes, refactoring with no user-facing impact python Pull requests that update python code area-community Related to community and contributor health size/xs labels Sep 1, 2026
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
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
  • Timeout marker: @pytest.mark.timeout(300) is consistent with the other retry-heavy integ tests in the suite (memory/* at 300, test_mantle_routing at 600), and the inline comment documents the rationale.
  • Prompt change: Coverage is preserved — the test only asserts stop_reason == "end_turn" (that the auto cache strategy produces a Bedrock-accepted shape), so Reply OK. keeps the assertion meaningful while cutting generation time. It also matches the existing convention already used in the sibling test_a_caller_ttl_does_not_conflict_with_the_tools_ttl test.
  • Scope: No public API impact, no duplicate functionality, well within size guidance.

Nice, focused fix with a clear explanation of both root causes in the description.

@opieter-aws
opieter-aws merged commit e13bfcd into strands-agents:main Sep 2, 2026
33 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-community Related to community and contributor health chore Maintenance tasks, dependency updates, CI changes, refactoring with no user-facing impact python Pull requests that update python code size/xs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants