main
15
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
463bbfe2b6 |
cursor 0.2.46: a quiet Run's error says the stream timed out, so Pi retries it (#1075)
Cursor's quiet watchdog (idle and heartbeat-only) now ends its error with "; stream timed out (try again)", so Pi, which classifies a streamed error by its words once the 502 is lost behind a 200, retries the turn within its own budget. The status, limits and failure stay as they were. 0.2.46. Reviewed at 507b2fd0. Checked Pi's own retry list (earendil-works/pi packages/ai/src/utils/retry.ts on main has "timed? out"; "(try again)" alone matches nothing there). magpie's gateway decides on the 502 status (busyStatus), so its own handling is unchanged. Run (WSL, Bun 1.4.2): packages/cursor bun test 421 pass, 0 fail; bun scripts/check.mjs cursor ok. Not run: scripts/cursor-pi-retry.integration.mjs (needs an installed Pi SDK, loopback only); a real Cursor stall (#550). Co-authored-by: wuuli <wuuli@users.noreply.github.com> |
||
|
|
2479b36f23 |
cursor 0.2.45: a test switch lets Cursor search the web and saves that trace (#635)
A new plugin option, "Cursor web search (test)" (web_search_test, off by
default), sits next to Wire trace. On, a Run adds web_search_tool_call
(ToolCall field 18) to x-cursor-agent-allowed-tools and answers Cursor's
search query with an approval, as cursor-agent does when it auto-approves.
Every other tool of Cursor's own is refused as before. A Run in which
Cursor asked to search saves its WireTrace to cursor-traces whether it
succeeded or failed; a Run that never searched saves nothing unless Wire
trace is on and it failed. The trace is WireTrace as it is (kinds, field
numbers, sizes, times) plus one "web search" event; no search term or
result is written.
Protocol, from cursor-agent 2026.11.05-86047df's agent.v1 descriptors (the
plugin ships no .proto):
- AgentServerMessage 7 interaction_query: InteractionQuery {1 id uint32,
oneof query: 2 web_search_request_query (WebSearchRequestQuery {1 args:
WebSearchArgs {1 search_term, 2 tool_call_id}}), 9 web_fetch, ...}
- AgentClientMessage 6 interaction_response: InteractionResponse {1 id,
oneof result: 2 web_search_request_response (WebSearchRequestResponse
{1 approved {} | 2 rejected {1 reason}})}
- cursor-agent's x1.webSearchApproved builds exactly that approval; with
no args it rejects "Missing web search arguments", and so does this.
Before: native failed the Run on any interaction query ("unsupported native
interaction query", 502); stateless left it unanswered. Both stay so with
the switch off, and for every query but a web search with it on.
Run on mote, HOME a fresh mktemp -d:
- bun test packages/cursor: 421 pass, 0 fail
- bun scripts/check.mjs: ok
- the new off tests against origin/main 907847b's index.mjs and
native-session.mjs: pass (the off behaviour is the old one); the on
tests there: red, as they should be
The full root suite was not run (other reviews were using mote and mica).
Broken by hand, each red (11 tests named plugins#635):
- approval sent as a rejection: 5 red
- native answer not gated on the switch: off test red
- header always adds web_search_tool_call: both off tests red
- header adds shell_tool_call too: 6 red
- stateless never sends the answer: 2 red
- a successful Run without a search saved: 2 red
- a successful Run that searched not saved (ended() a no-op): 2 red
- frame bytes written into the trace: 4 red (secret found)
- any interaction query taken as a search: 3 red
Not tried: Cursor's real servers (fakes only, no real account). Whether
Cursor sends tool_call_started (update 2) for its own search, which would
keep StepCalls from counting it as completed by Cursor, is unknown; the
real trace this switch records is for that. With the switch on, every Run
holds a trace in memory until it ends, as with Wire trace on.
|
||
|
|
1eb9473f5b |
cursor 0.2.43: read per-step ModelCallCompletedUpdate usage (#796)
Asks AgentService/Run for emit_model_call_usage (AgentRunRequest field 37) and reads InteractionUpdate 31 (ModelCallCompletedUpdate: model_call_id, then input, output, cache read, cache write and reasoning tokens). These field numbers are checked against cursor-agent 2026.11.05-86047df's bundle. A multi-step native turn's final step reports that call's exact counts. The rest of TurnEnded's totals goes to usage.magpie_deferred, or the earlier calls' #31 sum when TurnEnded has no counts. A stateless step with a #31 before it seals takes that count and doesn't poll the dashboard. Without #31, both paths are as before. Reviewed at d2c49f3b on mote (mote-run, HOME=$(mktemp -d)): - bun scripts/check.mjs cursor: ok. - bun test packages/cursor: 406 pass, 0 fail. native-e2e alone 3 times: 145 pass each. - Probes: TurnEnded with no counts and a #31 per step, and only the final step's #31. Both give own 61000/700 and deferred 105000/1400, which add up to the turn. - Broken by hand, red each time: no field 37; native ignoring #31; #31 read unshifted; stateless ignoring #31; stateless still polling after #31. - Not red: dropping the lastStepUsage reset in nextStep. That test gap is filed as a follow-up. Not tried: a real Cursor account (whether api2 sends #31, and in what order). |
||
|
|
f2dc68c17e |
cursor 0.2.41: new input past a parent awaiting results gets a retained Run that takes no reservation (#706)
cursor 0.2.41 (ooboqoo): new input past a parent that is awaiting results gets a retained Run that takes no reservation, so those turns stop falling back to "owner busy" and then "historical native calls" rebuilds. When a later Run of the conversation starts, a parent waiting on results owes its step at once, bounded before that start, and the later Run collects it. The collection waits until owedAt, because Cursor adds a step to a Run's one event as the step ends. If the parent's own results resume it, an uncollected count is withdrawn, and a collected one comes off its final, so the event is billed once.
Reviewed at 74a1d8b23 merged onto main
|
||
|
|
4f3eddc256 |
cursor 0.2.40: a new user turn whose old native calls are all answered gets a retained Run (#672)
A new user turn whose earlier native calls (call_cursor_…) all have tool results now gets a retained Run of its own, with those calls imported as history the way the stateless path imports them. Any call still pending, a request ending in tool results with no live owner, or a tool attachment last still falls back as before; the owner-busy check is unchanged. Nothing is submitted to an old exec: a user message last has no trailing handles. By ooboqoo (#672). Run at the reviewed head 5b4dcf1 on mote: - packages/cursor `bun test`: 394 pass, 0 fail - `bun scripts/check.mjs`: ok Broken by hand: with origin/main's native-session.mjs and the PR's tests, "terminal old handles do not wedge a new user turn" and the new admission test both fail (2 fail, 168 pass in those two files). Not tried: a real Cursor account (the author reports ~270 requests over a day, all 200 or client-cancelled 499); Cursor dashboard usage or caching. |
||
|
|
3f615ea9ef |
cursor 0.2.37: a step with under 10 minutes of a retained Run's lifetime left starts fresh, and a deadline cut says to retry (#616)
yetone/magpie#4419 (Okxdd123; ggbdpq traced the cause and wrote the repro): a Pi turn on cursor/grok-4.7@500k kept one native Run across 12 tool steps. The 13th went on in that Run with 494 s of its 15-minute lifetime left, the answer was still streaming at the deadline, and the Run failed mid-answer with "native Run lifetime expired". The 200 was long sent, so the agent read only those words, and Pi doesn't retry on any of them, so the turn ended although asking again goes on. - native-session.mjs: a retained Run takes a tool batch's results only with more than continueReserve (10 minutes, new in NATIVE_LIMITS; at most two thirds of the lifetime) left. With less, the owner is retired and the step goes on a fresh Run from the supplied history, as #157 did for the last minute. 60 s didn't cover a long answer. - The deadline's error now says "native Run lifetime expired: the Run timed out; retry your request" (LIFETIME_EXPIRED). "timed out" is in Pi's _isRetryableError list and in magpie's passingSaid; "retry your request" is in passingSaid, so magpie's gateway adds nothing more. For Claude Code and Codex, magpie translates the error as api_error / server_error, as before. - README: the 10-minute reserve and the wording. Tests (native-e2e.test.mjs), no network and no real waiting: Date.now moved so a continuation has 494 s (the reporter's case) or 599 s left -> rebuilt on a fresh Run, no result written to the old one; 660 s left -> same Run. A retained continuation streams half an answer, the deadline is brought in with expireIn(0), and the SSE's one error starts "native Run lifetime expired" and matches Pi's retry regex and magpie's passingSaid (both copied into the test). Broken by hand: the old reserve (min(60 s, lifetime/10)) turns the 494 s and 599 s cases red; the old wording turns the mid-answer case red (3 fail, 135 pass in native-e2e). Run (mote, HOME=$(mktemp -d), as CI): bun test at the repo root, 4716 pass, 0 fail; bun scripts/check.mjs, exit 0. packages/cursor alone: 384 pass, 0 fail. Not tried: a real Cursor account reaching the 15-minute deadline; a real Pi, Claude Code or Codex reading the new wording (Pi's regex is the one in pi-coding-agent's agent-session.js as installed locally, not necessarily Pi 1.4.0's). |
||
|
|
1a5b184991 |
cursor 0.2.34: the quiet error names its checkpoint; an opt-in Wire trace saves a failed Run's frames (#550)
Windsland52 (#550, 0.2.33, cursor/grok-4.6 at xhigh): four Runs ended
"Cursor went quiet: 24 heartbeats and nothing else for 240 s, its last
message checkpoint". They asked for the checkpoint to be named, and for a
way to see what Cursor sends after it. No change to quiet's budget or to
retry, as asked.
The quiet error now says, for a checkpoint: its number in the Run, which
of its step's checkpoints it was (native path; the stateless path doesn't
count steps), how many came in a row, and the kinds before it, e.g.
"its last message checkpoint #1 of the Run, the first of step 1, after
blob request x2, thinking". Other kinds read as before.
Wire trace is a new plugin option (wire_trace), off by default. With it
on, a Run that fails (not one the caller cancels), native or stateless,
writes <magpie's folder>/cursor-traces/<start>-<rand>.json (temp and
rename, mode 600, newest 20 kept). It holds both directions' frames as
time, size, kind, top-level field numbers with wire type and size, and
the field numbers and sizes one level inside: the shape, never the bytes.
No text, thinking, tool name or argument, blob or blob id, checkpoint
content, token, header, account or conversation id is read into it. The
error message is scrubbed of email-, uuid-, auth-id- and token-shaped
strings. It also has quiet's counters, the model id and plugin version.
The first 2000 and last 3000 frames are kept, the rest counted. The
folder comes from input.directory, which magpie sets to its config
folder. The option exists only in magpie, so OpenCode's project folder is
never written to.
Run on mote at this tree (
|
||
|
|
c9a0215f31 |
cursor: a continued Run that goes quiet after the caller's results ends (#364)
Test only. #364's tests covered the pause at a sealed batch but not the
resume after the submit: with resume() leaving the Run paused, every
test passed and a retained Run that went quiet on its second model call
would wait for lifetime again. This one is red with that break (times
out at 5 s) and green at
|
||
|
|
cf1873e292 |
cursor 0.2.21: a Run Cursor stops answering ends, retained or stateless (yetone/magpie#2672) (#364)
A Run Cursor stops answering mid-turn now ends with a 502 that says so,
on both the stateless path (runOnce/decode) and the retained path
(NativeSession.pump), instead of holding the reply open until the agent
gives up (yetone/magpie#2672: two composer-2.5 turns waited 305 s).
Quiet wraps a Run's frames: 60 s with no message at all, or 240 s with
only Cursor's heartbeats (InteractionUpdate.heartbeat), ends it. Only
time spent waiting on Cursor's next frame counts; a retained Run parked
for the caller's tool results is paused (resultWait bounds it) and
resumes from nothing after the submit. Each frame gets a fresh wake
promise, so frames already passed on are not held for the stream's life
(review of cbd5d3b). cursor 0.2.20 -> 0.2.21.
Run at the reviewed head 6a17d61 (base 79e383c; main
|
||
|
|
0a2496bb3a |
cursor 0.2.19: conflicting native batch counts rebuild once from history before any output (#207, nicegui)
A Cursor native Run whose step lists two different tool counts (a Codex-to-Cursor failover hit "inconsistent native tool count") now retires the owner instead of throwing. When no native result was submitted to that Run and no Chat output was exposed, the request is rebuilt once from Chat history (the same stateless rebuild the missing-count case uses), with reason=inconsistent-batch-count in X-Magpie-Cursor-Continuity. A Run that had a result submitted, or a stream that already sent output, still returns the error. The decoder stops reading the failed Run at once. Cursor 0.2.19. Reviewed at c43b93c (on main |
||
|
|
0b821908bc |
cursor: a tool-result continuation in a Run's last minute rebuilds before writing results, not 502 at the lifetime (#157, nicegui)
The 15-minute absolute lifetime spans all of a retained Run's tool
roundtrips. A tool-result continuation that arrives with no more than
min(60s, lifetime/10) left now retires the owner (410 "retired before
lifetime deadline") and rebuilds from the supplied history before writing
any result, instead of resuming and failing mid-segment with "native Run
lifetime expired". Replays of an already submitted batch keep their path.
Merging main resolved a conflict with
|
||
|
|
a7614aa2ff |
cursor: the lifetime-expiry test brings a Run's lifetime in after its first answer, not before it starts (#143)
The native retention test set NATIVE_LIMITS.lifetime = 65 before the
first ask. The lifetime counts from the Run's start, so on a loaded
machine the first Run expired before it answered: 410 where the test
wants 200. NativeSession now sets its deadline through expireIn(ms), the
constructor giving it the whole lifetime as before, and the lifetime case
calls owner.expireIn(65) after the first answer. The resultWait case
still sets its limit up front, since that wait counts from the answer.
The plugin's behaviour is unchanged, so there is no version bump.
Run:
- Injected: on the old test, a lifetime of 0–10 ms is red ("Expected: 200
Received: 410"); 15 ms and up is green. The new test is green.
- HOME=$(mktemp -d) bun test, whole repo: 10 runs in a row, 0 fail
each. On current main
|
||
|
|
c7c6498d85 |
cursor: a multi-step turn's last step reports its own share of usage, and a step's calls get batchWait from the latest one (#156 erzay, #155 midmirror)
#156: a native Run of N tool steps ended with TurnEndedUpdate's totals as the final step's prompt_tokens (1,105,934 on erzay's ~21-step turn, where the real context was ~61K), and Codex compacted at once. The final step now keeps its last model call's share, max(that call's chars/4 prompt estimate, turn total / model calls), split proportionally across input, cache read and cache write; the rest goes into usage.magpie_deferred (merged with any settled stateless debt), so magpie still bills the whole turn. On erzay's numbers that is ~52.7K reported, ~1.05M deferred. #155: waitForBatch armed once, at a step's first call, so a step whose calls arrive one by one as the model writes them (13 calls, 9 long-arg) failed 502 "did not complete its declared native tool batch" ~30s after the first call even though it never paused that long. The deadline now restarts on every call, answered call, count and text/reasoning frame. Run at this commit: packages/cursor `bun test` (isolated HOME) 266 pass, 0 fail, three times; `bun scripts/check.mjs` ok. The three new tests fail on 4e64f26's source (prompt 1105934; sealed step failed at 300ms; stall failed 303ms after the first call instead of after the latest). |
||
|
|
1bf9113390 |
cursor: calls the bridge answers itself count toward Cursor's tool count, and KV replies wait for a slow link instead of failing the Run (#142, Evopower)
Cursor's tool_requests_listed (InteractionUpdate 27) counts every call of
the model's step, and is sent after them. That count includes calls the
plugin answers itself: a tool the request doesn't have (0.2.14's native
path refuses those) and Cursor's get_mcp_tools (exec 36). 0.2.14 counted
only the calls it accepted. A step with a refused call then either waited
30s for a call that never came (502 "did not complete its declared native
tool batch") or met the next step's count with the stale one (502
"inconsistent native tool count", the reporter's error). The stateless
decoder had the same miscount and hung. Both paths now count answered
calls toward the step and end a step whose calls were all answered without
one.
503 "native outbound messages limit reached": a long history goes out as
one blob per message, and Cursor asks for every blob at once. The native
transport caps its pending writes at 256 messages / 16 MiB and failed the
Run when a slow link backed them up past that. KV replies now wait for
room (NATIVE_LIMITS.writeWait, 30s) and fail only if the link doesn't
drain for that long. The stateless path writes directly and has no cap.
The fixtures are real Cursor frames captured on 2026-10-15 (model auto,
cursor-agent's agent.v1): get_mcp_tools plus a refused WebSearch in one
step followed by read_file, which gave 0.2.14 the reporter's exact
"inconsistent native tool count"; and read_file, refused WebSearch,
read_file under a count of 3, which gave 0.2.14 the batch timeout.
Run at this commit (on origin/main
|
||
|
|
33cdf7c1a8 |
cursor: Run tool calls stay on one native Cursor session and resume stateless after a long tool, not a failed turn (#135, nicegui)
Cursor's Run (native) calls stay on one Cursor session across a tool result. With them, a tool that runs longer than Cursor's limit resumes stateless, not as a failed turn. The session pool lives in native-session.mjs. It applies to a conversation's first user turn, and a new user turn goes stateless (see the README). X-Magpie-Cursor-Continuity says which path a request took.
The dashboard-usage ledger counts two distinct events in one response that share a millisecond, as main did. Only timestamps claimed by earlier fetches are left out. A new deferred-usage test covers it.
Run at the reviewed head 398aeddc0186cfc38189b1f05577b181aa2d587d (merge base 5d5d86e; main has no packages/cursor change since):
- packages/cursor `bun test` 3 times: 258 pass, 0 fail each time.
- `bun test latency` 12 times with fresh HOMEs: 12/12 pass.
- Broken by hand: putting back `if (claimed.has(key + "\0" + ev.timestamp) || at >= before()) continue` makes the new test "distinct same-millisecond events in one response are billed together, not again on later fetches" fail (2 pass, 1 fail). The head's line passes.
- `bun scripts/check.mjs`: all packages pass.
- `npm pack`, extracted into a fresh dir: index.mjs, native-session.mjs, package.json, README.md. `import("./index.mjs")` exports CursorAuthPlugin and _internal, and native-session.mjs imports.
- CI: test and on-npm green.
Not tried: a real Cursor account. The owner's stored plugin sign-in has no access token. The author reports a real Claude Code run through an isolated gateway: a child resumed stateless after a 125s tool, and all 6 requests returned 200.
|