Skip to content

shell: a killed transcription's children are waited for as gone, not checked the instant it is answered (#845) - #846

Merged
napkinstack-agent[bot] merged 2 commits into
mainfrom
shell-845-deaf-child-gone-after-its-kill
Nov 15, 2026
Merged

napkinstack-agent[bot] merged 2 commits into
mainfrom
shell-845-deaf-child-gone-after-its-kill

Conversation

@kitokey-marc

@kitokey-marc kitokey-marc Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

shell: a killed transcription's children are waited for as gone, not checked the instant it is answered

Closes #845.


Module

modules/shell — exactly one.

  • This pull request touches a single module
  • ⚠️ Cross-module — the cross-module label is required, justification below

Deliverable

Out of cycle: #845, a test that fails in CI and blocks #812's merge. It is outside the freeze for that reason (the coordinator, 2026-11-15).

What it changes

Only a test. tests/transcription.rs, cancelled_it_ends_within_two_seconds_with_what_it_started_even_deaf_to_term, from #807:

  • Before: the child, deaf to TERM, was checked as gone the instant the answer « made » arrived. Cancelling sends TERM to the group, waits a second's grace, then sends KILL. The child is gone only once the kernel has delivered that KILL and the process has been reaped. On a loaded runner that comes after the answer, so the check could come first (run 43596085957, on D94 — shell: the tests read every sentence of words.rs against the voice guide #812).
  • Now: after the answer, gone(&child) is polled as a state, every 10 ms for up to 500 ms. This is the playbook's rule: wait for an observable state, never for a fixed duration.
    • The two seconds' bound stays on the answer itself, read the instant it arrives and before the wait.
  • The same race, a second test (a44408a): a_transcript_ended_by_kitokey_ends_with_what_it_started_and_is_not_written checked its child the instant the answer came, with kill -0, which a zombie not yet reaped still answers. It failed the unit tests of shell: e2e — D60's bar waited for whole, not read after a fixed pause (#850) #851's attest and shell: e2e presses the stop once it is the stop gesture (#763) #836's (transcription.rs:105, « what the program started is left running »). It is now waited for the same way, with gone, which counts a zombie as gone, within 500 ms.
  • The behaviour under test does not change. The child must be gone, and within a bound.

Oracle

Kind of oracle: the unit test itself, its race taken out, and a mutant that shows it still holds the behaviour.


Review budget

  • Lines changed (excluding generated): 23 (20 added, 3 removed)
  • Files touched: 1
  • Within budget

Contracts

  • No contract affected

Definition of Done

  • Oracle green
  • Lint, format, types: cargo fmt --check, cargo clippy --all-targets -D warnings
  • Unit tests: as above
  • Affected documentation updated: the test's comment says why it waits
  • Diff self-reviewed line by line

Test sheet

Verifier: session 04463b35-db3b-47ea-bef5-6892f2baedb7

# Given · when · then Kind Result Evidence Commit Confirmed
S1 Given a transcription cancelled while its child, deaf to TERM, runs, when the answer comes, then it comes within 2 s, and the child is gone within half a second after it automated passed Run again at the head a44408a, in a git clone --shared of my own under my cache: cargo test --locked --test transcription, ok. 13 passed. The test alone (--exact), 40 runs, 8 at a time, under 16 busy loops (one per core): 40 of 40 printed ok. 1 passed. At 3da2920 before it: 40 of 40 the same way, and the test before #846 32 of 40 under that load. a44408a —
S2 Given cancel without the group's KILL, when the test runs, then it fails, the child still running automated passed Run again at a44408a: src/transcription.rs l.278, cancel's group SIGKILL commented out (numstat 1 1, restored by a trap), under timeout 300: FAILED. 0 passed; 1 failed, « its child, deaf to TERM, still runs half a second after the answer ». a44408a —
S3 Given a transcript ended by Kitokey while the child its program started runs, when the answer comes, then the child is gone within half a second after it; and without the group's KILL in end, the test fails automated passed At a44408a: a_transcript_ended_by_kitokey_ends_with_what_it_started_and_is_not_written alone, 40 runs, 8 at a time, under 16 busy loops: 40 of 40 ok. 1 passed, the binary rebuilt from the restored source first. src/transcription.rs l.232, end's group SIGKILL commented out (numstat 1 1, restored by a trap), under timeout 300: FAILED. 0 passed; 1 failed, « what the program started is left running half a second after the answer ». a44408a —

Verifier's remarks: by reading the diff at 3da2920 and my own probes. (1) The 2 s bound is still measured at the answer: answered = pressed.elapsed() is read on the line after recv_timeout(2 s) returns, and asserted before the 500 ms wait begins; the wait's own clock (killed) starts after it, so it cannot stretch the bound. A probe of mine did not discriminate and is not evidence: a 1.5 s sleep added in cancel after the KILL passed, because the answer is sent once the program ends, before that sleep. (2) The race is real under load, and gone: the earlier test failed 8 of 40 runs in my clone under 16 busy loops, the new one 0 of 40. Not run by me: CI's runner (its red is run 43596085957), clippy, the attest. At a44408a: (3) the test before a44408a (a44408a~1's transcription.rs) passed 40 of 40 in my clone under the same load: the CI flake it fixes (exit 101 in #836's and #851's attests) did not replay here, so S3 rests on the test's reading and its mutant, not on a red seen locally. The new wait is the same as S1's: gone, every 10 ms, for 500 ms, after the answer. (4) A method slip of mine, set right: one ×40 run used the binary still built from the end mutant (0 of 40, « left running »); rebuilt from the restored source, 40 of 40. Only the rebuilt run is evidence.


Summary

DONE

  • The deaf child is waited for as gone after the answer, within 500 ms. The answer's own 2 s bound is kept.
  • The same for the child of a transcript ended by Kitokey, its zombie counted as gone.

VERIFIED

  • The red in CI (run 43596085957).
  • Green locally, and 40 of 40 under load (8 at a time).
  • The KILL removed: the test still fails.
  • fmt and clippy are clean.
  • Attested 5/5 at a44408a (nstack 0.29.0): the module's checks, its unit tests and the full shell e2e green; lina's sheet.

ASSUMED

  • Half a second covers the KILL's delivery and the reaping on CI's runners.

NOT VERIFIED

  • Whether CI's runner, at its most loaded, ever needs more than 500 ms. The bound fails loudly if it does.

RISKS

  • None to the shell: a test alone.

Signals to report

  • I had to look at another module's implementation
  • A kernel or playbook rule got in my way for no good reason
  • A quality gate blocked without improving quality
  • A rule applied by hand would be worth automating

🤖 Generated with Claude Code

…not checked the instant it is answered (#845)

The KILL sent, the child is gone once the kernel has delivered it and reaped it: on a
loaded runner, after the answer (#812's CI, run 43596085957). Now polled as a state for
half a second after the answer; the two seconds' bound kept on the answer itself, read
before. Without the group's KILL, it still fails: « still runs half a second after the
answer ».

Agent-Session: 14f73956-90b9-46a3-9fcc-52dc45c43948
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kitokey-marc kitokey-marc Bot added the out-of-cycle Work outside the current cycle: an incident, a production defect; justified in the PR label Nov 14, 2026
… cancelled one does (#845)

The same race, in a_transcript_ended_by_kitokey_ends_with_what_it_started_and_is_not_written:
its child checked the instant the answer came, with `kill -0`, which a zombie not yet reaped
still answers. It failed #851's attest and #836's. Now waited for with `gone`, zombie-aware,
within half a second. Without the group's KILL in `end`, it still fails.

Agent-Session: 14f73956-90b9-46a3-9fcc-52dc45c43948
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kitokey-marc kitokey-marc Bot changed the title shell: a cancelled transcription's deaf child is waited for as gone, not checked the instant it is answered (#845) shell: a killed transcription's children are waited for as gone, not checked the instant it is answered (#845) Nov 15, 2026
@napkinstack-agent
napkinstack-agent Bot merged commit 660d93f into main Nov 15, 2026
14 of 18 checks passed
@napkinstack-agent
napkinstack-agent Bot deleted the shell-845-deaf-child-gone-after-its-kill branch November 15, 2026 05:13
kitokey-marc Bot added a commit that referenced this pull request Nov 15, 2026
The transcription tests' children waited for as gone on main: this branch's attest no longer
carries #845's race.

Agent-Session: 14f73956-90b9-46a3-9fcc-52dc45c43948
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kitokey-marc Bot added a commit that referenced this pull request Nov 15, 2026
…eciders-key

The transcription tests' children waited for as gone on main: this branch's attest no longer
carries #845's race.

Agent-Session: 14f73956-90b9-46a3-9fcc-52dc45c43948
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

out-of-cycle Work outside the current cycle: an incident, a production defect; justified in the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shell test: the deaf child of a cancelled transcription is checked gone before its KILL lands (flaky in CI)

0 participants