bug: /compact is not interruptable #439

Closed
opened 2026-02-16 17:26:43 -05:00 by yindo · 1 comment
Owner

Originally created by @levabala on GitHub (Jul 2, 2025).

Originally assigned to: @adamdotdevin on GitHub.

sometimes it's impossible to interrupt the /compact command

at 00:16 i'm spamming ESC:

https://github.com/user-attachments/assets/ab9936bd-8734-418e-87c3-2b8accabb940

and when the session is restored, the "working" state is still there and can't be escaped:

https://github.com/user-attachments/assets/7e2afffa-d30b-4422-9bee-19d297dd5566

v0.1.174
macos 14.2.1
M1 Pro
auth via Claude Pro

Originally created by @levabala on GitHub (Jul 2, 2025). Originally assigned to: @adamdotdevin on GitHub. sometimes it's impossible to interrupt the `/compact` command at 00:16 i'm spamming ESC: https://github.com/user-attachments/assets/ab9936bd-8734-418e-87c3-2b8accabb940 and when the session is restored, the "working" state is still there and can't be escaped: https://github.com/user-attachments/assets/7e2afffa-d30b-4422-9bee-19d297dd5566 v0.1.174 macos 14.2.1 M1 Pro auth via Claude Pro
yindo added the bad label 2026-02-16 17:26:43 -05:00
yindo closed this issue 2026-02-16 17:26:43 -05:00
Author
Owner

@morgvanny commented on GitHub (Jul 2, 2025):

Looking into this a bit, it seems the issue is that CompactSession spawns a goroutine to call the summarize API but doesn't use the context parameter or store a cancel function. The interrupt handler in tui.go calls a.app.Cancel() which only aborts the main session operations, not the compact operation running in its own goroutine. I think to make compact operations interruptable like regular session operations we'd need to:

  • Store a context.CancelFunc in the App struct when starting a compact operation
  • Pass a cancellable context to the Session.Summarize call
  • Have the interrupt handler also cancel this context if it exists
@morgvanny commented on GitHub (Jul 2, 2025): Looking into this a bit, it seems the issue is that `CompactSession` spawns a goroutine to call the summarize API but doesn't use the context parameter or store a cancel function. The interrupt handler in tui.go calls `a.app.Cancel()` which only aborts the main session operations, not the compact operation running in its own goroutine. I think to make compact operations interruptable like regular session operations we'd need to: - Store a context.CancelFunc in the App struct when starting a compact operation - Pass a cancellable context to the Session.Summarize call - Have the interrupt handler also cancel this context if it exists
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#439