You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flaky: session-manager real-shellper tests use fixed wall-clock deadlines that fail under full-suite load (CI-skipped, so only local/porch runs see them) #1800
packages/codev/src/terminal/__tests__/session-manager.test.ts:1385 ("SessionManager > auto-restart logic > applies crashLoopFallback after repeated fast failures") fails intermittently under full-suite load:
:1430 expect(fs.existsSync(sentinel)).toBe(true) // got false, after 10.4s
Observed twice by porch's tests check on spir-1789 (runs of ~72s; the same suite passes at ~44s), reproduced on the 4th of 6 captured runs of porch's exact command (npm test -- --exclude='**/e2e/**', stdin ignored). Eight additional manual runs were green. The test is it.skipIf(!!process.env.CI), so CI never sees it; only local and porch runs do, which is why it has survived.
Root cause
The test launches a real shellper with a command that exits immediately (/bin/sh -c 'exit 1', restartOnExit: true, restartDelay: 100, maxRestarts: 10) and then polls a sentinel file for a fixed 10 000 ms wall-clock deadline:
Reaching the fallback requires several real process spawns and exits in sequence. Under a loaded machine (the full suite runs its other files in parallel) that sequence can exceed 10 s, so the deadline fires before the fallback launch has touched the sentinel. The test's own it(..., 20000) timeout is generous; it is the inner deadline that is tight.
Fix shape (hypothesis)
Derive the wait from the restart schedule rather than a constant (e.g. maxRestarts * restartDelay plus a per-spawn allowance scaled for load), or
Observe the fallback application through the existing crashLoopFallback.onApply callback (already asserted later in the test) instead of polling the filesystem, and wait on that promise with the outer test timeout as the only bound.
Audit the three sibling CI-skipped tests in the same block (respects maxRestarts limit :1334, bounds a harness that exits 0 immediately :1447) for the same fixed-deadline shape.
Unrelated to spir-1789's changes (no terminal files touched there); recorded under Flaky Tests in that lane's review.
Two more tests in the same file and the same family (real shellper + fixed wall-clock deadline, CI-skipped, so only local and porch runs see them), reported by builders on 2026-10-13:
session-manager.test.ts › "no stderr tail logged for file-based stderr (Bugfix Shellper processes do not survive Tower restart despite detached:true #324)": timed out waiting for the session-exit event in 2 of 4 full-suite runs on the spir-1797 lane, once even when run alone. The builder skipped it with a FLAKY annotation pointing here (Codex and Claude both asked for a tracking issue; this is it).
session-manager.test.ts › "logs session exit without stderr tail (stderr goes to file)": hit the 15 s timeout under full-suite load on the spir-1789 lane; passes 3/3 in isolation (recorded in that lane's review under Flaky Tests).
Scope of this issue therefore widens from one test to the block of real-shellper tests in that file: the crash-loop fallback test (original report), the maxRestarts and exit-0 siblings named in the fix shape, and the two stderr-tail tests above. Same fix shape: derive waits from the restart schedule or observe the event directly, and bound only by the outer test timeout.
Seen once on spir-1797, different family, not tracked yet: a forge pr-create test failed on a missing CODEV_PR_TITLE during one porch test-check run and passed on immediate rerun.
changed the title [-]Flaky: session-manager crashLoopFallback test uses a fixed 10s wall-clock deadline that fails under full-suite load (CI-skipped, so only local/porch runs see it)[/-][+]Flaky: session-manager real-shellper tests use fixed wall-clock deadlines that fail under full-suite load (CI-skipped, so only local/porch runs see them)[/+]on Oct 13, 2026
PR #1808 (Spec 1797) changes session-manager.test.ts › "no stderr tail logged for file-based stderr (Bugfix #324)" from it.skipIf(CI) to it.skip with a FLAKY annotation citing this issue. Restoring that test is part of resolving this issue; do not leave it skipped once the deadline fix lands.
The event-based rewrite of the three auto-restart tests (branch builder/spir-1658, commit 28631aa, "Refs #1800") did not cure this. After the Windows triage, "respects maxRestarts limit" failed 2 of 4 full-suite POSIX runs by hitting the 30 s outer timeout, with the test now waiting on the session-gave-up event rather than a fixed deadline.
Three 100 ms restarts take well under a second, so the test is stuck, not slow.
It passes alone (3 of 3) and under ten CPU-burner processes (6 of 6). Load alone does not reproduce it.
Launch-to-fallback timing with nothing else running: branch 296-315 ms, main 290-317 ms.
So the original "fixed wall-clock deadline under load" explanation is at most part of it. Something in the full-suite environment leaves a restart cycle hanging: a candidate is a lost exit event or a restart that never fires when another test's shellper activity overlaps. The remaining lead is to capture the restart log of a stuck run inside the suite rather than in isolation.
In 1658 the test is skipped with a FLAKY annotation naming this issue, recorded under Flaky Tests in that lane's review. That skip is temporary and this issue stays open to remove it.
"bounds a harness that exits 0 immediately" (same auto-restart logic block) hung for the full 30 s outer timeout in porch's tests check on builder/spir-1658 and in 1 of 2 replica full-suite runs. It then did not recur in 18 instrumented full POSIX runs over 30 minutes, so no restart log was captured. In 1658 it is skipped as FLAKY naming this issue, like "respects maxRestarts limit", and the instrumentation stays in the test: if the session-gave-up event does not arrive within 25 s it dumps the SessionManager's timestamped restart log and any emitted errors. Whoever un-skips it gets that dump on the next hang.
Also in that loop: "logs session exit without stderr tail" timed out once. That was a plain test race (it subscribed to session-exit after createSession, which exit 0 can beat) and is fixed in 1658, not skipped. The two skipped tests already subscribe before createSession, so their hang is something else.
Status: two of the three auto-restart real-shellper tests are now skipped on this issue; the hang reproduces only inside a full-suite run, not alone and not under CPU load.
Activity
amrmelsayed commentedon Oct 13, 2026
Two more tests in the same file and the same family (real shellper + fixed wall-clock deadline, CI-skipped, so only local and porch runs see them), reported by builders on 2026-10-13:
session-manager.test.ts› "no stderr tail logged for file-based stderr (Bugfix Shellper processes do not survive Tower restart despite detached:true #324)": timed out waiting for the session-exit event in 2 of 4 full-suite runs on the spir-1797 lane, once even when run alone. The builder skipped it with a FLAKY annotation pointing here (Codex and Claude both asked for a tracking issue; this is it).session-manager.test.ts› "logs session exit without stderr tail (stderr goes to file)": hit the 15 s timeout under full-suite load on the spir-1789 lane; passes 3/3 in isolation (recorded in that lane's review under Flaky Tests).Scope of this issue therefore widens from one test to the block of real-shellper tests in that file: the crash-loop fallback test (original report), the
maxRestartsand exit-0 siblings named in the fix shape, and the two stderr-tail tests above. Same fix shape: derive waits from the restart schedule or observe the event directly, and bound only by the outer test timeout.Seen once on spir-1797, different family, not tracked yet: a forge pr-create test failed on a missing
CODEV_PR_TITLEduring one porch test-check run and passed on immediate rerun.[-]Flaky: session-manager crashLoopFallback test uses a fixed 10s wall-clock deadline that fails under full-suite load (CI-skipped, so only local/porch runs see it)[/-][+]Flaky: session-manager real-shellper tests use fixed wall-clock deadlines that fail under full-suite load (CI-skipped, so only local/porch runs see them)[/+][Spec 1797][Phase: phase_5] feat: three-way review of the bootstrappe…
amrmelsayed commentedon Oct 13, 2026
PR #1808 (Spec 1797) changes
session-manager.test.ts› "no stderr tail logged for file-based stderr (Bugfix #324)" fromit.skipIf(CI)toit.skipwith a FLAKY annotation citing this issue. Restoring that test is part of resolving this issue; do not leave it skipped once the deadline fix lands.[Spec 1658][Phase: phase_9] test: auto-restart real-shellper tests wa…
[Spec 1658][Phase: phase_9] Thread: Phase 9 CMAP and #1800 notes
[Spec 1658][Phase: phase_10] Windows triage round 3: census-bound res…
amrmelsayed commentedon Oct 23, 2026
New evidence from 1658's lane (2026-10-23)
The event-based rewrite of the three auto-restart tests (branch builder/spir-1658, commit 28631aa, "Refs #1800") did not cure this. After the Windows triage, "respects maxRestarts limit" failed 2 of 4 full-suite POSIX runs by hitting the 30 s outer timeout, with the test now waiting on the session-gave-up event rather than a fixed deadline.
So the original "fixed wall-clock deadline under load" explanation is at most part of it. Something in the full-suite environment leaves a restart cycle hanging: a candidate is a lost exit event or a restart that never fires when another test's shellper activity overlaps. The remaining lead is to capture the restart log of a stuck run inside the suite rather than in isolation.
In 1658 the test is skipped with a FLAKY annotation naming this issue, recorded under Flaky Tests in that lane's review. That skip is temporary and this issue stays open to remove it.
[Spec 1658][Phase: phase_10] #1800: skip 'bounds a harness that exits…
amrmelsayed commentedon Oct 23, 2026
Second recurrence, different test (2026-10-23)
"bounds a harness that exits 0 immediately" (same
auto-restart logicblock) hung for the full 30 s outer timeout in porch's tests check on builder/spir-1658 and in 1 of 2 replica full-suite runs. It then did not recur in 18 instrumented full POSIX runs over 30 minutes, so no restart log was captured. In 1658 it is skipped as FLAKY naming this issue, like "respects maxRestarts limit", and the instrumentation stays in the test: if the session-gave-up event does not arrive within 25 s it dumps the SessionManager's timestamped restart log and any emitted errors. Whoever un-skips it gets that dump on the next hang.Also in that loop: "logs session exit without stderr tail" timed out once. That was a plain test race (it subscribed to session-exit after createSession, which
exit 0can beat) and is fixed in 1658, not skipped. The two skipped tests already subscribe before createSession, so their hang is something else.Status: two of the three auto-restart real-shellper tests are now skipped on this issue; the hang reproduces only inside a full-suite run, not alone and not under CPU load.