Skip to content

fix(orchestration): submit Cursor CLI mail pointers instead of leaving them in the composer - #19761

Closed
zleo-ai wants to merge 1 commit into
stablyai:mainfrom
zleo-ai:fix/cursor-orchestration-notify-submit
Closed

zleo-ai wants to merge 1 commit into
stablyai:mainfrom
zleo-ai:fix/cursor-orchestration-notify-submit

Conversation

@zleo-ai

@zleo-ai zleo-ai commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

ELI5

When Cursor CLI is the coordinator, Orca types "you have N orchestration messages" into the input box and then stops. Other agents get a follow-up Enter so they actually run the check. This change sends that same Enter for Cursor, so the nudge is submitted instead of piling up in the composer.

What Changed

  • Idle mailbox pointer delivery no longer special-cases Cursor titles to skip the delayed Enter. Cursor uses the same write-then-\r path as Claude / Codex / Kimi / Grok.
  • Removed the matching skip on the leftover deliverPendingMessages mixin (live run/dispatch mail already goes through mailbox-pointer-stage.ts).
  • Unit tests assert Cursor titles emit \r after the pointer, and that Codex / Claude / Kimi still do too.
  • Updated the orchestration idle-mail E2E Cursor case to expect submit rather than "never Enter".

Why

#3156 skipped Enter for Cursor because older Cursor Agent treated injected PTY text as a user-owned draft. Current cursor-agent (2026.09.08) does not auto-submit that text, so the pointer sits in the composer. A later user Enter then sends the stacked pointer lines plus whatever they typed.

Dispatch inject is a different path (writeTerminalAgentPrompt: bracketed paste, settle delay, separate \r) and already submits. This bug is only the idle mail pointer.

Linked Issue

Fixes #19760

Related: #3034 / #3156 (original skip), #14832 (submit-while-typing, separate), #16822 (disable the pointer, separate).

Visual Proof

N/A — no UI chrome change. Behavior is a PTY write of \r after the existing pointer text. I did not attach a live Cursor terminal recording.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Automated:

  • vitest mailbox-pointer-stage-cursor-submit.test.ts (6), mailbox-pointer-stage.test.ts (5), mailbox-pointer-submit.test.ts (11), plus formatter and eligibility tests — all passed
  • oxfmt on the changed files
  • oxlint and check-changed-code-quality.mjs — 0 findings
  • tsc --noEmit -p config/tsconfig.node.json — passed
  • check-max-lines-ratchet — passed

Not run here (CI should cover):

  • Full pnpm lint / pnpm test / pnpm build (Electron postinstall was still downloading a binary in this environment)
  • Playwright E2E orchestration-idle-mail-delivery.spec.ts (needs a packaged Electron app)
  • Live cursor-agent end-to-end against a running Orca desktop — not done. Reason: this patch is against upstream source, not the installed 1.4.198 app, and standing up pnpm dev plus a real Cursor coordinator was not cost-justified in this run.

Platforms actually exercised: Linux unit tests only. The Enter byte is still \r after the existing 500ms delay on every OS; no platform-specific branch was added.

AI Disclosure

Patch drafted with Grok 4.6 (xAI) in an Orca-dispatched coding session, then reviewed against the current mailbox-pointer-stage / writeTerminalAgentPrompt split.

Review

  • Cross-platform: Pointer submit remains writePty(ptyId, '\r') after enterDelayMs (default 500, overridable in E2E). No new OS check. Windows ConPTY ingest delay lives on the dispatch-inject path, not this pointer path; that is unchanged.
  • SSH / remote / local: Pointer bytes still go through writeOrchestrationPointerPty and the session write gate. No remote wire change.
  • Agents: Cursor now matches Claude/Codex/Kimi/Grok for this pointer. Dispatch inject is untouched. Structured-session pointer delivery is a sibling and was not changed.
  • Performance: One extra \r write on Cursor idle delivery; no new timers beyond the existing delay.
  • UI: No renderer change.
  • Security: Still only writes the existing pointer string plus Enter into a PTY the runtime already owns. No new trust-dialog handling; idle+live-status gating is unchanged.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

#3156 made Cursor skip Enter on purpose. This PR treats that skip as obsolete for coordinator Cursor CLI. If a human-driven Cursor pane still prefers inject-without-submit, that should be an explicit setting (see #16822) rather than a silent title match.

Trust-dialog / agent_prompt_stalled on first Claude/Kimi launch is a different inject path and is not addressed here.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Local: targeted oxlint + node typecheck + focused vitest. Full lint/test/build left to CI.

…gents

Cursor titles used to skip the delayed Enter after the idle mail pointer
(stablyai#3156). Current cursor-agent leaves that text in the composer, so the
nudge never runs. Use the same paste-then-Enter path for Cursor.

Fixes stablyai#19760
@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

The change removes Cursor-specific orchestration-target detection and the branches that skipped synthesized Enter submission. Accepted mailbox pointer writes now use the delayed Enter flow for all supported agent terminals. New unit tests cover multiple agent titles and tab-title detection. The end-to-end test now expects the Cursor pointer to be submitted.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🔵 Low · up to 14cd0

Cursor pointers now use the shared delayed Enter submission path, but the new title-based unit coverage does not validate title-dependent target selection. A regression that prevents Cursor from reaching staging could therefore remain undetected.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files. 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 describes the primary change: submitting Cursor CLI orchestration mail pointers instead of leaving them in the composer.
Description check ✅ Passed The description covers the required sections, explains the cause and solution, links issue #19760, documents testing and limitations, and addresses cross-platform, SSH, security, and performance consi…
Linked Issues check ✅ Passed The changes satisfy issue #19760 by removing the Cursor-specific Enter suppression from both relevant pointer-delivery paths, adding focused unit coverage, and updating the E2E expectation. Dispatch i…
Out of Scope Changes check ✅ Passed The code, test, and comment changes directly support the linked issue and stated objectives. No unrelated implementation or behavior changes are present.
  • Fix all pre-merge checks with AI

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: Advanced

Run ID: d3da08d3-2738-411d-8c14-489da4c27b9b

📥 Commits

Reviewing files that changed from the base of the PR and between 7dd183d and 14cd049.

📒 Files selected for processing (6)
  • src/main/runtime/orca-runtime-core.ts
  • src/main/runtime/orca-runtime-deliver-pending-messages.ts
  • src/main/runtime/orchestration/mailbox-pointer-stage-cursor-submit.test.ts
  • src/main/runtime/orchestration/mailbox-pointer-stage.ts
  • tests/e2e/helpers/orchestration-mail-pane-agent.ts
  • tests/e2e/orchestration-idle-mail-delivery.spec.ts
💤 Files with no reviewable changes (2)
  • src/main/runtime/orca-runtime-core.ts
  • src/main/runtime/orchestration/mailbox-pointer-stage.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment on lines +46 to +50
resolveSubmitTarget: () => ({
leaf,
terminalHandle: 'term-1',
processIncarnation: 'inc-1'
}),

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Test the title-dependent target resolution.

resolveSubmitTarget always returns a target. It does not inspect lastOscTitle or getTabTitle. Every title case therefore tests the same staging path.

Use the real title-resolution path, or make the test mock validate and branch on the supplied leaf and tab title. A regression that rejects Cursor before staging would still pass this test.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Cursor idle-mail pointer submit — finishPointerWriteAndStageEnter drops its isCursorAgentTitle short-circuit, so Cursor titles now reach the shared submitEnter path (submitOrchestrationMailboxPointer): pointer write, then a delayed separate \r, same as Claude/Codex/Kimi/Grok.
  • Dead-helper removal — isCursorAgentOrchestrationTarget and its isCursorAgentTitle import are removed from orca-runtime-core.ts, along with the matching skip in the orphaned deliverPendingMessages mixin. No stale references remain.
  • Coverage — new mailbox-pointer-stage-cursor-submit.test.ts asserts the pointer payload is \r-free and a trailing \r write lands for Cursor titles (osc-title and tab-title paths); the E2E Cursor case flips to expectSubmitted.

The change is minimal and correct. The removed Cursor branch was the last user-owned submit path, and the submit path's live-idle gate (lastAgentStatusObservedLive / queueSafe / deferFlightUntilIdle) still applies to Cursor since a Cursor title classifies as idle, so the pointer only submits at an idle prompt like every other agent. The unit test can genuinely fail (it polls for the \r write), and the two title-detection paths are both asserted.

The one unverified assumption is empirical and documented: current cursor-agent no longer auto-submits injected PTY text, which is the rationale for inverting #3156. No live cursor-agent E2E was run (the author notes this), so that claim is exercised only by the updated Playwright fixture + CI, not against a real Cursor coordinator.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker

Copy link
Copy Markdown
Contributor

Thanks! Your change landed via #33347 (your commit kept, plus Co-authored-by on the squash), rebased onto current main with the now-dead tab-title dependency removed; verified with a real cursor-agent that the pointer + delayed Enter submits. Closing as superseded.

nwparker added a commit that referenced this pull request Oct 25, 2026
…ving them in the composer (#33347)

Orchestration mailbox pointers now get their delayed Enter for Cursor too (the Cursor no-Enter skip from #3156 left mail delivered but never acted on). Verified with real cursor-agent. Fixes #19760. Supersedes #19761.

Co-authored-by: Maple <[email protected]>
@nwparker nwparker closed this Oct 25, 2026
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.

[Bug]: Cursor CLI orchestration mail pointer is typed but never submitted

2 participants