Skip to content
TheChatArchiveThe Chat Archive
gpt-5.6-sol· openaiHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Floating terminal auto-creates tab after user closes the last one…

  1. User

    ISSUE DESCRIPTION

    Floating terminal auto-creates tab after user closes the last one

    Floating terminal auto-creates tab after user closes the last one

    Symptom

    When the floating terminal has a single tab open and the user clicks the X button to close it, the panel auto-creates a new terminal tab instead of closing the panel. The user has to close the panel manually via the minimize button or by closing the newly created tab again.

    Steps to reproduce

    1. Open the floating terminal (Cmd+Alt+T on Mac / Ctrl+Alt+T on Windows/Linux)
    2. The panel opens with one auto-created terminal tab
    3. Click the X button on that tab to close it
    4. Expected: Panel closes cleanly
    5. Actual: Panel stays open with a fresh auto-created tab

    Root cause

    The closeTab callback used for the X button triggers the auto-create effect (lines 102-108 in FloatingTerminalPanel.tsx) that spawns a tab whenever the panel is open with zero tabs. The panel never closes because a replacement tab is created before the close check can run.

    Additionally, closeOthers and closeToRight context menu actions had stale closure bugs—they read tabs.length from the captured array in useCallback dependencies instead of pulling fresh state via useAppStore.getState(), causing these callbacks to operate on outdated tab lists.

    Expected behavior

    • Clicking X on the last terminal tab should close the floating panel (symmetric with the auto-create on open)
    • The panel should remain open if a PTY exits so the user can see exit status
    • Multi-tab operations (closeOthers, closeToRight) should operate on current state, not stale captures

    Why it matters

    The asymmetry breaks user expectations: the panel auto-creates a tab on open (hotkey press), but closing that tab doesn't reverse the action. Users expect the X button on the last tab to dismiss the panel, not spawn an orphaned replacement.

    Environment

    • All platforms (macOS, Linux, Windows)
    • Floating terminal feature introduced in recent releases

    Evaluation contract

    Bootstrap a terminal tab only when the panel transitions open. An explicit close action that removes the last tab closes the panel; a PTY exit removes its tab but must neither close the panel nor create a replacement tab. Bulk close operations must read the current store state rather than a stale render-time tab list, and closeToRight must follow the reconciled visible tab-bar order rather than raw backing-array order.

    Interface

    No new interfaces are introduced.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /orca, current file: none) bash-$

  2. Assistant

    I’ll first inspect the repository structure and locate the floating terminal component, its store actions, and relevant tests. Then I’ll trace the lifecycle paths for panel opening, explicit tab closure, PTY exit, and bulk closure before making a focused change.

  3. Assistant

    The target component is present and dependencies are installed. I’ll now read the full component plus terminal state definitions and search for tests or analogous tab-closing implementations, with special attention to how visible tab order is reconciled.

  4. Assistant

    The current code confirms both reported defects: the bootstrap effect keys off the steady state (open && tabs.length === 0), and bulk callbacks capture render-time tabs. I also need the remainder of the JSX to identify PTY exit wiring and TabBar’s exact ordering semantics, so I’ll inspect those next using standard grep because ripgrep is unavailable.

  5. Assistant

    The PTY path is distinct (onPtyExit) and can continue calling the store close directly, while explicit UI closure should route through a wrapper that checks fresh state and hides the panel when it closes the sole remaining floating tab. For closeToRight, I’ll reuse the same reconciliation helper as TabBar, not duplicate ordering logic, ensuring stale/duplicate/missing order entries are handled identically.

  6. Assistant

    The ordering helper takes terminal IDs and returns precisely the rendered order after filtering stale IDs, deduplicating, and appending tabs absent from stored order. I’ll make the lifecycle and callback changes now: track the previous open value, bootstrap from fresh store state only on a false→true transition, distinguish explicit close from PTY exit, and snapshot fresh store state for each bulk operation.

  7. Assistant

    Python is not installed in this environment, so no file was changed. I’ll apply the identical deterministic replacements with Node, which is available in this TypeScript repository, then inspect the resulting diff.

  8. Assistant

    The diff now preserves the intended distinction: onPtyExit removes its tab without hiding the panel, while both the tab X and TerminalPane’s explicit close request use the panel-closing wrapper. Before broader tests, I’ll run the formatter in check mode, lint the changed file, and execute the web TypeScript check to catch hook/type/import issues.

  9. Assistant

    pnpm is only a Corepack shim here and attempted an interactive network download, which this environment disallows; no checks actually ran. Since node_modules exists, I’ll invoke the repository-local binaries directly and capture each status independently.

  10. Assistant

    Lint and web typechecking pass. The formatter reports only style drift, so I’ll format just the changed source file (not the repository), then inspect the diff and check whether formatting introduced any unrelated changes.

  11. Assistant

    The formatted diff is limited to the target component. I’ve considered the main race cases: a stale tab ID cannot hide the panel; closing one of multiple tabs does not hide it; PTY exit never uses the explicit-close wrapper; and reopening an empty panel creates exactly one tab because the effect observes only the open transition. I’ll now run the directly related tab-order and floating-terminal tests, followed by the full unit suite if feasible.

  12. Assistant

    All 11 targeted tests pass. I’ll run the complete Vitest suite now; if the terminal’s short execution limit truncates it, I’ll report that clearly and still verify final lint/typecheck/status afterward.

  13. Assistant

    The full suite completed: 6,711 tests passed, while unrelated suites failed because the uploaded node_modules lacks Electron, node-pty, and better-sqlite3 native binaries (plus a few environment-sensitive root-permission tests). The directly relevant tests remain green, and none of those failures touch this component. I’ll perform a final clean-tree review, repeat formatter/lint/typecheck, and verify no test artifacts or unintended files were created.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.