Skip to content

[Bug] Flickering/Broken file tabs in workspace, unable to close/delete #21189

Closed as not planned

Description

@orca-discord-issues

Anton Eriksson Anton Eriksson via Discord

This bug where file tabs (not terminal/agent tabs) in a workspace are unable to be closed and starts flickering around is extremely annoying and sometimes makes the whole workspace unusable. Please see the attached video of the tab bar flickering, and the screenshot is of one of the filetabs. I have not succeeded in closing these down even after restarting Orca or refreshing because as soon as i close a tab through UI or cmd+w it reopens again.

Orca version: 1.4.204
Mac mini: M4, 24gb, macOS 26.5.2
Screen_Recording_2026-09-17_at_09.51.46.movimage.png

Activity

  1. added
    bug
    on Sep 17, 2026
  2. orca-discord-issues commented on Sep 17, 2026

    @orca-discord-issues
    Author

    Anton Eriksson Anton Eriksson via Discord

    This persists on 1.4.205

  3. orca-discord-issues commented on Sep 17, 2026

    @orca-discord-issues
    Author

    FireSly FireSly via Discord

    I suspect what might be happening is a state-sync loop: when you close the tab (closeFile), Orca’s host or store state might be immediately re-mirroring it back into openFiles. Because it's bouncing between closed and open every few milliseconds, React gets stuck in a rapid re-render loop. Since it persists across restarts, the ghost tabs are likely already committed to Orca’s session cache on disk.

    Curious if clearing the cached open files from your settings file unbricks it:

    1. Quit Orca completely (Cmd + Q).
    2. Make a backup and inspect:
      ~/Library/Application Support/Orca/orca-data.json
    3. Under "openFilesByWorktree", find your workspace ID and set its array to empty:
      "openFilesByWorktree": {
        "<workspace-id>": []
      }
    4. Save and relaunch: does the tab bar stabilize?
    
    ───────────────────────────────────────────────────────────────
    
    💡 Automating this with an Agent:
    We actually just put together a lightweight diagnostic skill (orca-diagnostics) designed to let your agent troubleshoot and self-heal these exact issues (reading main.trace.ndjson, auditing
    sockets, and safely cleaning corrupted orca-data.json cache offline).
    
    If you want your agent to handle this for you, ask it:
    ▏ "Use the orca-diagnostics skill to quit Orca, inspect ~/Library/Application Support/Orca/orca-data.json, clear any stuck entries under openFilesByWorktree for this workspace, validate the
    ▏ JSON, and relaunch."
    
    (Also curious: is this a local workspace or connected over SSH? That might help narrow down which side is triggering the re-mirror).
    
    
  4. orca-discord-issues commented on Sep 17, 2026

    @orca-discord-issues
    Author

    Anton Eriksson Anton Eriksson via Discord

    The bug appears locally but i do share it over tailscale to my laptop.

    AI Diagnosis after using your skill above

    High-confidence Orca bug in remote-session tab reconciliation, still present in 1.4.205:

    1. The affected file belonged to the now-deleted my-feature-branch worktree.
    2. Closing removes the mirrored tab locally, then asynchronously calls host RPC session.tabs.close.
    3. The host returns selector_not_found because the worktree no longer exists.
    4. Orca only treats tab_not_found as an idempotent successful close. It clears the close tombstone for
      selector_not_found.
    5. The authoritative host snapshot then republishes the tab, causing the reopen/flicker loop. File loading consequently
      displays selector_not_found.

    Evidence

    • The worktree and screenshot file no longer exist or appear in registered worktrees.
    • The stale worktree is absent from local persisted UI state, ruling out ordinary local JSON corruption.
    • The active paired environment owns mirrored editor tabs.
    • Shipped code confirms tab_not_found is handled during close, while selector_not_found is not.
    • Renderer health and memory were normal; the older detached terminal daemon is not involved in this editor-tab path.
  5. AmethystLiang commented on Sep 17, 2026

    @AmethystLiang
    Contributor

    thanks for reporting. looking into it

  6. orca-discord-issues commented on Sep 17, 2026

    @orca-discord-issues
    Author

    FireSly FireSly via Discord

    Anton Eriksson thanks for testing that skill. My agent got a little excited and was able to reproduce the bug and then jumped off and built a fix. #21277

  7. LesleyMurfin commented on Sep 17, 2026

    @LesleyMurfin
    Contributor

    We investigated this issue and opened PR #21277 (#21277) with a comprehensive fix.

    Root Cause

    When tabs reference already-removed worktrees/selectors, attempting to close them returned a selector_not_found error from the host RPC. Because this was treated as an unexpected error rather than an idempotent cleanup, the client reconciler dropped the close intent tombstone and immediately resurrected the ghost tab, causing the rapid flicker / loop observed when repeatedly attempting to close it.

    Fix Details

    1. Host RPC Idempotence (session.tabs.close & session.tabs.closeLifecycle):
    2. Renderer Lifecycle Reconciliation:
      • hostHasNoSuchTab now properly recognizes missing target errors and retains durable tombstones, preventing phantom tab resurrection during reconciliation.

    Verification

    • Vitest Suite: 47/47 vitest tests pass across the tab lifecycle test suites (packages/host/test/tabs.test.ts, packages/app/test/tab-reconciler.test.ts, and related specs).
    • Reproduction & Simulation: Standalone repro script verified both reproduction of the flicker loop against the old behavior and clean dismissal without resurrection under the fix.
    • Full Build: Full production build (pnpm build) completed successfully.
  8. orca-discord-issues commented on Sep 18, 2026

    @orca-discord-issues
    Author

    Jinjing Jinjing via Discord

    nwparker is looking into it

  9. 9 remaining items

  10. added
    os:macos
    on Sep 19, 2026
  11. added theissue type on Sep 19, 2026
  12. orca-discord-issues commented on Sep 21, 2026

    @orca-discord-issues
    Author

    nwparker nwparker via Discord

    this should be fixed btw

  13. nwparker commented on Oct 7, 2026

    @nwparker
    Contributor

    Re-audited after the Discord auto-archive recovery. Closing as fixed on current main: Merged #21277 retains missing-target close intents durably across the normal TTL when the host returns selector_not_found, preventing the exact ghost file-tab resurrection/flicker; regression test covers this and maintainer subsequently confirmed fixed.

    Evidence: #21277, https://github.com/stablyai/orca/blob/acea59c6d874dbb2ffdce98f4e34a2e649b82a83/src/renderer/src/runtime/web-runtime-session-tab-lifecycle.ts, https://github.com/stablyai/orca/blob/acea59c6d874dbb2ffdce98f4e34a2e649b82a83/src/renderer/src/runtime/web-runtime-session-tab-activate-close.test.ts.

    If the same problem persists on a build containing this change, please reply with the version and reproduction steps so we can reopen it.

  14. nwparker commented on Oct 7, 2026

    @nwparker
    Contributor

    Correction after independent review against current main: reopening. My previous closure overstated #21277. The shipped renderer keeps close suppression durable for tab_not_found/terminal_tab_not_found, but explicitly treats selector_not_found as transient and clears the close intent. Its regression test also expects selector_not_found to fail without durable suppression. This report specifically diagnoses a deleted-worktree selector_not_found, so that narrower merged change is not sufficient evidence the reported flicker is fixed.

    Current code:

    }
    // Why the split: 'tab_not_found' and 'terminal_tab_not_found' prove definitive surface absence.
    // Restoring the mirror on it hands the user back a pane the host cannot close and whose handle is already gone (#9194, #21189),
    // so keep the suppression and drop its TTL instead.
    // 'selector_not_found' is a transient worktree resolver state (e.g. during scans or cache warm-up,
    // per remote-browser-stream-errors.ts) and must not become a durable close tombstone.
    // Every other failure is a "not now".
    const hostHasNoSuchTab =
    hasRuntimeRpcErrorCode(error, 'tab_not_found') ||
    hasRuntimeRpcErrorCode(error, 'terminal_tab_not_found')
    for (const hostTabId of closeIntentTabIds) {
    if (hostHasNoSuchTab) {
    makeWebSessionCloseIntentDurable(intentOwner, args.worktreeId, hostTabId)
    } else {
    clearWebSessionCloseIntent(intentOwner, args.worktreeId, hostTabId)
    }
    }
    if (isLifecycleClose) {
    const { acceptReplayedWebSessionTabsSnapshot } = await import('./web-session-tabs-sync')
    acceptReplayedWebSessionTabsSnapshot(environmentId, args.worktreeId)

    Current regression:
    // Note: 'selector_not_found' is a transient scan cache miss during worktree discovery, not
    // definitive absence proof, so it classifies as 'failed' and must not drop TTL eviction.
    it.each([
    ['tab_not_found', 'unknown-tab'],
    ['selector_not_found', 'failed'],
    ['terminal_tab_not_found', 'unknown-tab'],
    ['runtime_rpc_timeout', 'failed']
    ])('classifies a %s close refusal as %s', async (code, outcome) => {
    const runtimeCall = vi
    .fn()
    .mockResolvedValueOnce({ id: 'close', ok: false, error: { code, message: code } })
    .mockResolvedValueOnce({ id: 'list', ok: true, result: makeSnapshot() })
    vi.stubGlobal('window', { api: { runtimeEnvironments: { call: runtimeCall } } })
    await expect(
    closeWebRuntimeSessionTab({
    worktreeId: WORKTREE_ID,
    tabId: 'local-browser-unified',
    reason: 'user'
    })
    ).resolves.toBe(outcome)
    })
    // #9194: a host can answer tab_not_found and still keep republishing the surface. The close
    // intent is what hides the mirror, so letting it age out handed the user back a phantom pane
    // whose handle is already gone -- and closing it again just restarted the same TTL loop.
    // 'selector_not_found' is transient, so it does not become durable and its suppression expires.
    it.each([
    ['tab_not_found', true],
    ['selector_not_found', false],
    ['terminal_tab_not_found', true],
    ['runtime_rpc_timeout', false]
    ])('keeps a %s close suppressed past the close-intent TTL: %s', async (code, stillPending) => {
    const runtimeCall = vi
    .fn()
    .mockResolvedValueOnce({ id: 'close', ok: false, error: { code, message: code } })
    .mockResolvedValueOnce({ id: 'list', ok: true, result: makeSnapshot() })
    vi.stubGlobal('window', { api: { runtimeEnvironments: { call: runtimeCall } } })
    await closeWebRuntimeSessionTab({
    worktreeId: WORKTREE_ID,
    tabId: 'local-browser-unified',
    reason: 'user'
    })
    const hostTabId = toHostSessionTabId('local-browser-unified')
    expect(

    A current-build reproduction or a complete missing-worktree cleanup fix is still needed before closing.

  15. nwparker commented on Oct 7, 2026

    @nwparker
    Contributor

    Final code-path check confirms this is fixed on main, with a correction to my earlier explanation. #21277's production tab list/close paths use explicit worktree IDs, so closing an orphaned file tab bypasses worktree lookup even after that worktree disappears. A definitive missing-tab response also keeps the closed tab suppressed across later snapshots.

    selector_not_found itself is intentionally temporary; my original claim that it was durably suppressed was incorrect. I reopened while checking this distinction, and am closing again based on the verified explicit-ID close path.

    Final merged change, current close implementation, and close/suppression coverage. Please reopen with the version and steps if orphaned file tabs still cannot be closed on a current build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugcherry-pickos:macos

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions