# Test 651 — OpenCode copresence timeout aborts the session

date: 2026-10-06T11:00:10+00:00
bun: 1.3.1

## green — abort only when the live turn is ours; unread history and a human turn ahead do not abort
bun test v1.3.1 (89fa0f34)

src/runtime/opencode-copresence/runtime.test.ts:
[SKIP-LOUD] undici headersTimeout regression (#2026) cannot run: `node` on PATH is Bun posing as Node v24.3.0. It runs in test725 (real Node); set ANET_TEST_REQUIRE_REAL_NODE=1 to make this a failure.
(pass) OpenCode copresence task deadline > board651 reply deadline aborts the session and does not emit a late reply [3064.13ms]
(pass) OpenCode copresence task deadline > board651 reply deadline logs abort failure and does not claim the turn stopped [1049.04ms]
(pass) OpenCode copresence task deadline > board651 history read failure does not abort [1346.06ms]
(pass) OpenCode copresence task deadline > board651 human turn ahead of ours does not abort [1350.06ms]
(pass) OpenCode copresence task deadline > a POST that timed out without landing in history is reported as not submitted [424.02ms]
(pass) OpenCode copresence task deadline > admission timeout on a busy human session says the task was not submitted [437.02ms]

 6 pass
 27 filtered out
 0 fail
 58 expect() calls
Ran 6 tests across 1 file. [7.76s]

## green — abort decision
bun test v1.3.1 (89fa0f34)

src/runtime/opencode-copresence/reply-ownership.test.ts:
(pass) timedOutTurnAbortDecision (board #651) > the only unanswered user message is ours [1.00ms]
(pass) timedOutTurnAbortDecision (board #651) > unreadable history does not abort
(pass) timedOutTurnAbortDecision (board #651) > a readable history without our id was not submitted
(pass) timedOutTurnAbortDecision (board #651) > a human message ahead of ours, both unanswered, is the live turn
(pass) timedOutTurnAbortDecision (board #651) > a human message queued after ours is not aborted
(pass) timedOutTurnAbortDecision (board #651) > a textless user message queued after ours is not aborted
(pass) timedOutTurnAbortDecision (board #651) > an earlier unanswered message of ours blocks abort of the later timeout
(pass) timedOutTurnAbortDecision (board #651) > a compaction summary after ours does not block the abort
(pass) timedOutTurnAbortDecision (board #651) > an already-answered human turn then our unanswered turn aborts [1.00ms]

 9 pass
 11 filtered out
 0 fail
 13 expect() calls
Ran 9 tests across 1 file. [22.00ms]

## mutation — delete the abort call; the timeout trace must show the message POST and no abort
bun test v1.3.1 (89fa0f34)

src/runtime/opencode-copresence/runtime.test.ts:
[SKIP-LOUD] undici headersTimeout regression (#2026) cannot run: `node` on PATH is Bun posing as Node v24.3.0. It runs in test725 (real Node); set ANET_TEST_REQUIRE_REAL_NODE=1 to make this a failure.
715 |       // The bridge stopped waiting while the turn was still running. This
716 |       // used to be `elapsed < 2_000` against a 2_500 ms fake turn, a
717 |       // wall-clock margin an overloaded runner can eat (#517); the fake's own
718 |       // trace orders the two events causally instead.
719 |       expect(traceAtThrow).toContain("POST /session/ses_test123/message");
720 |       expect(traceAtThrow).toContain("ABORT ses_test123");
                                 ^
error: expect(received).toContain(expected)

Expected to contain: "ABORT ses_test123"
Received: "GET /global/health\nGET /global/health\nPOST /session\nGET /session/status\nGET /session/ses_test123\nPOST /session/ses_test123/message\nGET /session/ses_test123/message\n"

      at <anonymous> (/agent-node-src/src/runtime/opencode-copresence/runtime.test.ts:720:28)
(fail) OpenCode copresence task deadline > board651 reply deadline aborts the session and does not emit a late reply [608.03ms]

 0 pass
 32 filtered out
 1 fail
 6 expect() calls
Ran 1 test across 1 file. [704.00ms]
MUTATION_RED rc=1

## mutation — unreadable history treated as abort must go red
bun test v1.3.1 (89fa0f34)

src/runtime/opencode-copresence/runtime.test.ts:
[SKIP-LOUD] undici headersTimeout regression (#2026) cannot run: `node` on PATH is Bun posing as Node v24.3.0. It runs in test725 (real Node); set ANET_TEST_REQUIRE_REAL_NODE=1 to make this a failure.
809 |     });
810 |     try {
811 |       let thrown: any;
812 |       try { await runtime.submit("history unread", 300); } catch (error) { thrown = error; }
813 |       const traceAtThrow = readFileSync(log, "utf8");
814 |       expect(traceAtThrow).not.toContain("ABORT ses_test123");
                                     ^
error: expect(received).not.toContain(expected)

Expected to not contain: "ABORT ses_test123"
Received: "GET /global/health\nGET /global/health\nPOST /session\nGET /session/status\nGET /session/ses_test123\nPOST /session/ses_test123/message\nGET /session/ses_test123/message\nPOST /session/ses_test123/abort\nABORT ses_test123\n"

      at <anonymous> (/agent-node-src/src/runtime/opencode-copresence/runtime.test.ts:814:32)
(fail) OpenCode copresence task deadline > board651 history read failure does not abort [454.02ms]

 0 pass
 32 filtered out
 1 fail
 1 expect() calls
Ran 1 test across 1 file. [551.00ms]
MUTATION_RED rc=1

## mutation — human turn ahead treated as ours must go red
bun test v1.3.1 (89fa0f34)

src/runtime/opencode-copresence/runtime.test.ts:
[SKIP-LOUD] undici headersTimeout regression (#2026) cannot run: `node` on PATH is Bun posing as Node v24.3.0. It runs in test725 (real Node); set ANET_TEST_REQUIRE_REAL_NODE=1 to make this a failure.
852 |     });
853 |     try {
854 |       let thrown: any;
855 |       try { await runtime.submit("human is ahead", 300); } catch (error) { thrown = error; }
856 |       const traceAtThrow = readFileSync(log, "utf8");
857 |       expect(traceAtThrow).not.toContain("ABORT ses_test123");
                                     ^
error: expect(received).not.toContain(expected)

Expected to not contain: "ABORT ses_test123"
Received: "GET /global/health\nGET /global/health\nPOST /session\nGET /session/status\nGET /session/ses_test123\nPOST /session/ses_test123/message\nGET /session/ses_test123/message\nPOST /session/ses_test123/abort\nABORT ses_test123\n"

      at <anonymous> (/agent-node-src/src/runtime/opencode-copresence/runtime.test.ts:857:32)
(fail) OpenCode copresence task deadline > board651 human turn ahead of ours does not abort [455.02ms]

 0 pass
 32 filtered out
 1 fail
 1 expect() calls
Ran 1 test across 1 file. [546.00ms]
MUTATION_RED rc=1

OVERALL: PASS
