fix(next): Needs input menu opens waiting agent, not latest unread (#5329)

Closed
TE
5d ago
+59-5

What this fixes

HQ #5329: the macOS menu-bar row “Needs input: N” currently executes jumpToUnread, which may open a completely unrelated unread terminal or say there is nothing unread while an agent awaits a decision.

This PR adds the explicit agent.jumpToNextNeedingInput action and binds it to the existing ranked agent lanes. Successive invocations cycle only .needsYou sessions; the list already filters archived/snoozed items and keeps this Mac, Chief-home and remote session identities. Resolved/replaced requests are re-evaluated at each invocation. jumpToUnread and its keyboard shortcut remain unchanged.

The menu-bar count now uses the same eligibility rule as its destination, so a positive count is meant to have an actionable target. The action is also discoverable via the palette/Window menu, with no forced default shortcut or new sidebar setting. Uses the app’s existing SidebarPriorityFeed.open path so it does not introduce a competing session opener.

Exact code / regression

Base: manaflow-ai/cmux@feat-cmux-next 4d1e169b8e782755f67812a53f909a3dae5d7194

Commit: 7b1a6fae356e52e69ae1d5b1b1397d32ba382155

  • MenuBarMenuSpecTests.agentStatus: menu row invokes the new action, preserving zero-count hiding.
  • AgentPriorityRankingTests.nextNeedsInputCyclesAndSkipsResultsAndSnoozedChats: cycles two input lanes; never selects newer unread results or failed lanes; skips snoozed/archived input and starts at a fresh request after the earlier one was removed.

Validation: exact base-to-commit diff checked (7 files; 59 insertions / 5 deletions). Native Swift compilation, focused tests, signed-app and keyboard/VoiceOver captures are pending (this author has GitHub read/write, no macOS checkout/CI runner or fleet access). Treat this as an unverified draft, not a passed fix or shipment.

Required acceptance before review / merge

  1. Execute MenuBarMenuSpecTests and AgentPriorityRankingTests on the exact PR head using the repo's pinned macOS toolchain, plus action registry binding/coverage gates.
  2. On a signed NEXT build: one blocked agent with hasUnread=false plus one newer unread terminal; the menu must select the agent. Repeat with zero unread tabs, then 3 blocked agents to cycle. Resolve one ask between menu open and action; avoid dead tabs and wrong-host navigation. Retest with priority sidebar hidden.
  3. Validate counts and ability to open cross-Mac and Chief-home sessions; known wrong-daemon issues cmux #27934 / #27879 remain their own owners. Test no eligible item, stale/offline peer, and focus/VoiceOver. If the current host opener cannot safely navigate remote peers, hold and route that defect to those owners.

Ownership/dedupe: existing HQ #5329 is canonical; cmux #24336 is separate and on a visual HOLD, unaffected by this PR. Parent idea-lab writeback: HQ #5457.

No defaults, product design policy, production flags, credentials, billing, merge or deployment changed.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes the macOS menu-bar “Needs input: N” row so it now jumps to the next agent actually waiting for input, instead of the latest unread terminal. Adds the agent.jumpToNextNeedingInput action, which reuses the ranked, snooze-aware agent lanes and cycles only .needsYou sessions.

The menu-bar count now uses the same eligibility rule as its destination, so a positive count always has actionable targets. jumpToUnread and its keyboard shortcut are unchanged, and the new action is available via the palette and Window menu with no default shortcut. Resolved, archived, or snoozed requests are skipped, and a removed request resets the cycle to the first remaining lane.

Tests cover the menu row wiring and cycling through mixed states (needs input, unread results, failures, snoozed chats).