Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(codex): raise the first-turn no-progress ceiling to 60s (MUL-5542) (#6192)

Bohan Jiang99d8f29bde59
diff --git a/server/pkg/agent/codex.go b/server/pkg/agent/codex.go
index fc0546f5c9..ec8a2d1524 100644
--- a/server/pkg/agent/codex.go
+++ b/server/pkg/agent/codex.go
@@ -44,9 +44,20 @@ const (
// rejects). Kept as its own constant so bumping codex independently of
// other agents stays easy if codex starts shipping longer failure traces.
const (
- codexStderrTailBytes = 2048
- defaultCodexSemanticInactivityTimeout = 10 * time.Minute
- defaultCodexFirstTurnNoProgressTimeout = 30 * time.Second
+ codexStderrTailBytes = 2048
+ defaultCodexSemanticInactivityTimeout = 10 * time.Minute
+ // defaultCodexFirstTurnNoProgressTimeout caps how long the first turn may
+ // stay completely silent after the app-server reports turn/started. Its only
+ // job is to fail fast instead of waiting out
+ // defaultCodexSemanticInactivityTimeout, so it only has to stay well under
+ // that 10 minute backstop.
+ //
+ // 30s turned out to sit inside the normal range rather than above it: two
+ // independent field reports measured the first progress event landing just
+ // past 30s on gpt-5.5, and ~39s for a WSL app-server (GH #5959). Both were
+ // healthy turns the watchdog killed. 60s clears that evidence with margin
+ // while keeping the fast-fail value (MUL-5542).
+ defaultCodexFirstTurnNoProgressTimeout = 60 * time.Second
defaultCodexHandshakeTimeout = 30 * time.Second
codexVersionDiagnosticTimeout = 2 * time.Second
// codexGracefulShutdownTimeout bounds how long the lifecycle goroutine
diff --git a/server/pkg/agent/codex_test.go b/server/pkg/agent/codex_test.go
index de52272f1f..507738ff8b 100644
--- a/server/pkg/agent/codex_test.go
+++ b/server/pkg/agent/codex_test.go
@@ -735,6 +735,37 @@ func TestCodexFirstTurnProgressActivity(t *testing.T) {
}
}
+// TestCodexFirstTurnNoProgressTimeoutClamp pins both halves of the first-turn
+// window: the 60s ceiling that a healthy gpt-5.5 turn has to fit under
+// (MUL-5542), and the fact that the configured semantic inactivity timeout can
+// only ever shrink it, never raise it. The second half is easy to misread as a
+// knob for the ceiling — it is not, and GH #5959 proposed removing the ceiling
+// entirely on that reading.
+func TestCodexFirstTurnNoProgressTimeoutClamp(t *testing.T) {
+ t.Parallel()
+
+ cases := []struct {
+ name string
+ semantic time.Duration
+ want time.Duration
+ }{
+ {name: "unset falls back to the ceiling", semantic: 0, want: 60 * time.Second},
+ {name: "negative falls back to the ceiling", semantic: -1 * time.Second, want: 60 * time.Second},
+ {name: "default 10m is capped at the ceiling", semantic: 10 * time.Minute, want: 60 * time.Second},
+ {name: "raising semantic cannot raise the ceiling", semantic: 2 * time.Minute, want: 60 * time.Second},
+ {name: "equal to the ceiling scales to 4/5", semantic: 60 * time.Second, want: 48 * time.Second},
+ {name: "below the ceiling scales to 4/5", semantic: 30 * time.Second, want: 24 * time.Second},
+ }
+
+ for _, tc := range cases {
+ t.Run(tc.name, func(t *testing.T) {
+ if got := codexFirstTurnNoProgressTimeout(tc.semantic); got != tc.want {
+ t.Fatalf("codexFirstTurnNoProgressTimeout(%s) = %s, want %s", tc.semantic, got, tc.want)
+ }
+ })
+ }
+}
+
func TestCodexSetTurnErrorFirstWins(t *testing.T) {
t.Parallel()