Skip to content

test(e2e): a turn without --timeout gets the run owner's deadline on both routes - #208644

Merged
obviyus merged 3 commits into
mainfrom
test/agent-route-parity-deadline
Nov 29, 2026
Merged

obviyus merged 3 commits into
mainfrom
test/agent-route-parity-deadline

Conversation

@obviyus

@obviyus obviyus commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Problem

openclaw agent without --timeout used to get two run deadlines: 600 s through the Gateway (a CLI-side fallback) and agents.defaults.timeoutSeconds (48 h by default) with --local. #208522 made resolveAgentTimeoutMs the only owner on both routes, but its tests stop at the CLI request shape. Nothing at the CLI boundary checks that the two routes resolve the same deadline.

Change

Test only. Adds a second case to test/e2e/agent-route-parity.built-cli.e2e.test.ts, which already holds the workspace parity case (#208502):

  • The run owner's config sets agents.defaults.timeoutSeconds: 2, and a synthetic model answers after 8 s.
  • agent --local without --timeout times out ("Request timed out before a response was generated") and never sees the late reply.
  • The Gateway route without --timeout, from a CLI whose own config sets no deadline, times out the same way and never sees the late reply. It runs as the separate client a remote Gateway would have. Before fix(cli): one run deadline for openclaw agent on both routes #208522, that CLI sent its own 600 s fallback, so the Gateway waited and returned the late reply.

The test checks the resolved deadline through the turn's outcome. It does not run for 10 minutes: each turn ends after about 2 s. It matches only timeout text that both the base and this branch print, so it fails on the deadline itself, not on the message wording #208522 changed.

CI gap

PR CI does not run this file, or the other test/e2e/*.built-cli.e2e.test.ts files added for class L (gateway-unsafe-home).

  • ci.yml runs only named e2e files.
  • The full pnpm test:e2e:gateway suite, which includes test/**/*.e2e.test.ts, runs only in the scheduled live checks (daily 04:23 UTC, include_repo_e2e: true), release checks and full release candidates (openclaw-live-and-e2e-checks-reusable.yml, Gateway 1/4-4/4).
  • So a regression here shows up nightly, not on the PR that causes it.
  • Wiring these files into PR CI is a CI-budget decision and is not part of this PR.

Evidence

  • Branch (built CLI, local run): both cases in the file pass (13.1 s and 14.1 s).
  • Base b170f7d97128^ (before fix(cli): one run deadline for openclaw agent on both routes #208522, built with ocx base): the new case fails on the Gateway route. The JSON result carries "text": "ROUTE_DEADLINE_LATE_REPLY", because the CLI's 600 s fallback overrode the Gateway's 2 s deadline.
  • --local passes on both, as expected: it always used resolveAgentTimeoutMs.
  • Test only, no production change.

…both routes

- The parity e2e runs a no --timeout turn with --local and through the Gateway from a
  CLI whose own config sets no deadline; both end at the owner's configured limit.
…ses print

- Match the timeout text shared with releases before #208522 and assert the late
  reply never arrives, so the case fails on the old CLI fallback, not on wording.
@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Pull request received.

ClawSweeper review superseded

A newer revision replaced this review attempt before it published a verdict.

View the superseded run.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 29, 2026
- The synthetic model's 8 s wait now aborts on request close, so a timed-out turn
  or the server shutdown leaves no timer behind.
@obviyus
obviyus merged commit d31aefe into main Nov 29, 2026
70 checks passed
@obviyus
obviyus deleted the test/agent-route-parity-deadline branch November 29, 2026 23:58
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
One command, two deadlines. Without `--timeout`:

- `openclaw agent` through the Gateway sent a CLI fallback of **600 s** (`--timeout ?? agents.defaults.timeoutSeconds ?? 600`) as the run's per-attempt deadline. At 600 s the Gateway aborted the attempt and the run ended with `timeoutPhase: "provider"` and "Request timed out before a response was generated".
- `openclaw agent --local` resolved `agents.defaults.timeoutSeconds`, which defaults to **48 hours**, as Gateway turns and cron do.
- `openclaw agent exec` hardcoded **600 s**.

So long coding tasks finished with `--local` and were cut at 10 minutes through the Gateway. In a long-task coding evaluation (DeepSWE), 3 of 5 Gateway-route trials ended at 607–608 s, while `--local` trials of the same tasks ran 1,084–2,279 s without a cut.

The 600 s dates from when the CLI waited on a bounded client timer. That wait has been unbounded for a long time (the CLI waits for the Gateway's terminal result), but the 600 kept travelling as the run's own deadline.

Three related bugs come from the same CLI-side value:

1. **Remote Gateway config was overridden.** The CLI sent the CLI host's `agents.defaults.timeoutSeconds`, so a remote Gateway's own setting never applied to CLI turns.
2. **Subagent timeouts were shadowed.** The Gateway gives a turn into a live registered subagent session that subagent's `runTimeoutSeconds` only when the request carries no timeout. The CLI always sent one.
3. **The docs matched only one route.** They said "default 600" for `openclaw agent`, which was true on the Gateway route and false with `--local`.

`resolveAgentTimeoutMs` (`agents.defaults.timeoutSeconds`, default 48 h) is now the only owner of how long `openclaw agent` and `openclaw agent exec` run, on both routes.

- The Gateway route sends `timeout` only when `--timeout` is given; the Gateway resolves the default exactly as for every other turn.
- `agent exec` no longer hardcodes 600; without `--timeout` its embedded run resolves the same default.
- The CLI's wait for a yielded turn's subagents has no deadline unless `--timeout` is given. It still ends on the follow-up reply, Ctrl-C or disconnect.
- Removed the stale transport hint "use --timeout <seconds> to extend the CLI wait".
- Help text and docs now state one default for every route: `docs/cli/agent.md`, `docs/tools/agent-send.md`, `docs/gateway/cli-backends.md`, `docs/tools/autoreview.md`, `docs/plugins/codex-harness-reference/timeouts.md`.

`--timeout N` behaves exactly as before on both routes, including `0` (unlimited).

- **Old:** without `--timeout`, `openclaw agent` through the Gateway and `openclaw agent exec` stopped each model attempt at **600 s (10 minutes)**.
- **New:** they use `agents.defaults.timeoutSeconds`, which is **48 hours** unless configured, the same deadline as `openclaw agent --local`, Control UI and channel turns, and cron.
- **To keep the old cap:** pass `--timeout 600`, or set `agents.defaults.timeoutSeconds: 600` in the config (the Gateway's config on the Gateway route).
- **Accepted cost:** a script or CI job that relied on the implicit 600 s cap and passes no `--timeout` loses it. A run that neither stalls nor repeats can then run until 48 hours or the job's own limit. Stalled and looping runs are still stopped by the model idle timeout (120 s without output) and the existing loop guards.
- **The timeout message** now names the limit that fired and how to raise it: "…the run reached its 10m limit. Please try again, or raise the limit with `--timeout <seconds>` for `openclaw agent`, or `agents.defaults.timeoutSeconds` in your config."

- Long tasks through the Gateway are no longer stopped at 10 minutes; `--local` is unchanged.
- **Default change:** Gateway-route `openclaw agent` and `agent exec` without `--timeout` now get `agents.defaults.timeoutSeconds` (48 h unless configured) instead of 600 s. Scripts that relied on the implicit 10-minute stop should pass `--timeout 600`.
- Autoreview passes launched without a helper timeout can now run up to `agents.defaults.timeoutSeconds` (48 h unless configured) instead of 600 s; helpers that set a timeout are unchanged.
- A scripted `openclaw agent` whose yielded turn waits on subagents now waits until they settle (or Ctrl-C/disconnect) instead of exiting 1 at 600 s; pass `--timeout` to bound that wait.
- A dead provider is still caught by the model idle timeout (120 s without output). A looping agent is bounded by the configured run deadline and the existing runaway guards.
- If the CLI process is killed with SIGKILL or its connection drops, an accepted Gateway run continues and its result is added to the session (accepted execution is bound to the Gateway lifetime, not the caller's connection). Ctrl-C/SIGTERM still sends `chat.abort`, as before.

- Red on the merge base, green with the fix:
  - `src/commands/agent-via-gateway.deadline.test.ts`: without `--timeout`, the Gateway request carries no `timeout` for a local and a remote Gateway (main sent 600 from the CLI host's config).
  - `src/commands/agent-exec.test.ts`: `agent exec` without `--timeout` passes no timeout to the run (main passed "600").
  - `src/cli/program/register.agent.test.ts`: `agent exec fix` without `--timeout` reaches the command with no timeout (main's Commander default injected "600").
- The Gateway already gives a timeout-less request into a registered subagent session that subagent's budget (`agent.session-followup` suite, unchanged).
- Affected consumers rerun green: `agent-via-gateway.test.ts`, `agent-via-gateway.yield.test.ts`, `register.agent.test.ts`.
- Real-product evidence: the long-task evaluation above (Gateway route 3 of 5 trials cut at 600 s; `--local` none cut).
- `src/agents/embedded-agent-runner/run/terminal-timeout.test.ts`: the provider timeout message names the limit that fired (from the run's deadline), `--timeout <seconds>` and `agents.defaults.timeoutSeconds`.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit b170f7d)

Release adaptation: Do not restore the absent newer yielded-turn follower. Stable yields return the existing reply; only execution deadlines end up with the Gateway/local owners instead of the CLI hardcoded value.

Companion audit: The independent #208644 transport work is not needed by this stable route; preserve explicit zero and nonzero timeout tests.

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…both routes (#208644)

## Problem

`openclaw agent` without `--timeout` used to get two run deadlines: 600 s through the Gateway (a CLI-side fallback) and `agents.defaults.timeoutSeconds` (48 h by default) with `--local`. #208522 made `resolveAgentTimeoutMs` the only owner on both routes, but its tests stop at the CLI request shape. Nothing at the CLI boundary checks that the two routes resolve the same deadline.

## Change

Test only. Adds a second case to `test/e2e/agent-route-parity.built-cli.e2e.test.ts`, which already holds the workspace parity case (#208502):

- The run owner's config sets `agents.defaults.timeoutSeconds: 2`, and a synthetic model answers after 8 s.
- `agent --local` without `--timeout` times out ("Request timed out before a response was generated") and never sees the late reply.
- The Gateway route without `--timeout`, from a CLI whose own config sets no deadline, times out the same way and never sees the late reply. It runs as the separate client a remote Gateway would have. Before #208522, that CLI sent its own 600 s fallback, so the Gateway waited and returned the late reply.

The test checks the resolved deadline through the turn's outcome. It does not run for 10 minutes: each turn ends after about 2 s. It matches only timeout text that both the base and this branch print, so it fails on the deadline itself, not on the message wording #208522 changed.

## CI gap

PR CI does not run this file, or the other `test/e2e/*.built-cli.e2e.test.ts` files added for class L (`gateway-unsafe-home`).
- `ci.yml` runs only named e2e files.
- The full `pnpm test:e2e:gateway` suite, which includes `test/**/*.e2e.test.ts`, runs only in the scheduled live checks (daily 04:23 UTC, `include_repo_e2e: true`), release checks and full release candidates (`openclaw-live-and-e2e-checks-reusable.yml`, Gateway 1/4-4/4).
- So a regression here shows up nightly, not on the PR that causes it.
- Wiring these files into PR CI is a CI-budget decision and is not part of this PR.

## Evidence

- Branch (built CLI, local run): both cases in the file pass (13.1 s and 14.1 s).
- Base `b170f7d97128^` (before #208522, built with `ocx base`): the new case fails on the Gateway route. The JSON result carries `"text": "ROUTE_DEADLINE_LATE_REPLY"`, because the CLI's 600 s fallback overrode the Gateway's 2 s deadline.
- `--local` passes on both, as expected: it always used `resolveAgentTimeoutMs`.
- Test only, no production change.

Co-authored-by: Ayaan Zaidi <[email protected]>

(cherry picked from commit d31aefe)

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 30, 2026
…both routes (openclaw#208644)

## Problem

`openclaw agent` without `--timeout` used to get two run deadlines: 600 s through the Gateway (a CLI-side fallback) and `agents.defaults.timeoutSeconds` (48 h by default) with `--local`. openclaw#208522 made `resolveAgentTimeoutMs` the only owner on both routes, but its tests stop at the CLI request shape. Nothing at the CLI boundary checks that the two routes resolve the same deadline.

## Change

Test only. Adds a second case to `test/e2e/agent-route-parity.built-cli.e2e.test.ts`, which already holds the workspace parity case (openclaw#208502):

- The run owner's config sets `agents.defaults.timeoutSeconds: 2`, and a synthetic model answers after 8 s.
- `agent --local` without `--timeout` times out ("Request timed out before a response was generated") and never sees the late reply.
- The Gateway route without `--timeout`, from a CLI whose own config sets no deadline, times out the same way and never sees the late reply. It runs as the separate client a remote Gateway would have. Before openclaw#208522, that CLI sent its own 600 s fallback, so the Gateway waited and returned the late reply.

The test checks the resolved deadline through the turn's outcome. It does not run for 10 minutes: each turn ends after about 2 s. It matches only timeout text that both the base and this branch print, so it fails on the deadline itself, not on the message wording openclaw#208522 changed.

## CI gap

PR CI does not run this file, or the other `test/e2e/*.built-cli.e2e.test.ts` files added for class L (`gateway-unsafe-home`).
- `ci.yml` runs only named e2e files.
- The full `pnpm test:e2e:gateway` suite, which includes `test/**/*.e2e.test.ts`, runs only in the scheduled live checks (daily 04:23 UTC, `include_repo_e2e: true`), release checks and full release candidates (`openclaw-live-and-e2e-checks-reusable.yml`, Gateway 1/4-4/4).
- So a regression here shows up nightly, not on the PR that causes it.
- Wiring these files into PR CI is a CI-budget decision and is not part of this PR.

## Evidence

- Branch (built CLI, local run): both cases in the file pass (13.1 s and 14.1 s).
- Base `0991e6a06171^` (before openclaw#208522, built with `ocx base`): the new case fails on the Gateway route. The JSON result carries `"text": "ROUTE_DEADLINE_LATE_REPLY"`, because the CLI's 600 s fallback overrode the Gateway's 2 s deadline.
- `--local` passes on both, as expected: it always used `resolveAgentTimeoutMs`.
- Test only, no production change.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant