Repository navigation
Conversation
f6b2bc6 to
882ae2f
Compare
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
Security Scope Review (fork) — 🔴 BLOCK (blocking)Which legitimate operations does no leg reported, and this was not the nothing-to-adjudicate short circuit No |
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS A hand-rolled distributed-coordination protocol (epochs, fencing tokens, tombstones, revisioned publish) now lives in the view layer, coordinating truth the gateway already owns. Watch
Suggestions
[DESIGN-REVIEWED] a030094 |
UX Review (Fable 5, fork) — 🔴 BLOCKUX-level review of UX-Verdict: BLOCK cannot evaluate: missing stills of the new "Something went wrong" terminal-state error, the capacity notice, and three of the five cleanup-failure notice variants. Evidence gaps
Watch
Suggestions
[UX-REVIEWED] a030094 |
First Principles Review (Fable 5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS Per-chat terminal scoping is a regroup with no named failing user — base pinned the panel app-wide by design, and per-chat terminal tabs already exist. Not justified as shipped
What this change shipsInventory (10 items) — 6 justifiedIntent: make each chat's docked terminal panel, popout and deletion lifecycle belong to that chat — an ADDITION (a redesign of terminal ownership).
More than 10 exist (global test fixture rework, three new one-consumer Watch
Subtractions
[FIRST-PRINCIPLES-REVIEWED] a030094 |
GPT 5.6 Review (fork) — ✅ no blocking findings (all downgraded on adjudication)Reviewed Opus 4.8 adjudication downgraded every blocking finding to advisory. Adjudication downgraded all 1 blocking finding(s) to advisory: the remedy each one requires is disproportionate to the harm it prevents. Read them as advice, not as merge conditions. Review detailsBLOCKING -- website/src/App.tsx:1346 -- Terminal ownership change leaves the feature map incorrect (origin: validation) Adjudication (Opus 4.8) — is blocking on each finding proportionate?Verified from code opened this run:
LOW — stale descriptive phrase in an explicit navigation index whose ownership columns stay correct; conditions confirmed at App.tsx patch:288-292 and README.md:88; the map's own maintenance contract (README.md:14-18) excludes behavior-only changes, so blocking a merge to force this edit is disproportionate. |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo merge-blocking issues; one advisory finding. FINDING — website/src/components/BottomTerminalPanel.tsx:~130 — in the last-popout-tab branch, [OPUS-REVIEWED] a030094 |
882ae2f to
3cee868
Compare
3cee868 to
d5e765f
Compare
ef02933 to
5510686
Compare
Keep terminal tabs, selection, visibility and errors with their chat. Commit shared state atomically before publishing it across windows. Retire terminals after confirmed history deletion, preserve archived sessions, and fence stale operations while allowing valid key reuse. Expose bounded cleanup and interrupted-operation recovery without repeating an already confirmed history deletion.
6007c60 to
a030094
Compare
|
Confirming the A user hit the "Couldn't stop this terminal's shell on the server. It will be cleaned up automatically." banner and I traced it to the same place this PR fixes. The For anyone else who lands here: the isolated core of this change is a one-liner — The PR currently shows |
|
🤖 Kiro Crew [operator: dwu96#8c08bee0]: This PR has been inactive for 7+ days. I reviewed the blockers but they require your input:
The branch is also When you've addressed these, the pipeline will re-assess on its next cycle. |
bolichen97
left a comment
There was a problem hiding this comment.
Request changes: terminal storage can block history deletion for good, and Retry cannot clear it
The First Principles and Design reviews already cover the per-chat dock and fail-closed terminal creation, and the maintainer note accepted both. I'm not reopening those. That note set one condition: the IndexedDB prerequisite for history deletion "must remain visibly recoverable". At a030094 the failure is visible but not recoverable. It also applies when the terminal is turned off.
1. Retry repeats the step that failed.
website/src/lib/historyTerminalCleanup.ts:85-98 sets the fence before the HTTP call:
lease = await prepareTerminalRetirement(key)
...
const result = await api.deleteSession(key)If the fence rejects, the catch records { phase: 'delete', lease: undefined } and rethrows, so the DELETE is never sent. For that phase, the notice's Retry (HistoryTerminalCleanupNotice.tsx:27) is dispatch(deleteHistorySession(failure.key)). On re-entry, deleteConfirmedHistory (:74-81) has no lease to cancel, so it calls prepareTerminalRetirement again.
Scenario: indexedDB is undefined (website/src/utils/terminalStateLock.ts:60, code unavailable), or indexedDB.open keeps erroring (code storage). Every delete from the sidebar (ChatSidebar.tsx:8674, :8723) and every Retry then fails the same way. The notice stays and no chat history can be deleted. A transient failure, such as the 5 s timeout, can clear on a later Retry. A persistent one cannot.
2. No terminal gate.
website/src/store/chatSlice.ts:3382 now always awaits deleteHistoryWithTerminals(key), where the base called api.deleteSession(key) directly. A user with dashboard.terminal.enabled: false never gets a terminal, yet deleting history still depends on IndexedDB.
Who is affected: only environments where IndexedDB is missing or keeps failing. In those environments history deletion stops working, including for users who disabled the terminal.
Smallest fix:
- In
deleteConfirmedHistory, skip the fence whenisTerminalEnabled()(website/src/utils/terminalRegistry.ts:17) returns false. - On a
TerminalStateLockErrorwith codeunavailable(and probablystorage), callapi.deleteSessionwithout a lease. Terminal creation already fails closed in that state. The worst case is a leftover terminal bucket the user closes by hand, which is what the base already does for every deleted chat. - Keep
timeoutfail-closed, because Retry already handles it. - Add a test with
indexedDBundefined that proves the delete goes through.
From a full open-PR audit against origin/main c66f95b (2026-09-25); findings were checked by independent reviewers reading the code. Reply here if this is wrong.
|
Open-PR triage (origin/main a97659d): rebase needed, plus one overlap to coordinate Verdict: OVERLAPPING with #10724, PARTIALLY_COVERED by #11791. Recommendation: rebase and continue development. Do not close. Rebase. The head
Already on main. #11791 ( Overlap to coordinate: #10724 (close menus on terminal tabs). It adds Close others, Close to the right and Close all to
The two are complementary, not duplicates. Design note, not blocking. The merged RFC #7649 ( The request-changes review from 2026-09-25 still applies to this head: with IDB unavailable, history deletion is blocked permanently and Retry cannot clear it ( |
|
Thank you @Skymore for this careful work on per-chat terminals, including the cross-window locking and popout pinning. We are closing it because the branch is now thousands of commits behind main, with conflicts in files that were reworked or deleted (PanelToggles, the chatSlice split), and the 2026-09-25 review is still open: if IndexedDB is unavailable, no chat history can be deleted and Retry cannot recover, even with terminals turned off. The close-on-404 part already landed in #11791. If you would like to continue, a fresh PR against current main that keeps history deletion independent of terminal storage would be very welcome. The branch is left untouched, so you can reopen this PR at any time, or open a fresh one on current main, if you want to pick it back up. |
Problem / Motivation
The docked terminal shares one tab list and active shell across every chat. Switching to another chat exposes the previous chat's terminals, and a terminal popout is not bound to the chat that opened it.
Why it matters
Terminal commands and close actions can target a different conversation's shell. Independent windows must agree on ownership and the existing eight-terminal creation cap without dropping updates or restoring deleted terminals.
What changed (motivation → approach → change)
Terminal tabs, ordering, selection, visibility and errors now belong to their originating chat. Geometry remains shared. Legacy ownerless tabs migrate once to the first selected chat, retaining their PTY IDs.
IndexedDB transactions own terminal state and cap checks across windows. React publishes committed revisions; localStorage carries layout preferences, the one-time migration input and refresh notifications. A mutex around localStorage was insufficient in native-browser testing because another renderer could read stale cached bytes.
Terminal popouts retain their origin in their URL and window identity. Explicit Return selects the origin chat and closes the popup only after reopening succeeds. Native close preserves the main window's selected chat. Socket release precedes close acknowledgment, and the main host refreshes canonical state before reconnecting terminals.
Confirmed permanent history deletion retires the matching terminal generation and releases its capacity. A canonical preparation prevents another window from creating terminals in that generation during deletion; failed HTTP requests preserve the conversation and terminals. Archive/resume remains unchanged. Cleanup failures expose a bounded Retry area, while an interrupted operation offers an explicit terminal-only close without guessing whether history deletion succeeded. Fresh validated reuse of a session key gets a new generation, so old callbacks and cleanup receipts cannot delete its terminals.
Tests
A complete frontend run on
5da502d66finished with 32,150 passed tests, five failed i18n checks, one expected failure, two skips, and three unhandled errors in the chat deep-link fixture. The i18n failures were corrected in the five added messages and quote registration; all 683 i18n tests now pass. The deep-link fixture now uses valid normal-chat slots and the same store as its Provider, with a controlled pending response. All 51 chat jump/deep-link tests pass without unhandled errors. This is not a claim that the final full suite has been rerun green.After rebasing onto
075e77ca5, 205 affected upstream/terminal tests and 33 follow-up retirement/popup tests passed. TypeScript, the production build and i18n lint passed. The separate Electron suite passed 1,849 tests with one Windows-only skip.Shared backend verification ran against unchanged Python sources: 97,375 passed, 213 failed and 380 errors. Representative baseline reproductions identified host atomic-rename limitations, dependency/ABI issues and installed-edition contamination; 60 failure/error rows remain unclassified. The backend suite is not claimed green. CI requires maintainer approval before the fork workflows can run.
Manual verification
Native Chromium verification of the canonical adapter completed 200 concurrent mutations across four windows on both secure and insecure origins. Each run retained exactly eight unique terminal IDs and revision 200 after reload. The independent production build also passed mocked browser checks in light and dark themes: A/B tab isolation, active-tab restoration, popup origin pinning, explicit Return to A, and native close while B stays selected. All APIs and WebSockets were mocked; no real PTYs were created.
Screenshots / video
Light theme verification
Permanent deletion and interrupted cleanup
Production-browser checks cover confirmed deletion, a cleanup failure after server confirmation, and a reload before a deletion response. Cleanup retry does not repeat the history DELETE. Interrupted recovery requires an explicit terminal-only close, preserves the history row, and releases the eight-terminal capacity. APIs and WebSockets are mocked.
history-cleanup-retry.webm
history-interrupted-recovery.webm
Related Issues
Related terminal lifecycle work: #7649 and #8863. This PR changes client-side panel state and is independently based on main.
Pattern harvest
Rule candidate: review-prompt
Pattern: Cross-window state mutations must read their authoritative transaction snapshot; acquiring a lock does not make another renderer's localStorage cache current.
Checklist
Contribution License Agreement