From 0277d038302594255e9bdc2e1681c0a53737d2b5 Mon Sep 17 00:00:00 2001 From: Alisha Kawaguchi Date: Fri, 20 Mar 2026 16:39:55 -0700 Subject: [PATCH] fix: increase commit assertion timeout for multi-turn E2E test In TestInteractiveAttributionMultiCommitSameSession, WaitFor can match stale pane content from the previous turn, causing AssertNewCommits to start its countdown before the agent begins the second commit. Extract AssertNewCommitsWithTimeout with configurable timeout and use 60s for the second-turn assertion to prevent flaky failures. Co-Authored-By: Claude Opus 4.6 (1M context) Entire-Checkpoint: efb0cc7a2701 --- e2e/tests/attribution_test.go | 2 +- e2e/testutil/assertions.go | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/e2e/tests/attribution_test.go b/e2e/tests/attribution_test.go index 50804f467..0b19c1c9b 100644 --- a/e2e/tests/attribution_test.go +++ b/e2e/tests/attribution_test.go @@ -99,7 +99,7 @@ func TestInteractiveAttributionMultiCommitSameSession(t *testing.T) { // Second prompt: modify same file and commit again. s.Send(t, session, "add another stanza to poem.txt about debugging, then create a NEW commit (do not amend). Do not ask for confirmation.") s.WaitFor(t, session, prompt, 90*time.Second) - testutil.AssertNewCommits(t, s, 2) + testutil.AssertNewCommitsWithTimeout(t, s, 2, 60*time.Second) testutil.WaitForCheckpointAdvanceFrom(t, s.Dir, cpBranch1, 15*time.Second) cpID2 := testutil.AssertHasCheckpointTrailer(t, s.Dir, "HEAD") diff --git a/e2e/testutil/assertions.go b/e2e/testutil/assertions.go index 67cfc393e..5a64fa399 100644 --- a/e2e/testutil/assertions.go +++ b/e2e/testutil/assertions.go @@ -61,7 +61,16 @@ func WaitForFileExists(t *testing.T, dir string, glob string, timeout time.Durat // agent's prompt pattern appears before its git commit lands on disk. func AssertNewCommits(t *testing.T, s *RepoState, atLeast int) { t.Helper() - deadline := time.Now().Add(20 * time.Second) + AssertNewCommitsWithTimeout(t, s, atLeast, 20*time.Second) +} + +// AssertNewCommitsWithTimeout is like AssertNewCommits but with a configurable +// timeout. Use this when WaitFor may settle on stale pane content (e.g. +// multi-turn interactive tests where the previous turn's prompt is still +// visible), giving the agent more time to complete its commit. +func AssertNewCommitsWithTimeout(t *testing.T, s *RepoState, atLeast int, timeout time.Duration) { + t.Helper() + deadline := time.Now().Add(timeout) for { out := GitOutput(t, s.Dir, "log", "--oneline", s.HeadBefore+"..HEAD") var lines []string @@ -72,7 +81,7 @@ func AssertNewCommits(t *testing.T, s *RepoState, atLeast int) { return } if time.Now().After(deadline) { - t.Fatalf("expected at least %d new commit(s), got %d after 20s", atLeast, len(lines)) + t.Fatalf("expected at least %d new commit(s), got %d after %s", atLeast, len(lines), timeout) } time.Sleep(500 * time.Millisecond) }