Skip to content

adversarial-review ignores --turn-timeout-ms — turnTimeoutMs not forwarded to runAppServerTurn #38

Description

@axisrow

Bug

adversarial-review parses --turn-timeout-ms but never applies it. Long PR reviews die at the library default with:

codex turn exceeded the 600000ms turn budget.

Root cause (present in 1.0.6-fork.6)

handleReviewCommand resolves the timeout and puts it on the request (plugins/codex/scripts/codex-companion.mjs:832):

turnTimeoutMs: resolveTurnTimeoutMsFromOptions(options),

The native review branch forwards it (codex-companion.mjs:424):

const result = await runAppServerReview(request.cwd, {
  ...
  turnTimeoutMs: request.turnTimeoutMs,

But the adversarial branch drops it (codex-companion.mjs:465-473):

const result = await runAppServerTurn(context.repoRoot, {
  prompt,
  model: request.model,
  effort: request.effort,
  sandbox: "read-only",
  outputSchema: readOutputSchema(REVIEW_SCHEMA),
  onProgress: request.onProgress,
  persistThread: true,
  threadName: ...
  // turnTimeoutMs missing
});

So resolveTurnTimeoutMs in lib/codex.mjs falls through to DEFAULT_TURN_TIMEOUT_MS = 600000. The only working override today is the CODEX_TURN_TIMEOUT_MS env var (read at call time in lib/codex.mjs:70-73).

Fix

Add one line to the adversarial runAppServerTurn call:

turnTimeoutMs: request.turnTimeoutMs,

making --turn-timeout-ms (and the foreground/background defaults from resolveTurnTimeoutMsFromOptions) effective for adversarial-review, same as review and task.

Repro

node plugins/codex/scripts/codex-companion.mjs adversarial-review --wait --json --turn-timeout-ms 1800000 --base <sha> "review"

on a review that takes >10 min → still fails at exactly 600000ms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions