Skip to content

test: deflake PTY SIGTERM cancellation - #699

Merged
BunsDev merged 22 commits into
mainfrom
fix/047-pty-sigterm-timing
Aug 9, 2026
Merged

test: deflake PTY SIGTERM cancellation#699
BunsDev merged 22 commits into
mainfrom
fix/047-pty-sigterm-timing

Conversation

@BunsDev

@BunsDev BunsDev commented Aug 9, 2026

Copy link
Copy Markdown
Member

Summary

  • replace the load-sensitive SIGTERM completion assertion with behavior-based cancellation, handler-restoration, and process-tree-reaping verification
  • add test-only lifecycle and fixture cleanup coordination that preserves the async handler
  • align the affected engineering design and validation documents with the behavior-only contract

Validation

  • targeted test passed normally and under 24 Python-supervised CPU spinners
  • cargo fmt --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace --locked --exclude coven-cli
  • python scripts/check-secrets.py
  • python3 scripts/check-coven-privacy.py --staged

cargo test -p coven-cli --locked intermittently fails an unchanged mobile_memory::gateway::tests::mobile_listener_requires_pinned_tls13 test with macOS EAGAIN; its exact retry passes. Remote CI is the clean-environment full-suite gate.

Closes coven-047.

BunsDev and others added 19 commits August 9, 2026 07:56
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Val Alexander <68980965+BunsDev@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Val Alexander <68980965+BunsDev@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Val Alexander <68980965+BunsDev@users.noreply.github.com>
Signed-off-by: Val Alexander <68980965+BunsDev@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 9, 2026 13:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses flakiness in the Unix PTY runner SIGTERM cancellation test by switching from load-sensitive timing assertions to behavior-based verification (cancellation error, handler restoration, and process-tree cleanup), and updates the associated design/plan documentation for coven-047.

Changes:

  • Reworks the Linux/macOS SIGTERM cancellation unit test to coordinate signal delivery with a test-only lifecycle observer and to validate durable fixture identities/cleanup.
  • Adds test-only synchronization hooks in the supervised-stream cancellation guard to prevent SIGTERM delivery from racing handler restoration.
  • Updates superpowers design/plan/spec/conformance documents to reflect the behavior-only contract (no “promptness” requirement).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/coven-cli/src/pty_runner.rs Adds test-only lifecycle coordination in the cancellation guard and replaces the flaky SIGTERM PTY test with behavior/identity-based assertions plus durable cleanup.
docs/superpowers/specs/2026-08-09-pty-sigterm-load-resilience-design.md New design record describing the behavior-based SIGTERM test contract and identity-safe reaping criteria.
docs/superpowers/plans/2026-08-09-pty-sigterm-load-resilience.md New implementation plan describing the new synchronization/cleanup approach and validation steps.
docs/superpowers/specs/2026-08-05-psyche-o1-1-corrective-annex-design.md Updates conformance language to remove “promptly” and align with expected-error semantics.
docs/superpowers/plans/2026-08-05-psyche-o1-1-conformance-closure.md Updates the referenced test name and expected behavior wording to match the new contract.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/coven-cli/src/pty_runner.rs Outdated
Comment on lines +4824 to +4848
let mut failures = Vec::new();
match native_stream_sigterm_fixture_states(identities) {
Ok(states)
if states
.iter()
.all(|state| *state == NativeStreamSigtermFixtureState::Reaped) =>
{
return Vec::new();
}
Ok(_) => {}
Err(error) => {
failures.push(format!(
"could not verify native stream fixture identities before cleanup: {error}"
));
}
}

if let Err(error) = request_native_stream_sigterm_fixture_cleanup(
cleanup,
Instant::now() + NATIVE_STREAM_SIGTERM_TEST_WATCHDOG,
) {
failures.push(format!(
"failed to request durable native stream fixture cleanup: {error:#}"
));
}
BunsDev and others added 3 commits August 9, 2026 08:53
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Val Alexander <68980965+BunsDev@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@BunsDev
BunsDev merged commit 970e75e into main Aug 9, 2026
13 checks passed
@BunsDev
BunsDev deleted the fix/047-pty-sigterm-timing branch August 9, 2026 23:36
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.

2 participants