Repository navigation
fix(terminal): answer run-in-terminal from every route, not only chat - #10708
Conversation
|
Intent: Make |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS In the screenshot, the fixed [DESIGN-REVIEWED] 97b619a Description read[DESCRIPTION-READ] 9fa8b9c953d540f09db83abc8496d1d3fe8c31d63daa7cbf4dad41fb53edd9c9 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
UX Review (Opus 5.5, fork) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS The new failure notice is fixed over the top bar and page header. It stays until dismissed and covers whatever controls sit under it on any route. Watch
[UX-REVIEWED] 97b619a Description read[DESCRIPTION-READ] 2928489d77051fc21f7df1481d51d09aa615f5ffe073fdf12e4066d487e60cfb That sha256 names everything this verdict read: the PR description, plus the 5 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check whether the chat page should stay an unscoped receiver. Keeping it is the only reason the module-level What this change shipsInventory (6 items) — 6 justifiedIntent: let a user press "Run in terminal" on a code block on any dashboard route and get a dock terminal, with no detour through
[FIRST-PRINCIPLES-REVIEWED] 97b619a Description read[DESCRIPTION-READ] 7ce17538363a7e27b28ec0dc4b860810097b55634818df6c91f03d4f385c47ae That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
7d04761 to
04a8729
Compare
|
self-added: yes
|
04a8729 to
652d55e
Compare
652d55e to
b56ec4e
Compare
|
4db9d29 to
ed488ad
Compare
|
|
|
|
|
|
|
|
|
A code block outside every chat (an app page, a knowledge doc) sends its run request with no scope. Only the chat page answered those, so on any other route the button timed out. The app shell now mounts a fallback receiver that answers unscoped requests while no chat page is mounted, in the selected session's project, and shows failures in a dismiss-only notice fixed over the page. Co-authored-by: Nathan <61266668+nathanyi96@users.noreply.github.com>
|
|
|
|
|
|
|
|
iamwhatever
left a comment
There was a problem hiding this comment.
APPROVE at 97b619a25774565714c9137589e65a264ef238e7.
The shell now answers unscoped mc:run-in-terminal requests on every route in the main window, and stands down while a chat page that answers them itself is mounted. The count is read when the event fires, so one click opens one terminal however the listeners were ordered. Popout and embed windows answer nothing. Failures show in a dismiss-only notice that cannot navigate away from an unsaved edit. The event contract and the chat page's own handling are unchanged.
Every Design, First Principles and UX item on this head has a disposition. The UX placement concern is rebutted reasonably: the notice appears only after a failure, can be dismissed, and is cleared by the next successful run. CI is green on this head.
KiroCrew/website/src/hooks/useRunInTerminalBridge.ts
Lines 100 to 117 in 97b619a
— crew-pr-reviewer (r115)
buluoray
left a comment
There was a problem hiding this comment.
Approving 97b619a.
Still needed on current main: only the chat page (acceptUnscoped: true in pages/chat/page/eventBridges.ts) answers an unscoped mc:run-in-terminal, so off /chat the button still times out. The branch is 249 commits behind but merges cleanly. After the App.tsx split (#21953), activeSlotProject, isPopout and isEmbed are still in scope where the hook is called, and the notice still sits inside LocalOverlayRoot. tsc -p tsconfig.app.json --noEmit passes on the merged tree.
The stand-down is read at event time from a mounted-host count, so one click opens one terminal whichever listener was added first. The popout and embed exclusion is explicit.
On the merged tree, RunInTerminalShellBridge.test.tsx, App.terminalNavActive.test.tsx and MembersPage.runInTerminal.test.tsx pass. Each of these turns a named test red: dropping the mounted-host check, never counting the chat host, ignoring hasDock, and either change to the clear-on-success rule.
Non-blocking test gaps: two mutations in App.tsx leave the suite green: passing hasDock=true in popout/embed windows, and passing no cwd instead of activeSlotProject. A case in App.terminalNavActive.test.tsx that asserts the opened terminal's cwd, plus one rendering App as a popout, would pin both.
Problem / Motivation
Goal: Make the existing
mc:run-in-terminalaction work from every dashboard route, not only/chat."Run in terminal" only worked from the Chat page. On
/apps/<id>,/projects, or/settings, the request had no receiver, so no terminal tab opened and the caller eventually reported that no terminal was available.Why it matters
The dock terminal is app-wide, and app panels use this event to run a command in the user's own shell. Requiring callers to navigate to
/chatfirst introduced visible flicker and a race with the lazy Chat chunk, while still providing no benefit to the dock.Not a goal
RunInTerminalBtnconfirmation or sensitive-command checks.mc:run-in-terminalevent contract.What changed (motivation → approach → change)
A shell code block outside every chat (an app page, a knowledge doc) sends a run request with no scope. Since #16358, only the chat page answers those, so off
/chatthe button still times out.This rebuild sits on #16358's shared hook,
website/src/hooks/useRunInTerminalBridge.ts, instead of adding a second one. The hook gains anunscopedFallbackoption. The app shell callswebsite/src/shell/runInTerminalShellBridge.tsx, one more receiver that answers unscoped requests in the selected session's project, in the main window only (popout and embed windows have no dock). It stands down while the chat page is mounted. So one click opens one terminal on every route.The chat page keeps its own unscoped answer on purpose. On
/chatits failures show above the composer with an Ask Agent hand-off, which is safe there. The shell notice must be dismiss-only, because it can sit over an unsaved edit. The chat page also answers inside embed windows, where no shell receiver runs.Failures from that receiver show in a notice fixed at the top of the page, since the page under it can be any route. The next successful run clears it, except the notice that the reuse setting could not be read, which a successful run does not fix. The notice can only be dismissed: an Ask Agent hand-off would navigate to chat and could drop an unsaved edit on the current page.
Backwards compatibility
Compatible: the
mc:run-in-terminalrequest and result events are unchanged, and the chat and Crewmates pages answer exactly the requests they did before.Removes nothing: the change only adds a receiver for requests that had none.
Tests
website/src/test/RunInTerminalShellBridge.test.tsx: an unscoped run opens one dock terminal in the selected project, or the server default with no project; a request scoped to another host, an empty command and a missing command are ignored; with a chat-page stand-in mounted, one click opens one terminal (the chat page's), and after it unmounts the shell answers again; a window with no dock answers nothing; a full terminal cap answersok: falseand shows a dismiss-only notice; a later successful run clears that notice, another failure keeps it, and a config-read failure notice survives its own successful run.website/src/test/App.terminalNavActive.test.tsx: on/logs(no chat page), an unscoped run opens the dock terminal. Red on main without theApp.tsxmount, green with it.--sequence.shuffle, all green.Manual verification
N/A — the receiver is covered by the tests above, and the notice is shown below in the desktop and mobile layouts.
Screenshots / video
The new terminal-dispatch failure notice, over the Logs page:
Related Issues
No linked issue — this was found while wiring an app panel's existing "Run in terminal" button and tracing why its dispatch was dropped outside
/chat. Builds on #16358, which handles the Crewmates page and lists this PR as the owner of routes with no chat.Pattern harvest
Rule candidate: review-prompt
Pattern: a shell-level event listener mounted by a route page leaves the event without a receiver on every other route.
Checklist