Repository navigation
fix(studio): make the Escape double-press window strictly under 500 ms - #2318
Merged
kantord merged 1 commit intoOct 15, 2026
Conversation
kantord
added this pull request to stack #2325
October 14, 2026 13:27
41 tasks done
kantord
marked this pull request as ready for review
October 15, 2026 08:41
peppescg
approved these changes
Oct 15, 2026
peppescg
left a comment
Contributor
There was a problem hiding this comment.
Thanks Daniel. The < 500 rule now agrees with the expiry timer, and moving the clock without firing the timer is the right way to pin the boundary.
Nits:
apps/web/src/features/chat/chat-escape.ts:124: the re-arm branch replacesexpiry.currentwithout clearing the pending timeout. A press at exactly 500 ms (or later, if the timer is delayed) now re-arms while the first timer is still queued. That timer then fires and immediately disarms the new arm, so the hint flashes and the next press re-arms instead of clearing. Addif (expiry.current !== undefined) window.clearTimeout(expiry.current);before scheduling the new timeout. A test could advance timers by a few ms after the 500 ms press and assert the hint is still shown.apps/web/src/features/chat/chat-escape.test.tsx:292-295: the ordinary-ask block only checks that a held press does nothing. Follow it with a normal press and expect"deny", as the plan block does with"iterate", so the test can't pass on a layer that never acts.
kantord
force-pushed
the
studio-followups/08-escape-tests
branch
4 times, most recently
from
October 15, 2026 09:29
768dfd4 to
c739d48
Compare
The second press compared with <= 500 while the expiry timer fires at 500, so the exact boundary raced. One rule now: less than 500 ms. Also drops the redundant disarm alias and adds boundary, held-Escape and ordinary-verdict double-click tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
kantord
force-pushed
the
studio-followups/08-escape-tests
branch
from
October 15, 2026 12:25
c739d48 to
780022c
Compare
Merged
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Escape double-press check compared with
<= 500while the expiry timer fires at 500, so the exact boundary raced. One rule now: less than 500 ms.Part of #2303 ("Tiny follow-up fixes"); it does not close it. This is PR 8 of 14 in a stack of draft PRs, reviewed and merged in order.
What changed
chat-escape.ts:<= 500becomes< 500; the redundantchangedalias is removed (thefocusinlistener stays, so a focus move still cancels an armed press).repeat: true) at each layer (ask deny, plan iterate, panel close, stop); a same-tick double-click on an ordinary verdict button on the chat and on the side thread.Behavior changes
A second Escape exactly 500 ms after the first no longer clears the draft.
Verification
Biome, typecheck, the full Studio test suite and
pnpm generated:checkpass on this branch, run on the assembled stack. The full Playwright suite passes on the stack tip (122 passed, 30 skipped, 0 failed, includingchat-approvalagainst a realmecatedbuild). Each new test fails with its fix reverted. The existing "one verdict" test only proved the disabled state (fireEventflushes between clicks); the new test uses a real same-tick double-click. The plan version already existed and was not duplicated.Not included
A planted-secret-in-ask-args test: scrubbing happens in the engine and the UI renders args as given.
Fully or partially written by an AI agent.
🤖 Generated with Claude Code