Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/tests/attribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
13 changes: 11 additions & 2 deletions e2e/testutil/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
Expand Down
Loading