Skip to content

Add Cursor orchestration group routing - #8436

Merged
AmethystLiang merged 1 commit into
stablyai:mainfrom
nikg24:add-cursor-orchestration-group
Jul 13, 2026
Merged

AmethystLiang merged 1 commit into
stablyai:mainfrom
nikg24:add-cursor-orchestration-group

Conversation

@nikg24

@nikg24 nikg24 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add @cursor to the orchestration agent-name groups, so it resolves to running Cursor terminals instead of zero recipients
  • resolve it by Cursor title identity rather than a name token, because cursor is the one group name that is also ordinary vocabulary in another agent's task title
  • reuse the identity predicate orchestration delivery already applies to Cursor, by hoisting isCursorAgentTitle out of orca-runtime.ts into src/shared/agent-title-core.ts
  • cover Cursor's real titles plus caret-text, path, hyphen, and dotted false positives

Cursor was already first class everywhere else: launchable in tui-agent-config.ts, managed status hooks, title detection, and --inject accepts it via isTerminalRunningAgent. Only the group allowlist omitted it.

Design

grok, droid, codex, mimo, gemini are coined names. cursor is an English noun, in a terminal app, that agents type into their own OSC titles constantly. It is the only entry in AGENT_NAMES with that property, and it is why this group cannot use buildAgentNameRe.

buildAgentNameRe('cursor') returns true for all three titles below. None is a Cursor terminal:

Title Actual owner
⠋ preserve cursor visibility across replays Claude Code (working)
⠋ Codex: fix cursor offsets Codex
Terminal Cursor and Orca slows down plain shell or tab title

None of Claude Code's four title prefixes (✳, . , * , braille spinner) contains its own name, so in a Claude terminal working on caret code, "cursor" is the only agent-like token the title has. Group resolution is a routing authority: delivery writes the message into the target terminal's live prompt, so a false positive types into another agent's session. Anyone using Orca to work on Orca hits this, since the codebase talks about cursors constantly.

So ambiguous names register an identity matcher instead of a token regex. The resolver keeps no agent-specific branch, and every other group's matching is byte-for-byte unchanged:

const GROUP_TITLE_MATCHERS: Partial<Record<AgentNameGroup, (title: string) => boolean>> = {
  cursor: isCursorAgentTitle
}

isCursorAgentTitle is not new. It already existed privately in orca-runtime.ts, where delivery uses it to suppress synthesized Enter, since Cursor treats injected PTY text as editable prompt input. Its comment names this exact hazard: "display labels can mention Cursor in another agent's task text." Moving it into shared means routing and delivery share one predicate rather than growing a second, weaker one. It is behavior-identical; the only edit is the inline 'cursor agent' literal collapsing into the CURSOR_NATIVE_TITLE_LOWER constant already in that file.

That also answers the brittleness question. Delivery's auto-Enter suppression already depends on this vocabulary, so a Cursor label change breaks there first and louder. The vocabulary already had to be maintained; this makes it one place instead of two, and a test pins it against SYNTHETIC_AGENT_TITLE_PROFILES.cursor.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added tests that would catch a regression

orca-runtime.test.ts is not touched by this PR and passes unchanged (660 tests). Its existing case "still auto-submits to a non-Cursor agent when its idle title mentions Cursor Agent" is exactly the delivery behavior the hoist had to preserve, so the pre-existing suite validates it with zero test edits.

Dev Electron/runtime validation with live @cursor routing: with one real cursor-agent terminal and one decoy titled ⠋ preserve cursor visibility across replays, orchestration send --to @cursor resolved recipients=1 to the Cursor terminal and excluded the decoy. orchestration dispatch --inject returned injected=true, and Cursor executed the task and reported worker_done. 0 console errors.

Screenshots

No visual change.

AI Review Report

Reviewed the diff with three independent agents before filing (Codex GPT-5.6 Sol at max reasoning, Grok 4.5 xhigh, and Composer 2.5), each asked to attack the design rather than confirm it, with every finding required to cite file:line and an exact triggering title. All three returned ship with no material findings. Risks checked:

  • Cross-platform (macOS, Linux, Windows) and SSH/remote: no paths, shell behavior, shortcuts, or labels are touched. The Cursor label vocabulary is synthesized by main from hook events and is identical on all platforms and over SSH; only the hook script filename differs, which this PR does not touch. Other groups keep the Windows launcher-suffix rule (grok.exe); Cursor's binary is cursor-agent, so that rule was never load-bearing for it.
  • Agent and integration compatibility: only cursor registers a matcher. A generic resolveTerminalTitleAgentType(title) === agentName guard was tried first and rejected, because it silently breaks @mimo: the group name is mimo but its TuiAgent id is mimo-code. It also still mislabels ⠋ preserve cursor visibility across replays as Cursor.
  • Performance: one string compare or one anchored regex per terminal, on a list already being iterated.
  • Security: no new input parsing, command execution, path handling, auth, secrets, or IPC surface. The change tightens routing authority rather than loosening it: fewer titles can attract @cursor traffic into a live prompt. Residual, and shared with every other group: a user who renames a terminal to an exact agent label can still make it addressable.

Notes

  • @cursor is deliberately less rename-tolerant than other groups. A manually renamed Cursor pane (Cursor - reviewer) is group-unaddressable and resolves to 0 recipients rather than misdelivering; address it by handle. A test pins this so the tradeoff lives in code, not just here.
  • Cursor - action required is accepted but not reachable today, since no subscribed Cursor hook event maps to a blocked state. Kept so the group works unchanged if Cursor ships a permission hook.
  • Display surfaces still token-match cursor in terminal-title-agent-type.ts, so a cursor-mentioning Claude title is labeled Cursor in the UI while @cursor will not deliver to it. Routing is deliberately the stricter of the two. Pre-existing and out of scope; happy to follow up separately.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Added shared Cursor-agent title detection and re-exported it for runtime consumers. Extended orchestration group typing and resolution to support @cursor, including native and synthetic Cursor titles with negative-match coverage. Updated runtime imports, messaging fan-out tests, dispatch error guidance, and orchestration skill documentation.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding Cursor routing to orchestration groups.
Description check ✅ Passed The description is mostly complete and matches the template, though it lacks a separate Security Audit section.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e722c224-e60b-4a05-a77f-084745117ca5

📥 Commits

Reviewing files that changed from the base of the PR and between 88d6fda and 88c7f70.

📒 Files selected for processing (10)
  • config/scripts/orchestration-skill-guidance.test.mjs
  • skills/orchestration/SKILL.md
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/orchestration/groups.test.ts
  • src/main/runtime/orchestration/groups.ts
  • src/main/runtime/rpc/methods/orchestration.test.ts
  • src/main/runtime/rpc/methods/orchestration.ts
  • src/shared/agent-detection.test.ts
  • src/shared/agent-detection.ts
  • src/shared/agent-title-core.ts

- Use `ask` when a worker needs a blocking answer from the coordinator; it waits for the reply and returns the answer directly.
- `check --wait` returns one message at a time. If N workers may finish together, loop N times and dispatch newly ready tasks after each completion.
- Group addresses include `@all`, `@idle`, `@claude`, `@codex`, `@opencode`, `@gemini`, `@droid`, `@grok`, and `@worktree:<id>`.
- Group addresses include `@all`, `@idle`, `@claude`, `@codex`, `@opencode`, `@gemini`, `@droid`, `@grok`, `@cursor`, and `@worktree:<id>`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Doc list omits @openclaude and @mimo group addresses.

AGENT_NAME_GROUPS in groups.ts includes openclaude and mimo, but this line's group-address list doesn't mention them, so agents following this skill doc won't know those groups are addressable.

📝 Proposed fix
-- Group addresses include `@all`, `@idle`, `@claude`, `@codex`, `@opencode`, `@gemini`, `@droid`, `@grok`, `@cursor`, and `@worktree:<id>`.
+- Group addresses include `@all`, `@idle`, `@claude`, `@openclaude`, `@codex`, `@opencode`, `@mimo`, `@gemini`, `@droid`, `@grok`, `@cursor`, and `@worktree:<id>`.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Group addresses include `@all`, `@idle`, `@claude`, `@codex`, `@opencode`, `@gemini`, `@droid`, `@grok`, `@cursor`, and `@worktree:<id>`.
Group addresses include `@all`, `@idle`, `@claude`, `@openclaude`, `@codex`, `@opencode`, `@mimo`, `@gemini`, `@droid`, `@grok`, `@cursor`, and `@worktree:<id>`.

@AmethystLiang
AmethystLiang self-requested a review July 13, 2026 00:11
@AmethystLiang
AmethystLiang merged commit 67cd462 into stablyai:main Jul 13, 2026
1 check passed
AmethystLiang added a commit that referenced this pull request Jul 13, 2026
The worktree card, status bar, and mobile all derive an agent label from the
terminal title via getAgentLabel / resolveTerminalTitleAgentType. Both matched
Cursor with `titleHasAgentName(title, 'cursor')`, a whole-token match. But
`cursor` is ordinary editor vocabulary, so a Claude/Codex tab working on Orca's
own code (title like `⠋ preserve cursor visibility across replays`) got
mislabeled as Cursor. The generic braille-spinner Claude fallback even had a
`!lower.includes('cursor')` guard that then dropped the title to no label at
all.

Gate Cursor on its closed identity title set (`isCursorAgentTitle`) instead —
the same predicate @cursor orchestration routing uses. A real cursor-agent
terminal still resolves as Cursor across working/idle/permission; a non-Cursor
tab that merely mentions a text cursor reverts to its true agent. Relax the
braille guard to the same predicate so those titles land on Claude, not null.

Makes display consistent with routing (the follow-up flagged in #8436).
AmethystLiang added a commit that referenced this pull request Jul 13, 2026
#8445)

* fix(agent-status): label Cursor by identity, not a bare "cursor" token

The worktree card, status bar, and mobile all derive an agent label from the
terminal title via getAgentLabel / resolveTerminalTitleAgentType. Both matched
Cursor with `titleHasAgentName(title, 'cursor')`, a whole-token match. But
`cursor` is ordinary editor vocabulary, so a Claude/Codex tab working on Orca's
own code (title like `⠋ preserve cursor visibility across replays`) got
mislabeled as Cursor. The generic braille-spinner Claude fallback even had a
`!lower.includes('cursor')` guard that then dropped the title to no label at
all.

Gate Cursor on its closed identity title set (`isCursorAgentTitle`) instead —
the same predicate @cursor orchestration routing uses. A real cursor-agent
terminal still resolves as Cursor across working/idle/permission; a non-Cursor
tab that merely mentions a text cursor reverts to its true agent. Relax the
braille guard to the same predicate so those titles land on Claude, not null.

Makes display consistent with routing (the follow-up flagged in #8436).

* refactor(agent-status): address review on Cursor identity labeling

- Trim the four Cursor `// Why:` comments in both parallel resolvers
  (agent-title-identity.ts, terminal-title-agent-type.ts) to AGENTS.md's
  one-to-two-line rule; use identical wording so future drift is visible.
- Add a direct isClaudeAgent assertion in terminal-title-agent-type.test.ts
  pinning that file's parallel copy (previously only covered transitively),
  plus Cursor Agent / "Cursor - action required" activity-facet assertions.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Co-authored-by: nikg24 <228026988+nikg24@users.noreply.github.com>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
stablyai#8445)

* fix(agent-status): label Cursor by identity, not a bare "cursor" token

The worktree card, status bar, and mobile all derive an agent label from the
terminal title via getAgentLabel / resolveTerminalTitleAgentType. Both matched
Cursor with `titleHasAgentName(title, 'cursor')`, a whole-token match. But
`cursor` is ordinary editor vocabulary, so a Claude/Codex tab working on Orca's
own code (title like `⠋ preserve cursor visibility across replays`) got
mislabeled as Cursor. The generic braille-spinner Claude fallback even had a
`!lower.includes('cursor')` guard that then dropped the title to no label at
all.

Gate Cursor on its closed identity title set (`isCursorAgentTitle`) instead —
the same predicate @cursor orchestration routing uses. A real cursor-agent
terminal still resolves as Cursor across working/idle/permission; a non-Cursor
tab that merely mentions a text cursor reverts to its true agent. Relax the
braille guard to the same predicate so those titles land on Claude, not null.

Makes display consistent with routing (the follow-up flagged in stablyai#8436).

* refactor(agent-status): address review on Cursor identity labeling

- Trim the four Cursor `// Why:` comments in both parallel resolvers
  (agent-title-identity.ts, terminal-title-agent-type.ts) to AGENTS.md's
  one-to-two-line rule; use identical wording so future drift is visible.
- Add a direct isClaudeAgent assertion in terminal-title-agent-type.test.ts
  pinning that file's parallel copy (previously only covered transitively),
  plus Cursor Agent / "Cursor - action required" activity-facet assertions.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
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.

2 participants