Skip to content

fix(diagnostics): retain root exit facts at probe timeout - #552

Merged
stamp-build[bot] merged 1 commit into
mainfrom
agent/otter/probe-exit-diagnostics
Oct 30, 2026
Merged

stamp-build[bot] merged 1 commit into
mainfrom
agent/otter/probe-exit-diagnostics

Conversation

@stamp-build

@stamp-build stamp-build Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Otter from open-agent-runtime opened this pull request through Stamp
View in Stamp →


A one-shot CLI probe can time out after its root process has already exited because a descendant still holds stdout or stderr. The previous diagnostic did not distinguish that case from a root that had not emitted exit.

Capture the root's observed exit time, elapsed duration, code and signal, plus whether close has arrived, when the deadline fires and before cleanup. Preserve that snapshot in the failure cause and readable error. Return semantics, default and explicit deadlines, cancellation, pipe draining and process cleanup are unchanged. This adds evidence for task #97; it does not identify the cause of historical CLI timeouts.

Validation:

  • CI=1 pnpm run check: 2,520 tests and 18 mock behavior cases passed.
  • All 14 shared behavior backends passed in three bounded-concurrency batches, using the pinned native versions and local scripted providers or native replay.
  • Real descendant-held-pipe regressions failed on the missing observations before the fix, then passed. They distinguish an already-exited root from a still-running root, preserve the pre-cleanup snapshot, and retain the original settlement and cleanup assertions.
  • The version-probe error snapshot verifies both the readable message and structured cause. Normal exits, native errors and cancellation retain their prior diagnostics.

The separate Windows handle experiment is recorded in task #97 (run 41030609576); the CI monitor change is a separate pull request. This change belongs after 0.79.0.

@stamp-build
stamp-build Bot force-pushed the agent/otter/probe-exit-diagnostics branch from 35ed58d to 245c957 Compare October 30, 2026 13:22
stamp-build Bot added a commit that referenced this pull request Oct 30, 2026
<!-- stamp:review:v1 -->
<sup><img
src="https://cdn.slock.ai/avatars/6aabf32c-20bc-4cba-b55a-2aa72b60999b/8ba4452ceb890f1930886ef4286fdb99.webp"
width="16" height="16" align="absmiddle" alt=""> <b>Otter</b> from
open-agent-runtime opened this pull request through
Stamp</sup><br><sup><a
href="https://stamp.build/review?receipt=prc_3dd8b04ccc82e063671c93b204cfab1b"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img
src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg"
width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp
→</a></sup>

---
<!-- /stamp:review:v1 -->

The Windows CI monitor called `Process.Kill(true)` synchronously after a
case or command deadline. If that call did not return, the monitor could
not exit and reach the artifact upload step.

Run termination on a background worker and bound the total termination
wait to ten seconds. A returned call retains a root-exit observation of
up to five seconds within the remaining budget; a nonreturning or thrown
call records its own checkpoint. All timeout paths flush the final
`stage_exit` record and exit 124 without joining the worker, disposing
the shared process, or taking another CIM sample. Normal commands retain
their native exit codes and inherited output. Exit 124 does not claim
that every descendant stopped; residual cleanup belongs to the runner.

The actual termination helper has real-child regressions for native
termination, a never-returning call, an exception, and a slow returned
call whose target remains alive. They observe root `exit` separately
from pipe `close`, enforce the total budget, retain evidence in both
sinks and clean up the synthetic targets. The existing command and
blocked-worker assertions remain, with the final stage checkpoint now
also checked in stdout.

Validation and evidence:
- `CI=1 pnpm run check` with PowerShell 7.6.9 enabled: 2,523 tests,
including the four actual-helper cases, and 18 mock behavior cases
passed.
- Two Windows investigation runs are preserved in
`experiments/windows-handles/README.md`, with repeatable scripts. The
second run passed: inherited handles delayed the next step 5533 ms
versus 488 ms with files; injected nonreturning termination waited 10005
ms and the root exited 124 another 99 ms after its checkpoint while the
target and pipes were still alive.
- The first collector's failure is retained: it awaited `close`, so it
could not determine whether the root was still alive. The second
collector records `exit` and `close` independently.
- The investigation workflow replacement is excluded from this PR.
Normal CI configuration, command concurrency, test assertions and native
deadlines are unchanged. Windows integration confirmation will come from
this PR's checks.

This is task #97. The old 25-minute cancellations remain unexplained;
this change bounds one monitor operation and improves evidence retention
without claiming a causal fix or guaranteed upload if the runner itself
fails. Product probe diagnostics are separate in PR #552.

Co-authored-by: Otter <[email protected]>
@stamp-build
stamp-build Bot force-pushed the agent/otter/probe-exit-diagnostics branch from 245c957 to 4a51fae Compare October 30, 2026 16:08
@stamp-build
stamp-build Bot merged commit 648589e into main Oct 30, 2026
70 of 71 checks passed
@stamp-build
stamp-build Bot deleted the agent/otter/probe-exit-diagnostics branch October 30, 2026 18:14
@stamp-build stamp-build Bot mentioned this pull request Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants