Skip to content

feat(app): require double-tap Escape to cancel AI response#14845

Closed
praxstack wants to merge 14 commits intoanomalyco:devfrom
praxstack:feat/double-escape-cancel
Closed

feat(app): require double-tap Escape to cancel AI response#14845
praxstack wants to merge 14 commits intoanomalyco:devfrom
praxstack:feat/double-escape-cancel

Conversation

@praxstack
Copy link
Copy Markdown

@praxstack praxstack commented Feb 24, 2026

Issue for this PR

Closes #14844

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Single Escape during streaming shows a toast warning. Must press Escape again within 500ms to confirm cancellation. Prevents accidental interruption. Ctrl+G still provides immediate cancel for power users.

How did you verify your code works?

  • Typecheck passes
  • Tested: first Escape shows toast, second Escape cancels

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…cing

When message.part.updated events coalesce within a 16ms batch window
(text-end replaces text-start at the same queue index), stale
message.part.delta events remained in the queue. On flush, the reducer
applied the full text from the coalesced update, then appended the
stale deltas on top — doubling the content.

Fix: When a message.part.updated event coalesces over an earlier entry,
void all stale message.part.delta events for the same messageID:partID
already in the queue. Voided indices are skipped during flush.

Zero overhead in normal operation (voided set stays empty when no
coalescing occurs). Scoped by messageID+partID to avoid affecting
unrelated parts.

Fixes content repetition visible during LLM streaming in desktop UI.
Content displays correctly after app restart (loaded from DB).
- Add createEffect that applies fontSize to CSS custom properties
  (--font-size-base, --font-size-small, --font-size-large)
- Replace hardcoded fontSize: 14 in terminal with settings value
- Add font size stepper control (10-24px) in Settings > Appearance
When the LLM API returns a context overflow error, trigger compaction
instead of killing the session. Previously the catch block had a TODO
comment and fell through to a fatal error (return 'stop').

Now: sets needsCompaction = true and breaks to post-catch cleanup,
which returns 'compact'. The prompt loop then creates a compaction
task, generating a summary and allowing the session to continue.
Add SessionCompaction.prune() calls before both compaction triggers:
1. Proactive overflow check (before LLM call)
2. Reactive compact result (after LLM returns 'compact')

Pruning strips old tool outputs first, maximizing context reduction
before the compaction summary LLM call. This prevents the
summarization itself from hitting context limits.
Add a prominent context usage card at the top of the session context
panel showing:
- Large progress circle (32px) with token count and usage %
- Color-coded progress bar (green/yellow/red by usage level)
- Compact button that calls session.summarize API directly
- Button highlights when usage > 70% to encourage compaction
Add wideMode toggle in Settings > Appearance that disables the
centered max-width constraint on the chat timeline. When enabled,
chat content expands to fill the full window width instead of being
capped at 800px/1000px.
Remove document.execCommand('insertText') which creates DIV block
elements for multi-line paste. getCursorPosition doesn't count the
implicit newlines at block boundaries, causing cursor to land in the
middle of pasted text after re-render.

Now always uses addPart() which inserts via createTextFragment
(text nodes + BR tags, no block elements), ensuring correct cursor
positioning. Also removes deprecated execCommand API usage.
Single Escape during streaming now shows a toast warning instead of
immediately aborting. User must press Escape again within 500ms to
confirm cancellation. Prevents accidental interruption of AI responses.

Ctrl+G still provides immediate cancel for power users.
@github-actions
Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions Bot closed this Apr 25, 2026
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.

Accidental Escape key press cancels AI response without confirmation

1 participant