Skip to content

fix(test): improve asyncio.sleep use reliability#2961

Merged
marklysze merged 2 commits into
mainfrom
fix/background-agent-test-reliability
Jun 11, 2026
Merged

fix(test): improve asyncio.sleep use reliability#2961
marklysze merged 2 commits into
mainfrom
fix/background-agent-test-reliability

Conversation

@marklysze

@marklysze marklysze commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Why are these changes needed?

The Background agent test test_delivery_via_enqueue isn't reliable on the GitHub runner, likely due to some kind of resource contention.

test_delivery_via_enqueue verifies that a background agent's result reaches the orchestrator's LLM before the final reply. The wait_for_bg tool polls two signals, ctx.pending_messages (not yet drained) and DrainedModelRequest in stream history (already drained) - because _call_client drains the inbox before each LLM call, meaning the message can disappear from pending_messages before wait_for_bg runs. Both checks together cover both timing orderings of the asyncio race.

Similarly, the Network had two tests which relied on asyncio.sleep and have now been updated to be more deterministic.

Related issue number

N/A

Checks

AI assistance

  • I understand the changes in this PR and can explain them in my own words.
  • I have verified that the PR description accurately reflects the actual diff.
  • If AI assistance was used, I reviewed, tested, and validated the generated code/text before submitting.

@marklysze marklysze requested a review from Lancetnik as a code owner June 11, 2026 05:10
@github-actions github-actions Bot added the beta label Jun 11, 2026
@marklysze marklysze changed the title fix(test): Background agent test reliability fix(test): improve asyncio sleeping reliability Jun 11, 2026
@marklysze marklysze changed the title fix(test): improve asyncio sleeping reliability fix(test): improve asyncio.sleep reliability Jun 11, 2026
@marklysze marklysze changed the title fix(test): improve asyncio.sleep reliability fix(test): improve asyncio.sleep use reliability Jun 11, 2026
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
see 51 files with indirect coverage changes

🚀 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.

@marklysze marklysze merged commit fc17f70 into main Jun 11, 2026
28 checks passed
@marklysze marklysze deleted the fix/background-agent-test-reliability branch June 11, 2026 05:28
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.

1 participant