Skip to content

fix(agent-hooks): restore Cursor status updates in reused panes - #12714

Closed
ckdwns9121 wants to merge 1 commit into
stablyai:mainfrom
ckdwns9121:fix/cursor-retired-pane-status
Closed

ckdwns9121 wants to merge 1 commit into
stablyai:mainfrom
ckdwns9121:fix/cursor-retired-pane-status

Conversation

@ckdwns9121

Copy link
Copy Markdown
Contributor

Summary

  • Restore Cursor status updates when a completed command leaves its terminal pane reusable.
  • Treat Cursor's live beforeSubmitPrompt hook as the new-turn boundary, matching the existing Claude UserPromptSubmit behavior.
  • Keep replayed hooks, closed tabs, and retired launch tokens unable to restore pane authority.

Fixes #12686

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test — 46,319 passed; 25 unrelated existing/environment-sensitive tests failed across terminal snapshot/IME, zsh path, Git environment, process timing, and a renderer timeout
  • pnpm build
  • Added local and remote Cursor regression tests covering live restart, replay suppression, completed status, and retired-token rejection
  • pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server.test.ts — 269 passed

AI Review Report

Reviewed the status-authority transition for local and SSH/remote hook ingestion. The main risk was reopening a retired pane from stale traffic, so the change remains limited to non-replayed provider prompt boundaries and preserves the existing closed-tab fence. Regression tests verify both local Cursor hooks without launch authority and remote hooks with replay and retired-token checks.

Cross-platform compatibility was checked for macOS, Linux, and Windows. This change does not touch shortcuts, labels, paths, shell behavior, UI, or Electron platform branches; it only recognizes an already-normalized Cursor hook event in shared main-process status handling.

Security Audit

Reviewed hook authentication and authority handling. The restart path continues to strip the retired launch token before recording authority, does not weaken the HTTP hook token requirement, rejects replayed events, and does not add command execution, path handling, IPC, secrets, or dependency changes.

Notes

  • The production build succeeded. Its existing optional /usr/local/bin/orca-dev symlink step reported a permission warning but did not fail the build.
  • Manual Windows Cursor session restoration was not run locally; local and remote ingestion paths are covered by unit tests.
  • X (Twitter): not provided

Cursor uses beforeSubmitPrompt rather than Claude UserPromptSubmit as its live turn boundary. Treat that event as the narrow restart signal for reusable retired panes while preserving replay, closed-tab, and retired-token fences.

Constraint: Replay events, closed tabs, and retired launch tokens must remain unable to restore authority.

Rejected: Reopen on Cursor sessionStart | It is not an exact user prompt boundary and could admit stale restored traffic.

Confidence: high

Scope-risk: narrow

Reversibility: clean

Directive: Keep reusable-pane restart events limited to live provider prompt boundaries.

Tested: Agent hook server tests (269 passed); pnpm lint; pnpm typecheck; pnpm build.

Not-tested: Full suite clean; 25 unrelated environment or pre-existing failures remained among 46,425 tests.

Related: #12686

Co-authored-by: OmX <[email protected]>
@nwparker

Copy link
Copy Markdown
Contributor

Thanks for the PR! Main covers this through #15344 (d1127b9). The retired-pane path in server-status-disposition.ts now calls a per-provider isNewTurnEvent instead of a hardcoded UserPromptSubmit check, and for cursor that returns true on beforeSubmitPrompt and sessionStart. Closing — please reopen if there's a remaining case main doesn't cover.

@nwparker nwparker closed this Oct 27, 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]: Some Cursor panes remain Working despite completed stop hooks

2 participants