Skip to content

Commit 3aad7f0

Browse files
axisrowclaude
andauthored
fix: forward turnTimeoutMs to adversarial-review's runAppServerTurn call (#44)
adversarial-review parses --turn-timeout-ms but never applied it, so long reviews silently fell back to the library's 600000ms default instead of the requested budget (or the 110000ms foreground default). The native review path and task path already forwarded turnTimeoutMs correctly; only the adversarial branch's runAppServerTurn call dropped it. Closes #38 Co-authored-by: axisrow <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
1 parent c33cf49 commit 3aad7f0

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

‎plugins/codex/scripts/codex-companion.mjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ async function executeReviewRun(request) {
470470
outputSchema: readOutputSchema(REVIEW_SCHEMA),
471471
onProgress: request.onProgress,
472472
persistThread: true,
473+
turnTimeoutMs: request.turnTimeoutMs,
473474
threadName: `Codex Companion Review: ${context.target.label}`.slice(0, 80)
474475
});
475476
const parsed = parseStructuredOutput(result.finalMessage, {

‎tests/runtime.test.mjs‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3254,3 +3254,30 @@ test("task with in-item output-delta progress longer than the budget does NOT ti
32543254
const storedJob = readPersistedJob(repo);
32553255
assert.equal(storedJob.status, "completed", "job must complete, not be killed mid-item");
32563256
});
3257+
3258+
test("adversarial review with stalled turn/start times out via --turn-timeout-ms instead of hanging on the 600s default", () => {
3259+
const repo = makeTempDir();
3260+
const binDir = makeTempDir();
3261+
installFakeCodex(binDir, "stalled-turn-start");
3262+
initGitRepo(repo);
3263+
fs.writeFileSync(path.join(repo, "README.md"), "hello\n");
3264+
run("git", ["add", "README.md"], { cwd: repo });
3265+
run("git", ["commit", "-m", "init"], { cwd: repo });
3266+
3267+
const start = Date.now();
3268+
// adversarial-review routes through runAppServerTurn (unlike native `review`,
3269+
// which uses runAppServerReview). turnTimeoutMs must reach that call too —
3270+
// without it, this hangs toward the library's 600000ms default instead of
3271+
// the 3s budget requested here.
3272+
const result = run("node", [SCRIPT, "adversarial-review", "--turn-timeout-ms", "3000"], {
3273+
cwd: repo,
3274+
env: buildEnv(binDir)
3275+
});
3276+
const elapsedMs = Date.now() - start;
3277+
3278+
assert.notEqual(result.status, 0, "must exit non-zero on timeout, not hang");
3279+
assert.match(result.stderr, /turn budget/i, "error must mention the turn budget");
3280+
assert.ok(elapsedMs < 15000, `must time out close to the requested budget, not the 600s default (took ${elapsedMs}ms)`);
3281+
const storedJob = readPersistedJob(repo);
3282+
assert.equal(storedJob.status, "failed", "job must be marked failed");
3283+
});

0 commit comments

Comments
 (0)