Skip to content

Fix agent_picker_pending surviving realm changes - #32

Merged
ElSargo merged 1 commit into
mainfrom
fix/agent-picker-pending-realm
Sep 16, 2026
Merged

ElSargo merged 1 commit into
mainfrom
fix/agent-picker-pending-realm

Conversation

@ElSargo

@ElSargo ElSargo commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace unscoped agent_picker_pending: bool with Option<(backend_id, session_id)>.
  • Clear agents + pending via clear_agent_registry_for_realm_change on Snapshot, layout-state focus change, activate/create CommandCompleted, and worktree completion realm changes.
  • Fulfill registry replies only when pending realm matches current realm (fulfill_pending_agent_picker).
  • Remit Agent-picker intent changes realm while it waits in docs/frictions/ui-concurrency.md.

Fixes #28

Test plan

  • cd plugins/session-switcher && RUSTFLAGS='-C linker=cc' cargo test --lib — 46 passed (includes 2 new realm-change / mismatched-pending regressions)
  • Manual: press coding-agent shortcut in session A with empty agents, switch to session B before registry arrives; confirm B does not auto-open agent/picker

@ElSargo ElSargo left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brood QA review

Checked: diff/view; CI run 35150445688 was IN_PROGRESS at review start; friction agent-picker section + Fixes #28; audit alignment.

Code: Correct remittance. agent_picker_pending: Option<(backend_id, session_id)>; clear_agent_registry_for_realm_change on Snapshot, layout-state focus change, activate/create completion, and worktree realm change; fulfill_pending_agent_picker only opens UI when pending realm == current. Defense-in-depth test for mismatched pending without prior clear. Author: 46 lib tests locally.

CI: Was in progress; sibling PRs fail on runner ENOSPC — re-run after disk relief before merge.

Race-doc: Agent-picker realm friction remitted accurately.

Desktop verify: Blocked (no nix/client build). Manual A→B session switch before registry reply still recommended.

Residual / merge: Stacks with #21/#29 on session-switcher + friction doc. Residual: discovery picker correlation hole (backend-discovery constant) remains open elsewhere.

— Brood QA

@ElSargo ElSargo left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brood QA review

Checked: gh pr view/diff/checks 32; issue #28 + docs/frictions/ui-concurrency.md; all agent_picker_pending / realm-mutation sites in plugins/session-switcher; local RUSTFLAGS='-C linker=cc' cargo test --manifest-path plugins/session-switcher/Cargo.toml --lib → 46 passed.

Code: Correct remittance of “Agent-picker intent changes realm while it waits”. Pending is now Option<(backend_id, session_id)>; Snapshot, layout-state focus, activate/create CommandCompleted, and worktree completion clear via clear_agent_registry_for_realm_change; fulfill_pending_agent_picker no-ops (and clears) on realm mismatch. Matches #28 expected behavior, including the activate/create gap called out in the issue.

Tests: agent_picker_pending_must_not_fulfill_after_realm_change + agent_picker_pending_ignores_mismatched_realm_without_prior_clear cover clear+fulfill and defense-in-depth. (Nit: helpers rather than full reducers — acceptable.)

CI: Run 35150445688 failed with runner ENOSPC (same infra class as sibling PRs). Not a code fail; treat green CI / re-run after disk relief as merge gate.

Desktop verify: Not needed — reducer race is unit-covered; manual session-switch while waiting remains optional polish.

Residual / merge: Stacks with #21/#29 on session-switcher + shared friction doc — coordinate merge order. No logic objection.

— Brood QA

Scope the coding-agent shortcut pending intent to (backend_id, session_id),
clear it on Snapshot/layout-state/activate-create/worktree realm changes, and
ignore mismatched registry fulfillment. Remits the ui-concurrency friction.

Fixes #28
@ElSargo
ElSargo force-pushed the fix/agent-picker-pending-realm branch from 76edc0e to 55adc92 Compare September 16, 2026 21:46
@ElSargo
ElSargo merged commit ca26147 into main Sep 16, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

session-switcher: agent_picker_pending survives realm change and opens agent in new session

1 participant