Skip to content

Deflake concurrent_transactions_same_state by allowing retries - #152

Merged
aviator-app[bot] merged 1 commit into
mainfrom
rjh.concurrent-transactions-rendezvous
Sep 3, 2026
Merged

Deflake concurrent_transactions_same_state by allowing retries#152
aviator-app[bot] merged 1 commit into
mainfrom
rjh.concurrent-transactions-rendezvous

Conversation

@rjhuijsman

@rjhuijsman rjhuijsman commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

tests/reboot/pydantic/concurrent_transactions_same_state and its zod twin were failing intermittently on the MacOS arm64 CI job. This PR fixes that flake.

The failure on MacOS only is due to the Mac runners being highly loaded, therefore very slow, and therefore they accidentally exercise Reboot's retry mechanisms. In that environment our tests must allow some (legal, correct) retries; if they don't, we get flakes.

In this test, the subtest test_nested_transactions_on_one_state_are_parallel counts the number of time an inner function is run - there are 20 parallel callers, so it expects inner to be run 20 times. That's incorrect in the face of retries, in two ways:

  1. inner will be run at least 20 times, but can be run more times.
  2. Even if inner were run exactly 20 times, that doesn't prove the desired property that 20 parallel callers ran - it may have been any number of callers up to 20, since any of them may retry any number of times.

This PR fixes that by changing how we count callers: by counting unique names of callers (rather than just call count) we build a picture that's robust in the face of retries.

TESTED: the test still passes locally on Linux. That does not verify the flake is fixed, since the flake only occurs on MacOS arm64 runners (due to their heavy load) and don't repro locally or on Linux CI. The claim that the flake is fixed is based on log+code inspection

@aviator-app

aviator-app Bot commented Sep 2, 2026

Copy link
Copy Markdown

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR was merged using Aviator (commit 0c670ad).


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

@rjhuijsman rjhuijsman changed the title tests: rendezvous on driver names, not on arrival counts Deflake concurrent_transactions_same_state by allowing retries Sep 3, 2026
@rjhuijsman
rjhuijsman requested a balanced review from Copilot September 3, 2026 08:43
@rjhuijsman
rjhuijsman marked this pull request as ready for review September 3, 2026 08:43
@rjhuijsman rjhuijsman self-assigned this Sep 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The mirrored implementations correctly preserve concurrency validation while tolerating legal transaction retries.

Pull request overview

Deflakes mirrored transaction-concurrency tests by tracking unique callers across retries.

Changes:

  • Replace arrival counters with caller-ID sets.
  • Pass driver IDs into nested transactions.
  • Update assertions and retry documentation.
File summaries
File Description
tests/reboot/zod/concurrent_transactions_same_state/test.ts Checks unique Zod callers.
tests/reboot/zod/concurrent_transactions_same_state/servicer.ts Tracks and forwards Zod driver IDs.
tests/reboot/zod/concurrent_transactions_same_state/servicer_api.ts Adds the Zod driver-ID request field.
tests/reboot/pydantic/concurrent_transactions_same_state/test.py Checks unique Pydantic callers.
tests/reboot/pydantic/concurrent_transactions_same_state/servicer.py Tracks and forwards Pydantic driver IDs.
tests/reboot/pydantic/concurrent_transactions_same_state/servicer_api.py Adds the Pydantic driver request model.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

`test_nested_transactions_on_one_state_are_parallel` failed
intermittently on the MacOS arm64 CI runner, and always by
overshooting: `40 != 20` (every driver counted twice), `59 !== 20`,
and once a 300s timeout. It never reproduced on Linux.

The `Rendezvous` that the test met at counted invocations of
`inner()`. Reboot guarantees that a transaction happens once, not
that the code inside it is invoked once: when a root transaction
aborts, the `ExternalContext` stub retries it, re-running
`call_inner` and with it the nested `inner()` on the shared
`COUNTER_ID`. On a slow runner such an abort is easy to come by,
whether from a lock acquire that exceeds
`LOCK_ACQUIRE_DEADLINE_DEFAULT` or from a participant raising
`TransactionShouldRetryWithoutBackoff`, so the count climbed past
`CONCURRENCY`.

Counting invocations was also a weaker check than it looked: a
driver counted twice can stand in for one that has not arrived at
all, opening the meeting point while only 19 transactions really
overlap.

`Rendezvous` now collects the names of the drivers that have
arrived and opens once it holds `expected` distinct ones, so a
retried transaction arrives idempotently and the assertion stays
exact. `inner` takes the driver's name in its request, because it
runs on the peer's state, which is the same state for every driver,
and so cannot work out who called it from its own context.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VTP67vX9mZusQwMrNCZw1r
@rjhuijsman
rjhuijsman force-pushed the rjh.concurrent-transactions-rendezvous branch from a2fb129 to 868aba3 Compare September 3, 2026 09:03
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@rjhuijsman
rjhuijsman marked this pull request as draft September 3, 2026 09:19
@rjhuijsman
rjhuijsman requested a review from onelxj September 3, 2026 11:52
@rjhuijsman
rjhuijsman marked this pull request as ready for review September 3, 2026 11:52
@aviator-app
aviator-app Bot merged commit 0c670ad into main Sep 3, 2026
26 checks passed
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