Commit Graph
3 Commits
Author SHA1 Message Date
yetone d9c858c3c0 cursor 0.2.28: a Run over HTTP/1.1 sends its BidiAppends 16 at a time, as cursor-agent does
Over HTTP/1.1 (where HTTP/2 can't open a Run) each client message goes up
as a BidiAppend. openH1 sent them strictly one at a time, so a new Run's
history (one blob a message, which Cursor asks for all at once) cost a
round trip to api2.cursor.sh per message before the model could start:
hundreds of round trips for a long conversation. cursor-agent 2026.10.01
(startAppendingInputs) keeps up to 16 appends in flight, numbered by
seqno (`m.length>=16&&await Promise.race(m)`).

openH1 now keeps up to atOnce (H1.atOnce, 16) appends on their way, in
seqno order; past that a write waits for one to finish. A native
session's Run passes 1: it counts a write as done only when Cursor
answered that append, so a tool result is never uncertain (the native
HTTP/1 tests hold that, maxInFlight 1). Seen from ysm119's report
(33-36 s to first token on claude-opus-5-5); whether he is on HTTP/1.1 is
not known.

Run: bun test packages/cursor (314 pass, 0 fail) and
bun scripts/check.mjs cursor (ok), on mote.
Broken by hand: with openH1 back to one at a time, the new http1 test is
red (most in flight 1, expected > 1). With runNative not passing 1, five
native-http1 tests are red (maxInFlight 3, uncertain-append and writeWait
cases), so the serial contract is held there; open.test.mjs's serial
openH1 tests now ask for atOnce 1 by name.
Not tried: a real Cursor account over HTTP/1.1; the serial cost was not
measured against Cursor itself, only counted against a fake.
2026-10-28 14:38:50 +08:00
yetone c845b17e9c cursor: http1.test counts a Run when its first message comes, not when its stream is read (#272)
Cause: the fake agent counted runs++ when the server's "stream" event
fired. In the region test the first Run stalls (mode "stall"), the plugin
gives up at H2.wait and goes on over HTTP/1.1, and the test then sets
mode "answer". On a loaded machine the server can read the stalled Run's
HEADERS only after that switch, so the stale stream was taken as a second
Run: ag.runs 2, expected 1. "Runs kept on HTTP/1.1 try HTTP/2 again once
H2.retryAfter has passed" has the same stall-then-answer shape. The plugin
is right; the fake miscounted. A Run now counts once its first message
arrives (the plugin writes it only after the head, so a stream whose
client gave up never brings one), and a stream already destroyed when it
is read isn't answered.

Run on macOS arm64, bun 1.4.2:
- Injected: the fake held the first stream and emitted it the moment the
  test set mode "answer". origin/main's test: red, Expected 1 Received 2,
  the issue's output. With this change: green. The retryAfter test under
  the same injection: red on origin/main, green now.
- Loaded: 8 parallel `bun test --rerun-each 15 packages/cursor/http1.test.mjs`
  at load average ~50: 8 x 240 pass, 0 fail.
- `HOME=$(mktemp -d) bun test` from the root: 1920 pass, 0 fail.
  `bun scripts/check.mjs`: ok.
Test-only, no version bump.
2026-10-21 07:39:22 +08:00
kazecreator 5b67ff41aa cursor 0.2.3: a Run HTTP/2 can't open goes over HTTP/1.1, as RunSSE + BidiAppend on api2 (#59, kazecreator)
Where a proxy or network blocks HTTP/2, a Cursor Run goes over HTTP/1.1 on api2: RunSSE down, a BidiAppend for each client message up. A failure that says HTTP/2 itself can't be had keeps later Runs on HTTP/1.1 for 10 minutes; a refused connection or a reset stream falls back for that Run only. Reviewed at f5c11b7, merged onto 0437abb: cursor 66 pass, whole repo 1026 pass, check.mjs all 15; each guarded piece broken by hand turns http1.test.mjs red.
2026-10-10 09:33:23 +08:00