Repository navigation
test: fix TestSessionHold_SurvivesRunnerPodDeleteAndRecreate conflict flake - #5
Merged
Merged
Conversation
TestSessionHold_SurvivesRunnerPodDeleteAndRecreate flaked in CI with: Operation cannot be fulfilled on agentsessions... the object has been modified; please apply your changes to the latest version and try again touchSession does Get -> mutate annotation -> Update with no conflict retry. Its whole purpose is to provoke the AgentSession reconciler, which is concurrently writing the same object's status (the hold reap bumps resourceVersion). When that write lands between the test's Get and Update, the unretried Update loses the optimistic-concurrency race and fails the test spuriously. Wrap the read-modify-write in retry.RetryOnConflict(retry.DefaultRetry, ...), matching the idiom already used for the same reason in test/e2e/harness.go's ApplyManifest.
josephschorr
force-pushed
the
fix/sessionhold-test-conflict-retry
branch
from
September 28, 2026 19:47
9b2cd7e to
2438c0e
Compare
samkim
approved these changes
Sep 28, 2026
9 of 11 tasks
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.
Problem
TestSessionHold_SurvivesRunnerPodDeleteAndRecreateflaked in e2e CI (seen on PR #3, whose own change is unrelated) with:Proof it's a flake, not a regression: that run and its sibling
push-triggered run were on the same commit — one failed here, the other passed.Cause
touchSessiondoesGet→ mutate annotation →Updatewith no conflict retry. Its entire purpose is to provoke theAgentSessionreconciler, which is concurrently writing the same object's status (the hold reap bumpsresourceVersion— the failing run's log shows two "reaped session pods" reconciles firing on that object right before the error). When that write lands between the test'sGetandUpdate, the unretriedUpdateloses the optimistic-concurrency race and fails the test spuriously.Fix
Wrap the read-modify-write in
retry.RetryOnConflict(retry.DefaultRetry, ...)— the idiom already used for exactly this reason intest/e2e/harness.go'sApplyManifest. Test-only change; no product code touched.