Skip to content

Report confirmed peer exits separately from shutdown timeouts (#279) #281

Done

Description

@DocksDocks

Goal

Fix #279 in the local verification driver. Preserve observed exits across output drain, require confirmed exit for the closed-peer probe, and report an unconfirmed shutdown accurately in both modes. Cover both deadline orderings deterministically.

Yolo: the user delegated every decision except the merge to the agent.

Mode: plan-and-implement

Research

Base 49f308a17a13c116bf4bfa0adf0289fe280b7da8. In .agents/skills/verify/scripts/omp-smoke.ts, startRpcOmp resolves exited inside end, which waits for the pipes. The final 10 s SIGKILL wait therefore races an unrelated 250 ms drain. talkMode sends to the closed endpoint without inspecting that result. talkMode and talkUiMode both interpolate a timeout as an exit code. The process handle is already stored before readiness; the registry scan already precedes close. Keep those boundaries.

  1. Decision: separate process evidence from stream cleanup in the fixture only. Node documents that exit can precede close, including for shared pipes. Keep the existing stdin, SIGTERM and SIGKILL stages. Once exit is observed, send no more signals and allow at most the existing drain interval. A null exit code from a signal is confirmed exit, not a deadline. A failed spawn is not a confirmed exit. A late event cannot replace a returned timeout. Keep stderr for warning checks. Reject increasing the timeout: a descendant can keep a pipe indefinitely. Reject treating a dead socket as process evidence: an endpoint can close before exit. One change moves both modes and the probe; revert it as a unit if buffered replies, normal output, bounded waits or scan ordering regress.
  2. Decision: exercise the production close path with a synthetic event source and Vitest's controlled clock. The alternate real stuck process is neither safe nor deterministic. Assert the observed code, deadline diagnostic, buffered output and whether the actual not-live probe runs. A regression could pass a helper test if a mode bypasses it: share the peer verdict and run both real V6 modes as a separate check. Keep the module private to checkout verification, with no CLI flag or dependency. These choices are locally reversible and do not change a shipped package.

For the real failure paths, use a checked-in test-only Bun preload. A local Bun 1.4.5 probe confirmed that the replacement is scoped to the driver process. Close the real peer normally first; then substitute the unconfirmed result only at the shutdown boundary. Do not replace the mode, report builder, probe, stdin, exit code of the driver, or its registry checks. Detect any sender send after that boundary independently. This separates proof that the real controller detects a timeout (virtual time) from proof that each whole mode handles it (driven output).

Tools: Bun 1.4.5, Node 26.13.0, Git 2.53.0, gh 2.103.3, docks-kit 0.31.0 and Bubblewrap 0.11.1 (local version output). package.json pins Vitest 5.1.2, Oxlint 1.95.0, TypeScript 7.0.2, and Effect tsgo 0.74.1. docks-kit agent-docs verify-skill detect reported verify skill: present. Use V6 with the verified omp 19.2.1 of SoT/toolchain.json, not the workstation's newer omp. On Linux the upstream v19.2.1 binary has SHA-256 e8b937f9bf023baa147bdd300ad5421af0a6ef8b1f350c47a9a93d5fca94feca. Use private PID, network and mount namespaces, fixture home and temporary registry, and a loopback model. Do not mount the host home, temporary directory, Git database or credentials.

Engineering standards

Step shutdown: fix-workflow, tdd-workflow, type-safety-discipline, code-clarity and commit-discipline. One focused green commit with a red baseline. Use distinct outcomes instead of optional flag combinations. Apply code-review in self-review.

Steps

# Id Task Files Depends Effect Status Done when
1 shutdown Fix peer shutdown evidence and both verdict consumers; test deadlines with controlled events .agents/skills/verify/scripts/omp-smoke.ts, .agents/skills/verify/scripts/smokePeerShutdown.ts, cli/test/unit/verifySmokePeerShutdown.test.ts, cli/test/fixtures/talk/unconfirmed-peer.ts, .agents/skills/verify/SKILL.md - local done A1–A4 pass; a confirmed exit stays confirmed, and a timeout cannot pass the probe or masquerade as an exit.

Acceptance

ID Command Expected
A1 bun run test:unit cli/test/unit/verifySmokePeerShutdown.test.ts cli/test/unit/verifySmokeTalkTurns.test.ts cli/test/unit/verifySmokeScan.test.ts Use synthetic process events and virtual time. With a pipe open, observe exit 1 ms before the final deadline, deliver buffered output after that deadline, and report the original exit. In the no-exit case, advance to the final deadline and require a timeout. Emit exit 0 and pipe close 1 ms later, then repeat close and require the same timeout. Also cover ordinary exit, signal exit, bounded drain, and no signals after observing exit. No actual unkillable process.
A2 bun .agents/skills/verify/scripts/omp-smoke.ts talk --repo . --omp "$verified_omp" and the same command with talk-ui, in the isolated V6 environment described above Both exit 0. Talk reports ok closed-peer-not-live, both report ok sessions, ok registry: talk registered only in the private folder and ok registry-removed. No normal output, close order, or protocol change.
A3 bun run check:types; bun run lint .agents/skills/verify/scripts/omp-smoke.ts .agents/skills/verify/scripts/smokePeerShutdown.ts cli/test/unit/verifySmokePeerShutdown.test.ts; bun fmt --no-script --check cli/test/unit/verifySmokePeerShutdown.test.ts All succeed. The tests import the production helper, so the type check includes it. Run the full unfiltered gate in required protected CI. No shipped package changed.
A4 bun --preload ./cli/test/fixtures/talk/unconfirmed-peer.ts .agents/skills/verify/scripts/omp-smoke.ts talk --repo . --omp "$verified_omp"; repeat with talk-ui under A2 isolation Both exit 1, not 0 or a harness timeout. Talk prints FAIL closed-peer-not-live with the unconfirmed-after-SIGKILL reason, and makes zero post-close sender sends. Both print FAIL sessions with that reason, never exited timeout. All unrelated checks must succeed, including registry and registry-removed.

Do not touch

Do not change the kit CLI, talk extension, transport, sender/TUI shutdown policy, deadlines, dependencies, release version, CI or branch protection. Do not access live user sessions. No release, deployment or production work.

Open questions

Verification Results

Candidate 4f6e1c3608. Red baseline, step shutdown: bun run test:unit cli/test/unit/verifySmokePeerShutdown.test.ts failed on missing smokePeerShutdown.ts; no implementation or stub existed. The regression test bytes remained unchanged through implementation.

  • A1: 45 tests passed in three suites. The controlled clock exercised the 29,999 ms exit, buffered output across 30,000 ms, 30,000 ms timeout, late clean exit, repeated close, signal exit and failed spawn.
  • A2: private real talk passed 21 checks; talk-ui passed 15. Both outputs matched their base runs byte for byte. Both removed the registries.
  • A3: check:types, scoped lint and test formatting passed. Type checking printed two pre-existing suggestions in unrelated CLI commands. The full local gate did not run.
  • A4: both complete modes exited 1 under the preload. talk reported exactly two failures, closed-peer-not-live and sessions; talk-ui reported only sessions. All gave the injected unconfirmed-after-SIGKILL reason. No sender probe ran after close. The other 19 and 14 checks passed, respectively, including private registry cleanup.

Review repair 9b145ef67e: 46 unit tests passed. Types (including the complete verifier), scoped lint and test formatting passed. Real talk and talk-ui matched their base output (21 and 15 passing checks). The failure controls exited 1 with only the expected failures, preserved stderr and issued no post-close sends. Both modes removed their registries. The original red assertions were strengthened to use the production event binding and the last millisecond of the allowed drain. A new case verified the signal termination message.

Final candidate 448d443ac1: A1–A4 passed again (46 unit tests, 4 real mode runs, types, lint and formatting). For the controlled peer with empty, blank, padded or ordinary stderr, the preload preserved every byte and supplied a visible excerpt under both mode policies.

Required Full CI passed for the reviewed head 448d443ac153e4ccb101c41400d35dea35d263a9 on PR #282. All 10 jobs succeeded for the current merge with main.

Activity

  1. self-assigned this
    on Dec 1, 2026
  2. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Delegation grant: yolo: ok go ahead and do issue://279 with the yolo skill

  3. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 1

    Plan-review: repair

    • goal_fit - Goal, Research decision 1, and Acceptance A1 - A1 puts exit 1 ms before the deadline in the first case, but its second case only requires no exit. “Late events and repeat close” does not tie either assertion to that timeout. startRpcOmp has separate event handlers, a timeout return, and a cached close() result (.agents/skills/verify/scripts/omp-smoke.ts:2154-2193). Inference: a regression that returns timeout on time but reports exit 0 on the next close after a late event could pass those checks independently - Make the second case advance to the final deadline, assert timeout, emit exit and close 1 ms later, then assert that repeat close still reports timeout - class: deadline ordering not proved by the acceptance assertion
    • goal_fit - Research decision 2, step shutdown, and Acceptance A1–A2 - The actual send and the two sessions reports are separate consumers (.agents/skills/verify/scripts/omp-smoke.ts:2762-2777,2796-2820,3919-3946). A1 names a shared verdict, while A2 only exercises successful shutdowns. Inference: a test of the shared verdict can pass while a mode bypasses it on timeout, leaving talk able to send the probe or either mode able to print exited timeout - Make A1 feed the synthetic timeout through the production paths that issue the send and build each mode’s result. Assert no probe send, a FAIL closed-peer-not-live diagnostic in talk, and a FAIL sessions diagnostic in both modes that says exit was not confirmed after SIGKILL - class: failure assertion bypasses production consumers
  4. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Plan review round 2

    Plan-review: pass

    None.

    Manager response to round 1

    Repaired:

    • Round 1, A1: one same-peer timeline now ends in timeout, then delivers late exit and close before the repeated close.
    • Round 1, A1–A2: new A4 drives the actual talk and talk-ui failures through a test-only Bun preload. It checks both final reports and the absence of a post-close send.

    Rejected: none.

    Redesigned: none.

  5. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Self-review

    Correctness

    No findings.

    Spec and tests

    No findings.

    Text and safety

    LOW: The comment on FixtureProcess still describes closed as “with its exit result.” An unconfirmed shutdown closes the handle without an exit result. Describe it as the shutdown result.

  6. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Code review round 1, lens correctness

    Code-review: pass

    Standards

    • [LOW] Bug - .agents/skills/verify/scripts/omp-smoke.ts:2173-2177, .agents/skills/verify/scripts/omp-smoke.ts:2782-2784, .agents/skills/verify/scripts/omp-smoke.ts:3907-3911 - When a peer writes a shutdown diagnostic to stderr and its exit is not confirmed, both modes drop the excerpt that FAIL sessions showed before this change. The timeout fixture supplies last diagnostic; inference: neither mode would print it because peerSessionFailure returns only the reason and countWarnings filters out lines that are not plugin warnings. - Append the existing bounded stderr excerpt to the unconfirmed reason when the excerpt is nonempty. Keep the probe gate and exit wording unchanged. - class: dropped shutdown diagnostics

    Spec

    None.

    Code review round 1, lens spec-and-tests

    Code-review: pass

    Standards

    • [MEDIUM] Maintainability - cli/test/unit/verifySmokePeerShutdown.test.ts:14-22, cli/test/unit/verifySmokePeerShutdown.test.ts:34-46, .agents/skills/verify/scripts/omp-smoke.ts:2155-2156 - The race test calls peer.exited() directly, bypassing the listener that decides which child event proves exit. Inference: moving exit evidence back to the child's close event would leave the unit test green and could pass normal V6 runs when the pipes close promptly, while restoring the original failure when a pipe stays open past the final deadline. - Drive the race through the production listener registration with a synthetic child that emits exit and close separately. - class: regression test bypasses production event binding
    • [LOW] Maintainability - cli/test/unit/verifySmokePeerShutdown.test.ts:39-45 - The drain test delivers its last bytes 2 ms after exit and checks release at 250 ms. Inference: shortening the drain to 100 ms would pass this test but discard output arriving later in the existing window. - Write the buffered bytes 249 ms after exit, then advance 1 ms and check that the result retains them and releases the pipe. - class: one-sided deadline assertion

    Spec

    • [MEDIUM] Spec - cli/test/fixtures/talk/unconfirmed-peer.ts:32-40, .agents/skills/verify/scripts/omp-smoke.ts:2746-2756 - Plan export line 18 says “Do not replace the ... probe” and “Detect any sender send after that boundary independently.” The preload throws before the real sender call, and the mode catches that exception in the same check it is meant to verify. The current check would expose the exception's distinct reason, but inference: a mode that attempts the send and then reports the peer shutdown reason anyway would satisfy the expected output while the preload silently prevented the send. - Record attempted post-close sends through a separate test-only diagnostic, delegate to the real call, and require that diagnostic to be absent in A4. - class: failure control intercepts the behavior it measures

    Code review round 1, lens text-and-safety

    Code-review: pass

    Standards

    • [MEDIUM] Bug - .agents/skills/verify/SKILL.md:289, cli/test/fixtures/talk/unconfirmed-peer.ts:20-24, cli/test/fixtures/talk/unconfirmed-peer.ts:38-39, .agents/skills/verify/scripts/omp-smoke.ts:2744-2756 - The documented failure control can look successful even if the driver attempts the forbidden send. Inference: if the guard regresses, the preload throws, the driver still reports FAIL closed-peer-not-live, and sessions still fails with the injected reason. The instructions check only the labels, so they cannot distinguish that regression from correct behavior. - Require exit 1, the injected shutdown reason on each expected failure line, and success on all unrelated checks. - class: failure control accepts the wrong error
    • [LOW] Bug - .agents/skills/verify/SKILL.md:178, .agents/skills/verify/scripts/omp-smoke.ts:2548-2551, .agents/skills/verify/scripts/omp-smoke.ts:2741-2756 - The registry table says the check reads not run after an earlier failure if the final scans are clean. The shutdown control demonstrates the opposite: closed-peer-not-live fails after attribution has already recorded a successful registry verdict, and clean final scans leave it intact. - Say that a later scenario failure does not reset a completed registry check. - class: stale check-order documentation
    • [LOW] Bug - .agents/skills/verify/scripts/omp-smoke.ts:2173-2176, .agents/skills/verify/scripts/omp-smoke.ts:2782-2790, .agents/skills/verify/scripts/omp-smoke.ts:3908-3913 - When a peer writes a shutdown diagnostic to stderr and its exit remains unconfirmed, both sessions lines discard that diagnostic. The old timeout report included it, and the warning scan only surfaces lines matching its plugin-warning filter. - Append the existing bounded stderr excerpt to the sessions reason when nonempty. Keep the probe reason unchanged. - class: dropped shutdown diagnostic
    • [LOW] Bug - .agents/skills/verify/scripts/smokePeerShutdown.ts:4-7, .agents/skills/verify/scripts/smokePeerShutdown.ts:43-47, .agents/skills/verify/scripts/omp-smoke.ts:2173-2176 - If a shutdown signal terminates the peer, both the RPC rejection and the session report can say the peer omp exited null. The result type explicitly identifies null as signal termination, but the text presents it as an exit status. - Render a confirmed signal termination as such in both paths without inventing an exit code. - class: signal termination rendered as an exit status
    • [LOW] Bug - .agents/skills/verify/scripts/omp-smoke.ts:2095-2097, .agents/skills/verify/scripts/omp-smoke.ts:2412-2413, .agents/skills/verify/scripts/omp-smoke.ts:2758-2760, .agents/skills/verify/scripts/omp-smoke.ts:3200-3207, .agents/skills/verify/scripts/omp-smoke.ts:3861-3862 - The lifecycle comments describe a closed handle as having an exit result. On the new timeout path, both modes can store a closed handle with an unconfirmed result. The comments preserve the assumption the probe guard now has to reject. - Describe the stored result as a shutdown outcome and state that closing the handle does not prove process exit. - class: shutdown completion described as confirmed exit

    Spec

    None.

  7. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Code review round 2, delta

    Code-review: pass

    Previous findings

    • Round-1 finding on .agents/skills/verify/scripts/omp-smoke.ts:2173-2177: fixed - Both modes now append a bounded stderr excerpt to an unconfirmed shutdown reason at .agents/skills/verify/scripts/omp-smoke.ts:2774 and :3897.
    • Round-1 finding on cli/test/unit/verifySmokePeerShutdown.test.ts:14-22: fixed - The synthetic emitter and the real child both use the production listener registration at .agents/skills/verify/scripts/smokePeerShutdown.ts:86-91. Binding exit evidence to close would now fail the deadline test at cli/test/unit/verifySmokePeerShutdown.test.ts:38-50.
    • Round-1 finding on cli/test/unit/verifySmokePeerShutdown.test.ts:39-45: fixed - The test writes at 249 ms and requires the bytes to survive and the pipe to be released at 250 ms, at cli/test/unit/verifySmokePeerShutdown.test.ts:44-49.
    • Round-1 finding on cli/test/fixtures/talk/unconfirmed-peer.ts:32-40: fixed - The spy logs the attempted send separately and delegates to the real sender call at cli/test/fixtures/talk/unconfirmed-peer.ts:32-39.
    • Round-1 finding on .agents/skills/verify/SKILL.md:289: fixed - The instructions now require exit 1, the specific failure reasons, passing unrelated checks, and no post-close send marker at .agents/skills/verify/SKILL.md:289.
    • Round-1 finding on .agents/skills/verify/SKILL.md:178: fixed - The table now says that a later failure does not reset the registry verdict recorded at .agents/skills/verify/scripts/omp-smoke.ts:2545-2546.
    • Round-1 finding on .agents/skills/verify/scripts/omp-smoke.ts:2173-2176: fixed - The shared formatter appends nonempty stderr to the sessions reason without changing the probe reason, at .agents/skills/verify/scripts/smokePeerShutdown.ts:13-22 and .agents/skills/verify/scripts/omp-smoke.ts:2739.
    • Round-1 finding on .agents/skills/verify/scripts/smokePeerShutdown.ts:43-47: fixed - The RPC rejection and session verdict now share signal-termination wording at .agents/skills/verify/scripts/smokePeerShutdown.ts:9-21 and :61-65.
    • Round-1 finding on .agents/skills/verify/scripts/omp-smoke.ts:2095-2097: fixed - The startup and cleanup comments no longer promise a confirmed exit, and the lifecycle type documents the distinction at .agents/skills/verify/scripts/omp-smoke.ts:3193-3198.

    Standards

    • [LOW] Bug - cli/test/fixtures/talk/unconfirmed-peer.ts:21-24, .agents/skills/verify/scripts/omp-smoke.ts:1651-1654, .agents/skills/verify/scripts/omp-smoke.ts:3890, .agents/skills/verify/SKILL.md:289 - If a clean peer selected with the documented --omp option writes only blank lines to stderr, inference: the preload skips its fallback because the raw string is nonempty, but both formatters trim it to empty. The failure control then lacks the required excerpt even though shutdown handling is correct. The same applies in talk-ui if only its last 600 stderr characters are whitespace. - Append the fixture diagnostic when that tail contains no non-whitespace text, preserving the original stderr for warning checks. - class: diagnostic fallback checks raw rather than displayed output

    Spec

    None.

    Manager response to round 1

    Repaired in 9b145ef:

    • Dropped shutdown diagnostic (correctness and text): the old formatter returned only the timeout reason when given last diagnostic. Both modes now display the bounded stderr excerpt. A4 checks both real outputs and an unchanged probe reason. The shared signal-exit formatter also describes termination by a signal instead of an exited null status in both the pending RPC error and the session verdict.
    • Production event binding and one-sided deadline assertion (tests): the regression previously called a controller method and wrote bytes 2 ms after exit. The synthetic process now emits exit and close through the same listener registration as a real child. The last bytes arrive at 249 ms; release is required at 250 ms.
    • Failure control intercepting a send (tests), and accepting the wrong error (text): the original spy threw before calling the sender. It now emits a distinct stderr marker and forwards the real call. The documented control requires the correct exit status, the correct failure reasons, passing unrelated checks and no marker. A4 checked all four conditions.
    • Stale check-order documentation (text): both real unconfirmed runs kept the successful registry checks. The table now distinguishes an earlier failure from a failure after a completed registry check.
    • Closing a handle described as confirmed exit (text and self-review): corrected the lifecycle comment and removed duplicate exit claims from the driver, both startup sites and cleanup.

    Rejected: none.

    Redesigned: none.

  8. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Code review round 3, delta

    Code-review: pass

    Previous findings

    • Round-2 finding on cli/test/fixtures/talk/unconfirmed-peer.ts:21-24: fixed - The preload preserves the original stderr and appends a separate nonblank line after the real peer exits cleanly. talk now shows an excerpt for whitespace-only stderr, and talk-ui shows one even when the original last 600 characters were all whitespace. The marker does not affect warning detection. Normal runs do not load the preload, and the delta leaves live peer behavior and the post-close send check unchanged.

    Standards

    None.

    Spec

    None.

    Manager response to round 2

    Repaired in 448d443: the test preload now appends a diagnostic line to the original stderr before either display formatter sees it. The previous truthiness check dropped the excerpt for whitespace-only stderr or a 600-character whitespace tail. The repair preserves every original byte. An independent preload run exercised empty, blank, padded and ordinary stderr through both excerpt policies.

    Rejected: none.

    Redesigned: none.

  9. DocksDocks commented on Dec 1, 2026

    @DocksDocks
    OwnerAuthor

    Archived with landing pull request #282

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions