Skip to content

Conversation

@linw1995
Copy link
Owner

@linw1995 linw1995 commented Jan 30, 2026

This PR improves TUI exit control and subprocess termination:

Fixes

  • Make Ctrl-Q force quit respect cancellation guard (consistent with other exit shortcuts)
  • Properly terminate bash subprocesses on Ctrl-C using process groups and killpg
  • Handle Ctrl-C when waiting for permission confirmation (focus first pending message)
  • Ensure double Ctrl-C uses consistent shortcut key

Changes

  • Create process groups for bash commands to ensure all child processes are terminated on cancellation
  • Separate user cancellation from error states
  • Focus pending permission messages instead of immediate exit on Ctrl-C

These changes ensure more reliable cancellation behavior and complete cleanup of subprocess resources.

@linw1995 linw1995 added the bug Something isn't working label Jan 30, 2026
When there are pending tool use or combo messages awaiting permission,
Ctrl-C now focuses the first such message and triggers the exit
confirmation flow instead of immediately exiting.
Create process groups for bash commands and use killpg to ensure
all child processes are terminated when user cancels execution.
Also separate user cancellation from error states and ensure
double Ctrl-C uses the same shortcut key.
Ensure Ctrl-Q force quit checks the cancellation guard before
triggering, consistent with other exit shortcuts.
@linw1995 linw1995 force-pushed the fix/cancel-exit-invalid branch from 6fa3205 to 7246b8a Compare January 30, 2026 16:25
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 10.16949% with 106 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.87%. Comparing base (c3970cb) to head (7246b8a).
⚠️ Report is 2 commits behind head on dev.

Files with missing lines Patch % Lines
crates/coco-tui/src/components/chat.rs 0.00% 43 Missing ⚠️
crates/coco-tui/src/components/messages.rs 0.00% 30 Missing ⚠️
crates/coco-tui/src/components/message.rs 0.00% 15 Missing ⚠️
crates/coco-tui/src/components/messages/tool.rs 37.50% 10 Missing ⚠️
src/exec.rs 54.54% 5 Missing ⚠️
crates/coco-tui/src/components/messages/combo.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #165      +/-   ##
==========================================
+ Coverage   47.59%   47.87%   +0.28%     
==========================================
  Files         100      104       +4     
  Lines       27316    27688     +372     
==========================================
+ Hits        13000    13255     +255     
- Misses      14316    14433     +117     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@linw1995 linw1995 merged commit 2419140 into dev Jan 30, 2026
3 checks passed
@linw1995 linw1995 deleted the fix/cancel-exit-invalid branch January 30, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants