Skip to content

bug(dispatch): closing a project tab leaves grid rows bound to it, so New Agent silently does nothing #863

Description

@Juliusolsson05

Expected

Closing a project tab removes it from every Grid Dispatch row's project binding (DispatchGridRow.projectTabIds), so no row stays restricted to a project that no longer exists, and New Agent… from such a row's empty lane still creates an agent somewhere sensible.

Actual

closeTab (src/renderer/src/workspace/hook/actions/tab.ts) clears tiled lanes pointing at the killed sessions (clearTiledLaneSessions) but never touches row bindings. The binding scrub, scrubGridRowMetadata, runs only at the persistence boundary (src/renderer/src/workspace/sessionOwnership.ts), which cleans the copy written to disk, not the live state. For the rest of the session a row can stay bound to a closed tab.

Consequences in that state:

  1. The row's index is blank (it filters to a project that has no agents).
  2. New Agent… from an empty lane in that row targets the dead tab: resolveDispatchSpawnTarget returns the bound tab id, createDetachedDispatchAgent hits if (!tab) return null (workspace/hook/actions/pane.ts) — no toast — and the placement overlay stays open because its commit latch is set and only a successful spawn closes it. The user gets no feedback and has to Escape.

Reproduction

  1. Grid Dispatch with two rows. Bind row 2 to project B only (Row Projects…).
  2. Close project B's tab.
  3. Focus an empty lane in row 2 and run New Agent…, pick Claude, press Enter.

Result: nothing is created, no message, the overlay remains until Escape.

Impact

Silent failure of the primary creation command; a confusing blank row index until restart.

Suggested fix

Scrub row bindings in closeTab with the helper that already exists for this (scrubGridRowMetadata), so memory matches what autosave writes. Possibly also toast in createDetachedDispatchAgent's missing-tab branch so any future stale target is visible.

Notes

Found during review of #860 (New Agent In…). That PR makes its own dialog say "None of this row's projects are open" in this state, but does not fix the root cause.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions