Skip to content

fix: deflake //rs/tests/idx:ii_delegation_test#9796

Merged
basvandijk merged 1 commit intomasterfrom
ai/deflake-ii_delegation_test-2026-04-09
Apr 9, 2026
Merged

fix: deflake //rs/tests/idx:ii_delegation_test#9796
basvandijk merged 1 commit intomasterfrom
ai/deflake-ii_delegation_test-2026-04-09

Conversation

@basvandijk
Copy link
Copy Markdown
Collaborator

Root Cause

The update() method in AgentWithDelegation is fire-and-forget — it sends the HTTP call but doesn't poll for execution through consensus. The test then asserts the counter was incremented using assert_canister_counter_with_retries, but with only 10 retries × 1s = 10 seconds total wait time, the update may not have been processed through consensus yet.

In the observed failure on 2026-04-08, the update was sent at 15:25:50 and the assertion timed out at 15:26:01 (~11 seconds), just barely exceeding the 10-second retry window.

Fix

Increased retry parameters from 10 retries × 1s (10s total) to 30 retries × 2s (60s total), giving ample time for the update to go through consensus.

Verified with --runs_per_test=3 --jobs=3 — all 3 runs passed (avg 67.9s).


This PR was created following the steps in .claude/skills/fix-flaky-tests/SKILL.md.

Increase retry parameters in assert_canister_counter_with_retries from
10 retries × 1s to 30 retries × 2s, giving 60 seconds total wait time
instead of 10 seconds.

Root cause: The update() method in AgentWithDelegation is fire-and-forget
(sends the HTTP call but doesn't poll for execution). The test then
asserts the counter was incremented, but with only 10 seconds of retry
time, the update may not have been processed through consensus yet.
In the observed failure on 2026-04-08, the update was sent at 15:25:50
and the assertion timed out at 15:26:01 (~11s), just exceeding the
10-second retry window.
@basvandijk basvandijk requested a review from Copilot April 9, 2026 15:16
@github-actions github-actions bot added the fix label Apr 9, 2026
@basvandijk basvandijk marked this pull request as ready for review April 9, 2026 15:17
@basvandijk basvandijk requested a review from a team as a code owner April 9, 2026 15:17
@github-actions github-actions bot added the @idx label Apr 9, 2026
@basvandijk basvandijk enabled auto-merge April 9, 2026 15:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR deflakes the //rs/tests/idx:ii_delegation_test system test by extending the retry window used when asserting that an update call has been reflected in canister state (i.e., after the update has gone through consensus).

Changes:

  • Increase assert_canister_counter_with_retries retry count from 10 to 30.
  • Increase per-retry wait from 1s to 2s to allow more time for consensus processing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rs/tests/idx/ii_delegation_test.rs
@basvandijk basvandijk added this pull request to the merge queue Apr 9, 2026
Merged via the queue into master with commit fba0e8e Apr 9, 2026
45 checks passed
@basvandijk basvandijk deleted the ai/deflake-ii_delegation_test-2026-04-09 branch April 9, 2026 16:04
daniel-wong-dfinity-org pushed a commit that referenced this pull request Apr 15, 2026
## Root Cause

The `update()` method in `AgentWithDelegation` is fire-and-forget — it
sends the HTTP call but doesn't poll for execution through consensus.
The test then asserts the counter was incremented using
`assert_canister_counter_with_retries`, but with only 10 retries × 1s =
10 seconds total wait time, the update may not have been processed
through consensus yet.

In the observed failure on 2026-04-08, the update was sent at 15:25:50
and the assertion timed out at 15:26:01 (~11 seconds), just barely
exceeding the 10-second retry window.

## Fix

Increased retry parameters from 10 retries × 1s (10s total) to 30
retries × 2s (60s total), giving ample time for the update to go through
consensus.

Verified with `--runs_per_test=3 --jobs=3` — all 3 runs passed (avg
67.9s).

---

This PR was created following the steps in
`.claude/skills/fix-flaky-tests/SKILL.md`.
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.

3 participants