Skip to content

Commit b15a179

Browse files
committed
devlog(260828): fold A-gate round-1 blockers into roadmap (13 findings)
1 parent 54398b5 commit b15a179

4 files changed

Lines changed: 69 additions & 23 deletions

File tree

‎devlog/_plan/260828_cursor_ndjson_backlog_train/001_backlog_abort_rca.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ aborted". Long turn (~12 min "Worked for 12m 21s"), many gh/git tool rounds.
99

1010
Producer/consumer chain: runTurnAdapter.runTurn(..., queue.push) ->
1111
queue.stream() -> preflight (core.ts:4696-4709) -> empty-completion
12-
guard/observer (core.ts:4711-4727) -> bridgeToResponsesSSE (bridge.ts:857-876,
13-
demand-driven, HWM 1, pauses stepping at bridge.ts:1404-1410) ->
14-
trackStreamLifetime (lifecycle.ts:439-449) -> request-log wrapper
15-
(relay.ts:620-638) -> CORS Response -> Bun HTTP.
12+
guard/observer (core.ts:4711-4727) -> bridgeToResponsesSSE (bridge.ts:857-876;
13+
HWM=1 documented at bridge.ts:1404-1410, demand-driven stepping happens in
14+
pull() at bridge.ts:1465-1467) -> trackStreamLifetime (lifecycle.ts:439-449)
15+
-> request-log wrapper (relay.ts:620-638) -> CORS Response -> Bun HTTP.
16+
(Anchors re-verified by A-gate round 1; bridge stepping anchor corrected.)
1617

1718
- guardTerminalEventStream is NOT on the runTurn path (only generic
1819
fetch/parse path, core.ts:5648-5676).

‎devlog/_plan/260828_cursor_ndjson_backlog_train/010_backlog_abort_fix.md‎

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,20 @@ Branch: codex/runturn-backlog-coalesce (from origin/dev). One PR.
88

99
In createAdapterEventQueue push(): when no reader is waiting and the queue
1010
tail exists:
11-
- tail.type === "text_delta" && event.type === "text_delta" && same phase ->
12-
replace tail with { type:"text_delta", text: tail.text + event.text,
13-
phase: tail.phase } (do NOT mutate the original object; queued events may
14-
be shared).
11+
- tail.type === "text_delta" && event.type === "text_delta" && identical
12+
phase field (both undefined, or === — an omitted phase is a continuation
13+
downstream (bridge.ts:922-925) but merge only on strict equality to stay
14+
provably safe) -> REPLACE tail with a new object
15+
{ type:"text_delta", text: tail.text + event.text, phase: tail.phase }.
16+
Never mutate pushed objects: push() has no ownership/copy contract
17+
(run-turn-queue.ts:7-11) and adapters may retain/re-emit event objects —
18+
interface-level alias safety, so replacement only (A-gate blocker 6).
19+
- Byte bound (A-gate blocker 5): merge only while tail.text.length <= 64KB;
20+
past that, append as a new item so a single merged item cannot grow
21+
unbounded and re-copy on every push. The backlog cap then bounds total
22+
memory at ~64KB * 1024.
1523
- tail.type === "thinking_delta" && event.type === "thinking_delta" ->
16-
merge thinking strings likewise.
24+
merge thinking strings likewise (same replacement + byte-bound rules).
1725
- event.type === "heartbeat" && tail.type === "heartbeat" -> drop event
1826
(one pending heartbeat is enough).
1927
- All other types append as today. Never merge across a non-delta boundary;
@@ -31,15 +39,27 @@ turn aborted" and the pushed error gains status/retryable hints untouched
3139

3240
### 3. Tests — MODIFY tests/run-turn-queue.test.ts
3341

34-
- NEW: 5000 alternating-text deltas with no reader -> backlog stays 1 merged
35-
text item (+ terminal), no overflow, collect() returns concatenated text.
42+
- NEW: 5000 ADJACENT text_delta chunks (same phase) with no reader ->
43+
backlog stays 1 merged item, no overflow, collect() returns exact
44+
concatenation (activation for the text-merge branch).
45+
- NEW: 5000 adjacent thinking_delta chunks -> 1 merged item, exact
46+
concatenation (activation for the thinking-merge branch, A-gate blocker 3).
47+
- NEW: byte-bound activation — chunks totalling >64KB split into 2+ items,
48+
concatenation preserved across items.
3649
- NEW: heartbeat collapse — 50 heartbeats no reader -> 1 queued heartbeat.
3750
- NEW: interleaved text/tool/text does not merge across the tool event.
38-
- NEW: phase-boundary text deltas (phase change) do not merge.
51+
- NEW: phase transitions do not merge: "final"->"commentary", and
52+
explicit-phase -> omitted-phase (undefined) stays separate (blocker 4).
53+
- NEW: empty-string deltas merge without corrupting concatenation.
3954
- KEEP: overflow still fires for 1024+ DISTINCT non-coalescible events
40-
(e.g. tool_call_start floods) and message updated.
55+
(tool_call_start floods) and the message assertion updated.
4156

42-
### 4. MODIFY tests/abort-race.test.ts — message string sync.
57+
### 4. MODIFY tests/abort-race.test.ts — the overflow flood at :56 uses
58+
1025 text_delta events which coalescing would now merge; switch the flood
59+
to non-coalescible events (tool_call_start with distinct ids) so the
60+
abort-race contract still activates overflow (A-gate blocker 1), and sync
61+
the message string (only three live refs exist: run-turn-queue.ts:76 + the
62+
two test assertions; no runtime parser — blocker 7 verified).
4363

4464
## Accept criteria + activation
4565

‎devlog/_plan/260828_cursor_ndjson_backlog_train/020_macmini_probe_round.md‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,22 @@ port 10100. Codex CLI: /Users/junny/.bun/bin/codex.
55

66
## Procedure
77

8-
1. Sync: git -C ~/opencodex fetch origin dev + fetch the wp2 branch from
9-
origin; check out a probe worktree or reset dev checkout to
10-
origin/dev + cherry of wp2 branch head (repo checkout is clean; keep a
11-
pre-state ref snapshot). Restart launchd service; verify /healthz version.
8+
1. Sync (A-gate blockers 11/12 folded):
9+
- Environment: /Users/junny/.bun/bin/codex shebang is "env node" and the
10+
host has NO node on PATH — every probe command must prepend a node
11+
shim (export PATH with bun's node alias, or "bun x codex"). VERIFY
12+
"codex --version" works in the actual probe shell BEFORE claiming any
13+
probe ran; a login-shell (ssh -t or zsh -lc) may differ from plain ssh.
14+
- The user's ~/opencodex dev checkout is NEVER reset or cherry-picked.
15+
Mandatory: dedicated probe worktree (git -C ~/opencodex worktree add
16+
~/ocx-probe-260828/wt <ref> from fetched refs).
17+
- Deployment: launchd (com.opencodex.proxy) runs the PRIMARY checkout,
18+
so the probe proxy runs from the WORKTREE on a separate port (e.g.
19+
10199) as a foreground/background process started via ssh, leaving the
20+
launchd service untouched. Record pre-state (git -C ~/opencodex
21+
status/branch/sha) before and prove identical after (restoration
22+
proof). Probe codex CLI points at port 10199 via its own
23+
OPENAI_BASE_URL/config override, never the shared config.
1224
2. Probe matrix (codex exec --json -m cursor/grok-4.6 unless noted), scratch
1325
cwds under mktemp -d, transcripts + NDJSON to ~/ocx-probe-260828/:
1426
- N1 5-step chain (090 S4 shape): mkdir/write/read/compute/verify — the
@@ -17,6 +29,10 @@ port 10100. Codex CLI: /Users/junny/.bun/bin/codex.
1729
- N2 deep checkpoint session: >=8 tool rounds same thread (exercises
1830
checkpoint suffix path request-builder.ts:472).
1931
- N3 zero-stdout commands (true; mkdir; export) — defect #3 activation.
32+
N3 FIRST records how Cursor renders/forwards empty stdout on both the
33+
unary and streaming channel; the 030 marker ships ONLY if this
34+
evidence shows the model receives an unexplained blank (A-gate
35+
blocker 9 — no pre-committed fix).
2036
- N4 stalled-consumer live check for wp2 (curl -N | slow reader).
2137
- N5 usage.jsonl integrity tail — schema + usageStatus after rounds.
2238
- Controls: same probes via xai/grok-4.6 where defect could be

‎devlog/_plan/260828_cursor_ndjson_backlog_train/030_cursor_fixes.md‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
Branch: codex/cursor-empty-result-trace (stack root: dev, or wp2 branch only
44
if run-turn-queue files overlap — expected NOT to overlap).
55

6-
## PR B1: correlated empty-result instrumentation + native zero-stdout marker
6+
## PR B1: correlated empty-result instrumentation (+ zero-stdout marker,
7+
## conditional on wp3 N3 evidence — A-gate blocker 9)
78

8-
### 1. MODIFY src/adapters/cursor/native-exec-shell.ts
9+
### 1. MODIFY src/adapters/cursor/native-exec-shell.ts (CONDITIONAL: build
10+
### only if wp3 N3 proves the model sees an unexplained blank)
911

1012
- shellExec success with stdout === "" and stderr === "" -> stdout becomes
1113
"(command completed with no output; exit 0)" — mirrors the bridge-side
@@ -17,6 +19,13 @@ if run-turn-queue files overlap — expected NOT to overlap).
1719

1820
### 2. ADD debug trace (env-gated OCX_CURSOR_TRACE_TOOL_RESULTS=1)
1921

22+
Env-gate convention (A-gate blocker 10): no OCX_* env reads exist under
23+
src/adapters/cursor today; follow the repo's central pattern used by
24+
OCX_EMPTY_COMPLETION_RETRY (rg it in src/server/responses/core.ts /
25+
src/config) — read once at module or call-site with an explicit
26+
disable/enable contract, documented in the PR. Digests: sha256 hex
27+
truncated to 12 chars, computed over result bytes only (no content logged).
28+
2029
- tool-result-normalize.ts: log requestId, tool name, pre/post byte counts,
2130
changed, isError (no content bodies — privacy:scan constraint).
2231
- protobuf-request.ts suffix path: continuationMode, coveredCount,
@@ -26,9 +35,9 @@ if run-turn-queue files overlap — expected NOT to overlap).
2635

2736
### 3. Tests
2837

29-
- NEW tests near existing cursor native-exec tests: zero-stdout marker on
30-
both exec paths; non-zero exit untouched; marker absent when stdout
31-
nonempty.
38+
- MODIFY tests/cursor-native-exec-shell.test.ts (existing file, A-gate
39+
blocker 8): zero-stdout marker on both exec paths; non-zero exit
40+
untouched; marker absent when stdout nonempty. (Only if marker ships.)
3241
- Trace lines: focused test asserting no content bytes are logged (privacy).
3342

3443
## PR B2 (conditional): the boundary fix probe evidence proves

0 commit comments

Comments
 (0)