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.
This commit is contained in:
Gavin Wang
2026-11-03 19:45:28 +08:00
committed by GitHub
parent 1d2edbbf2e
commit 4f3eddc256
5 changed files with 34 additions and 4 deletions
+5 -1
View File
@@ -536,7 +536,11 @@ test("native retention: terminal old handles do not wedge a new user turn", asyn
const final = await a.ask(account, next)
expect(final.status).toBe(200)
next.messages.push(choice(final).message, { role: "user", content: "new turn after terminal owner" })
rebuilt(await a.ask(account, next), "finished-tool")
// every old call has its result, so the new turn gets a native owner of its own
const fresh = await a.ask(account, next)
expect(fresh.status).toBe(200)
expect(choice(fresh).message.content).toContain("rebuilt:finished-tool")
expect(fresh.diagnostic).toMatch(/^same-run;/)
expect(a.runs).toHaveLength(2)
expect(a.results).toHaveLength(1)
})