Skip to content

fix(pi-cursor-agent): stabilize steering and forked subagents - #29

Open
akmarwah03 wants to merge 5 commits into
sudosubin:mainfrom
akmarwah03:fix/cursor-agent-steering
Open

akmarwah03 wants to merge 5 commits into
sudosubin:mainfrom
akmarwah03:fix/cursor-agent-steering

Conversation

@akmarwah03

@akmarwah03 akmarwah03 commented Jul 27, 2026 •

Copy link
Copy Markdown

Summary

  • forward Pi steering and extension-triggered user messages into an active Cursor run through conversationAction
  • replay unacknowledged actions with stable message IDs across transport retries and clean stream closures without blocking on a closed writer
  • preserve complete trailing user/custom context when a fresh Cursor connection is required
  • surface Cursor run failures through the live event channel and classify cancellation separately from provider errors
  • isolate forked subagents from inherited Cursor conversations while preserving resumes, nested launches, and ordinary forks

Test plan

  • npm test (51 tests)
  • Biome checks on all changed files
  • live RPC steering tests with Grok 4.5 High
  • live subagent test with exactly two scouts and one worker; all returned non-empty results and the parent emitted LOCAL_WORKER_TEST_PASSED
  • verified the forked worker received a distinct Cursor agent ID
  • npm run typecheck — blocked by the existing session_switch peer-API mismatch in src/index.ts

Closes #18
Closes #27

Supersedes #28.

Send queued Pi user input through Cursor's conversation-action stream and
replay unacknowledged actions across transport and stream restarts.
Forward Cursor run failures through the live event channel and distinguish
request cancellation from provider errors instead of reporting both as a
successful completion.
The cursor agent always couples a write call with a prequel read call.
Map ENOENT / no-such-file read failures to ReadFileNotFound so the API
still attempts the write for new files, instead of failing with a
generic error and forcing models to fall back to shell commands.

Adapted from sudosubin#17; test fixture extended with
toolName/timestamp to satisfy the local ToolResultMessage type.
Prevent conversation-action writes from blocking when Cursor closes a run,
and isolate forked subagents from inherited provider state.
@akmarwah03 akmarwah03 changed the title fix(pi-cursor-agent): forward steering into live sessions fix(pi-cursor-agent): stabilize steering and forked subagents Jul 30, 2026
Keep caller-provided system instructions when extracting Pi context and
mirror them into an always-applied Cursor rule so provider prompts cannot
silence delegated agent contracts.
@molysgaard

Copy link
Copy Markdown

Hi, any interest in reviewing this? I am constantly hitting issues with steering, and that the model does not understand when it reads/writes a file that does not exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants