Skip to content

feat(tui): add debounce logic to escape key interrupt#169

Merged
adamdotdevin merged 9 commits intoanomalyco:devfrom
monotykamary:feat/escape-key-debounce
Jun 24, 2025
Merged

feat(tui): add debounce logic to escape key interrupt#169
adamdotdevin merged 9 commits intoanomalyco:devfrom
monotykamary:feat/escape-key-debounce

Conversation

@monotykamary
Copy link
Copy Markdown
Contributor

@monotykamary monotykamary commented Jun 17, 2025

Summary

• Implements two-stage escape key mechanism to prevent accidental chat operation cancellations
• First escape press shows "esc again interrupt", second press within 2 seconds actually cancels

Screen.Recording.2025-06-17.at.20.24.33.mov

Test plan

  • Start a chat operation that shows "esc interrupt"
  • Press escape once and verify it shows "esc again interrupt"
  • Press escape again within 2 seconds and verify operation cancels
  • Start another operation, press escape once, wait 2+ seconds and verify it reverts to "esc interrupt"
  • Verify normal escape behavior still works for non-busy states

🤖 Generated with opencode

@monotykamary monotykamary force-pushed the feat/escape-key-debounce branch from 0353d53 to a97d81e Compare June 17, 2025 13:55
@adamdotdevin
Copy link
Copy Markdown
Member

hey, things moved around a little bit, i think we want to move forward with this though; mind updating to work with the dynamic keybinds?

monotykamary and others added 2 commits June 21, 2025 13:28
…dental cancellations

Implements a two-stage escape key mechanism where the first press shows "esc again interrupt"
and requires a second press within 1 second to actually cancel the operation. This prevents
users from accidentally interrupting long-running chat operations while maintaining responsive
cancellation when intentional.

🤖 Generated with [opencode](https://opencode.ai)

Co-Authored-By: opencode <noreply@opencode.ai>
@monotykamary monotykamary force-pushed the feat/escape-key-debounce branch from 0a1e8e3 to a4ae83a Compare June 21, 2025 06:52
@monotykamary
Copy link
Copy Markdown
Contributor Author

hopefully should be ok

Screen.Recording.2025-06-21.at.13.49.30.mov

@adamdotdevin
Copy link
Copy Markdown
Member

sorry, i probably wasn't very clear on that last message. we actually have configurable interrupt keybind now, so we can't assume the user with use esc for interrupt. that makes this problem a bit more complex, feel up to tackling it?

@monotykamary
Copy link
Copy Markdown
Contributor Author

ah gotcha, let me have a look

monotykamary and others added 3 commits June 21, 2025 22:38
…tal cancellations

Implements a two-stage interrupt key mechanism that works with any user-configured
interrupt keybind (not just "esc"). The first press shows "esc again interrupt"
and requires a second press within 1 second to actually cancel the operation.
This prevents users from accidentally interrupting long-running chat operations
while maintaining responsive cancellation when intentional.

- Uses dynamic keybind matching instead of hardcoded "esc" key
- Works with leader key sequences and custom interrupt keybinds
- 1 second debounce timeout for optimal user experience
- Real-time UI feedback with hint text updates

🤖 Generated with [opencode](https://opencode.ai)

Co-Authored-By: opencode <noreply@opencode.ai>
Updates the interrupt hint text to show the user's actual configured interrupt
key instead of hardcoded "esc". Now displays the correct key text for any
configured interrupt keybind (esc, ctrl+c, q, leader+key, etc.).

- Gets interrupt key text from command registry during initialization
- Updates hint display dynamically: "ctrl+c interrupt" → "ctrl+c again interrupt"
- Removes unnecessary fallbacks for cleaner, more confident code
- Handles first render correctly with proper initialization

🤖 Generated with [opencode](https://opencode.ai)

Co-Authored-By: opencode <noreply@opencode.ai>
@monotykamary
Copy link
Copy Markdown
Contributor Author

hopefully should be ok now
not sure if the placement of the states are tasteful enough, but it shouldn't be too over-engineered in that aspect at least

monotykamary and others added 4 commits June 21, 2025 23:01
Instead of storing the interrupt key text, dynamically retrieve it
from the app commands when needed. This reduces state duplication
and ensures the displayed key always matches the configured command.
@adamdotdevin adamdotdevin merged commit 6bc61cb into anomalyco:dev Jun 24, 2025
moutansos pushed a commit to moutansos/opencode that referenced this pull request Jun 25, 2025
Co-authored-by: opencode <noreply@opencode.ai>
Co-authored-by: adamdottv <2363879+adamdottv@users.noreply.github.com>
achembarpu pushed a commit to achembarpu/opencode that referenced this pull request Aug 4, 2025
Co-authored-by: opencode <noreply@opencode.ai>
Co-authored-by: adamdottv <2363879+adamdottv@users.noreply.github.com>
randomm referenced this pull request in randomm/opencode Jan 9, 2026
#170)

OpenCode v1.1.1 deprecated the `tools` config in favor of `permission`.
The backwards compatibility was broken for subagents, causing git-agent
to receive wrong/mixed tool sets (missing bash).

Migration for all 5 agents:
- project-manager: 22 bash patterns + 7 tool permissions
- developer: 27 deny patterns + 12 tool permissions
- git-agent: 55 bash patterns + 9 tool permissions
- code-review-specialist: 48 bash patterns + 11 tool permissions
- research-specialist: 39 bash patterns + 15 tool permissions

Both work and personal configs migrated (intentional differences preserved).

Closes #169

Co-authored-by: Janni Turunen <janni@Jannis-MacBook-Air.local>
andreipromarketing-dev pushed a commit to andreipromarketing-dev/opencode that referenced this pull request Apr 7, 2026
…rwrites (anomalyco#169)

Fix installation instructions that caused file overwrites. Adds install.sh script and preserves directory structure. Fixes anomalyco#164.
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
Co-authored-by: opencode <noreply@opencode.ai>
Co-authored-by: adamdottv <2363879+adamdottv@users.noreply.github.com>
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