Skip to content

fix(pi): accept Cursor AgentRunRequest managed receipts - #881

Closed
Zireael wants to merge 1 commit into
cortexkit:masterfrom
Zireael:fix/issue-880-cursor-agent-receipt
Closed

Zireael wants to merge 1 commit into
cortexkit:masterfrom
Zireael:fix/issue-880-cursor-agent-receipt

Conversation

@Zireael

@Zireael Zireael commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Part of #880

Summary

OMP's Cursor provider sends an AgentRunRequest whose history is content-addressed in conversationState.rootPromptMessagesJson. The managed-dispatch verifier only inspected messages, input, or Google contents, so every Cursor turn failed with missing current receipt signature.

This adds a Cursor adapter that:

  • hashes the prepared managed m[0]/m[1] messages into a receipt and matches those hashes against Cursor's root blob IDs;
  • derives retry identity from the root blob IDs plus the active user text, excluding Cursor's random messageId;
  • skips Cursor's structural row comparison with an explicit diagnostic until its root serializer is modeled. The managed receipt and conversation-identity checks remain enforced.

What this does not change

The separate refusal-path behavior (calling ctx.abort() while OMP still sends the original payload) is not changed here. #880 should keep tracking that issue independently.

Validation

  • bun test packages/pi-plugin/src/issue-880-cursor-receipt.test.ts packages/pi-plugin/src/issue-880-provider-fence.test.ts packages/pi-plugin/src/pi-dispatch-identity.test.ts packages/pi-plugin/src/issue-683-provider-fence.test.ts — 50 passed.
  • bun run --cwd packages/pi-plugin typecheck — passed.
  • bunx biome check --write ... on the four touched files — passed.
  • Verified the source receipt hashes against a real OMP 18.18.0 buildGrpcRequest Cursor payload; both managed m0/m1 hashes matched the emitted root blob IDs.
  • No live Cursor account request was run from this source branch.

Harness coverage (required)

  • OpenCode 1: not applicable — this is the Pi/OMP extension and the Cursor AgentRunRequest surface does not exist there.
  • OpenCode 2: not applicable — same reason.
  • Pi: not applicable — Pi does not emit Cursor AgentRunRequest; existing standard message paths are covered by the identity and provider-fence tests.
  • OMP: covered — Cursor receipt, identity, structure-skip, admitted-dispatch, and missing-receipt refusal tests.
  • Rust module: not applicable — no Rust surface is involved.

Opened as draft because #880 does not yet carry design-approved.


Summary by cubic

Makes Pi accept Cursor's AgentRunRequest in OMP, fixing the managed-dispatch verifier that previously rejected every Cursor turn because it only inspected messages, input, or Google contents.

  • Hashes the prepared managed m0/m1 messages and matches them against the root blob IDs in conversationState.rootPromptMessagesJson, rejecting payloads missing the receipt.
  • Derives retry identity from the root blob IDs plus active user text, excluding Cursor's random messageId so retries don't appear as new turns.
  • Skips Cursor's structural row comparison with an explicit diagnostic until its root serializer is modeled; the receipt and conversation-identity checks stay enforced.

The separate refusal-path behavior (calling ctx.abort() while OMP still sends the original payload) is unchanged and remains tracked in #880.

Written for commit ee2affd. Summary will update on new commits.

View guided diff

Resolve managed-dispatch signatures for OMP's Cursor wire shape by
matching content-addressed m0/m1 root blob receipts, and derive retry
identity from Cursor's root blob IDs plus the active user message.

Skip Cursor's structural row comparison with an explicit diagnostic
until its root serializer is modeled; the receipt and identity checks
remain enforced.

Refs cortexkit#880

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <[email protected]>
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

Waiting for design-approved on #880.

This PR needs a linked issue with the design-approved label before it can be reviewed or merged. Link the approved issue with Approved issue: #<issue> (or Refs #<issue>) in the description. A maintainer will apply the design-approved label on the issue, or trivial on the pull request when there is genuinely no design to agree. The issue stays open until the change ships; maintainers take care of it then.

@magic-alfonso

magic-alfonso Bot commented Nov 8, 2026

Copy link
Copy Markdown

Thank you for this, and for checking it against Oh My Pi 18.18.0. We're closing it because 0.49.43, released today, covers the same problem in a broader fix (#880).

The Cursor part landed with a different approach: the dispatch check now matches Magic Context's managed messages against Oh My Pi's own root hashes in rootPromptMessagesJson, verified against the real Cursor request builder on 18.13.2, 18.18.0 and 18.18.1. Your PR was the cross-check we used for the 18.18 rules entry. The release also fixes the larger issue from your report: a refused turn on Pi and Oh My Pi still reached the provider.

You're credited in the 0.49.43 release notes. If a Cursor turn is still refused on 0.49.43, the refusal now names the provider and request shape, so please open an issue with that line.

@magic-alfonso magic-alfonso Bot closed this Nov 8, 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.

1 participant