Skip to content

fix(work verify): terminalize Ctrl-C cancellation - #448

Merged
solomonneas merged 3 commits into
mainfrom
fix/work-verify-ctrl-c-cancellation
Jul 22, 2026
Merged

fix(work verify): terminalize Ctrl-C cancellation#448
solomonneas merged 3 commits into
mainfrom
fix/work-verify-ctrl-c-cancellation

Conversation

@solomonneas

Copy link
Copy Markdown
Collaborator

Summary

  • Catch Ctrl-C at the brigade work verify run boundary, terminate the verifier child process group, and write a terminal receipt instead of leaving a running receipt or printing a traceback.
  • Add receipt status canceled (command status interrupted, exit code 130) with preserved stdout/stderr, timing, git, and graph evidence where available.
  • Record verify + canceled as a neutral outcome signal (0), distinct from engineering failed (-1).

Closes #441

Test plan

  • brigade work verify run --target . --command "pytest -q tests/test_work_cmd_verification.py::test_work_verify_run_terminalizes_keyboard_interrupt tests/test_work_cmd_verification.py::test_run_verify_child_process_catches_keyboard_interrupt tests/test_work_cmd_verification.py::test_work_verify_run_canceled_status_is_neutral_not_a_regression_signal tests/test_outcome.py::test_signal_value_rewards_only_model_unauthored_success" --capture brigade-work
  • brigade work verify run --target . --command "./scripts/verify" --capture brigade-work

Made with Cursor

Catch KeyboardInterrupt at the verify-run boundary, terminate the child
process group, and write a canceled receipt with preserved evidence instead
of leaking a running receipt or printing a traceback.

Closes #441

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • coderabbit-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: escoffier-labs/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 053ab704-ad90-4ba9-9137-6782ec936dc9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/work-verify-ctrl-c-cancellation

Comment @coderabbitai help to get the list of available commands.

@solomonneas solomonneas self-assigned this Jul 22, 2026
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR makes verification cancellation produce a terminal, neutral outcome. The main changes are:

  • Runs verifier children in separate process groups and terminates them on Ctrl-C.
  • Writes canceled receipts with preserved logs and available evidence.
  • Returns exit code 130 without printing a traceback.
  • Records canceled verification as a neutral outcome signal.

Confidence Score: 5/5

No additional blocking issue qualifies for this review round.

  • The latest changes address cancellation, terminal receipt state, and neutral outcome handling.
  • No distinct additional failure requiring a separate fix was identified.

Important Files Changed

Filename Overview
src/brigade/work_cmd/verification.py Adds child-process cancellation, output decoding, and centralized terminal receipt finalization.
src/brigade/outcome.py Maps canceled verification receipts to a neutral outcome signal.
tests/test_work_cmd_verification.py Adds coverage for cancellation receipts, child termination, and neutral outcome capture.
tests/test_outcome.py Covers the canceled verification signal mapping.

Reviews (3): Last reviewed commit: "fix(work verify): retry child terminatio..." | Re-trigger Greptile

Comment thread src/brigade/work_cmd/verification.py Outdated
Comment thread src/brigade/work_cmd/verification.py
Decode child output with UTF-8 replacement so non-text bytes cannot
bypass receipt finalization, and always finalize through a fail-open
finally path that covers capture and digest phases.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/brigade/work_cmd/verification.py Outdated
A second interrupt during grace-period waits could skip process-group
cleanup; retry termination with zero grace before returning.

Co-authored-by: Cursor <cursoragent@cursor.com>
@solomonneas
solomonneas merged commit 83beb4c into main Jul 22, 2026
29 checks passed
@solomonneas
solomonneas deleted the fix/work-verify-ctrl-c-cancellation branch July 22, 2026 22:11
solomonneas added a commit that referenced this pull request Jul 22, 2026
Resolves verification.py conflict with #448: receipt reuse now lives inside the cancellation-safe try block; tree_fingerprint and planned_commands fields moved into the in-try receipt construction.
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.

fix(work verify): terminalize Ctrl-C cancellation

1 participant