Skip to content

fix(agents): quiet model turns are aborted by a false "no response from model" idle timeout - #117884

Merged
steipete merged 5 commits into
openclaw:mainfrom
pacocartones:fix/idle-watchdog-merged-signal
Aug 26, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
pacocartones:fix/idle-watchdog-merged-signal

Conversation

@pacocartones

@pacocartones pacocartones commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Related: #117731
Related: #113323 (that issue's local-provider path opts out of gap policing; this regression bites the cloud path that #114997 hardened)

What Problem This Solves

Fixes an issue where users running an agent turn whose model streams no visible output for a while would have the run killed with LLM idle timeout (120s): no response from model while the model was still responding. Two shipping cases produce such turns: hidden reasoning on openai-completions providers (nothing is exposed until the answer starts), and Claude turns under the streaming-refusal contract, where every event is buffered until the terminal stop reason is known.

The affected surface is an embedded agent run — CLI, gateway/channel, or subagent — whose turn reaches the Anthropic or OpenAI-completions transport and stays visibly silent past the idle budget (120s; 60s on cron) while the provider is still streaming.

Why This Change Was Made

The idle watchdog keeps itself alive on quiet turns by listening for transport keep-alives on the AbortSignal it hands down (llm-idle-timeout.ts:436,454-457,530-533), and that activity registry is keyed by signal identity (packages/ai/src/utils/llm-request-activity.ts:1,7). #117731 correctly made the embedded runner honour both cancellation owners by composing the caller signal with the run signal (stream-resolution.ts:273-276); the unforeseen interaction is that AbortSignal.any() returns a new object, so the transport now reports keep-alives on the composite (openai-completions-transport.ts:658, anthropic-transport-stream.ts:1152) while the watchdog is still listening on the signal it created — and every keep-alive is dropped. Before that commit the same expression returned callerSignal when both existed, so identity was preserved and the channel worked.

This bridges activity from the composite back to the caller signal in mergeRunSignal, the only site that holds both objects (AbortSignal.any hides its sources, so nothing downstream can re-associate them). That restores the pre-merge identity for the activity channel and leaves #117731's cancellation property exactly as it is. Non-goals: no change to cancellation semantics, timeout defaults, transport code, or the activity registry itself.

The bridge is intentionally listener-free: onLlmRequestActivity already stores callbacks in a WeakMap keyed by the composite signal, so the composite, its callback, and its registry entry become collectible when a completed request releases the composite. No abort listener is attached to either cancellation signal. Attaching cleanup to the reusable caller signal would retain one completed-request closure and composite per successful turn; attaching an abort listener directly to the composite would instead trigger Node's process-wide gcPersistentSignals retention. composedSignal.aborted still suppresses stale activity when either cancellation owner aborts.

User Impact

Long turns whose only sign of life is provider keep-alive — hidden reasoning, buffered refusals — now run to completion instead of failing with "no response from model". Reusing a caller signal across successfully completed turns also remains bounded: finished requests do not accumulate abort listeners or retain old activity bridges.

Scope, stated plainly: turns that emit visible events already refresh the watchdog through the iterator path and were never affected; runs without a separate run signal, and the anthropic-vertex path (stream-resolution.ts:176-178, which returns before any wrapper), never build a composite and are unchanged. No config change, no new surface, no behaviour change for anyone not hitting a quiet turn.

Evidence

Focused regression coverage in the dedicated src/agents/embedded-agent-runner/stream-resolution.activity.test.ts owner suite:

  1. keeps provider request activity reaching the caller signal after the run signal merge — the contract, no timers: activity notified on the merged signal must reach a listener registered on the caller signal.
  2. keeps the idle watchdog armed when a merged run signal turn only reports hidden progress — the real topology, streamWithIdleTimeout outside and resolveEmbeddedAgentStreamFn inside, with a transport that emits no visible event for 120ms and reports liveness only via notifyLlmRequestActivity(options.signal), against a 50ms idle budget.
  3. Two complete, successful provider streams reuse the same unaborted caller signal. Each stream is fully consumed, returns a valid final AssistantMessage, and explicitly resolves stream.result() successfully; each distinct composite forwards exactly its own activity, while getEventListeners(callerSignal, "abort") remains at its original baseline after each completed turn.

Original contributor's adversarial check — tests applied, production change reverted to AbortSignal.any([callerSignal, params.runSignal]), test file untouched:

$ node scripts/run-vitest.mjs src/agents/embedded-agent-runner/stream-resolution.test.ts
 FAIL  stream-resolution.test.ts > resolveEmbeddedAgentStreamFn > keeps provider request activity reaching the caller signal after the run signal merge
AssertionError: expected "spy" to be called 1 times, but got 0 times
 FAIL  stream-resolution.test.ts > resolveEmbeddedAgentStreamFn > keeps the idle watchdog armed when a merged run signal turn only reports hidden progress
AssertionError: promise rejected "Error: LLM idle timeout (0s): no response…" instead of resolving
Caused by: Error: LLM idle timeout (0s): no response from model
 ❯ createIdleTimeoutError src/agents/embedded-agent-runner/run/llm-idle-timeout.ts:434:7

 Test Files  1 failed (1)
      Tests  2 failed | 31 passed (33)

Original contributor's owner and sibling evidence before the lifecycle follow-up:

$ node scripts/run-vitest.mjs src/agents/embedded-agent-runner/stream-resolution.test.ts
 ✓ stream-resolution.test.ts (36 tests) 193ms

$ node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/llm-idle-timeout.test.ts
 Test Files  1 passed (1)
      Tests  123 passed (123)

$ node scripts/run-vitest.mjs src/agents/openai-transport-stream.streaming.test.ts
 Test Files  1 passed (1)
      Tests  50 passed (50)

Real behavior proof — quiet-turn idle watchdog

Original contributor's loopback harness, real production chain, no mocks, no fake timers (Windows, Node v24.18.1, archived proof head 46f98d1b0):

node:http SSE server on http://127.0.0.1:<port>/v1   (OpenAI chat-completions SSE)
-> createOpenAICompletionsTransportStreamFn()        (@openclaw/ai, built dist)
-> resolveEmbeddedAgentStreamFn({ signal: runController.signal, ... })
     (mergeRunSignal: watchdog's per-request signal != run signal -> composite built)
-> streamWithIdleTimeout(mergedFn, 3000)  (watchdog outside, same topology as run/attempt-stream.ts)

The server mimics a quiet reasoning turn (reasoning: false model): only hidden reasoning_content chunks every 2 s for ~10 s (no visible client event in that phase), then one visible content chunk and [DONE]. Loopback only, not a live provider account; apiKey is a dummy value. Timestamps are the harness's relative stamps.

Run 1 — pre-fix

[+1.076s] server   sent hidden reasoning_content chunk #1 (hidden phase 0.001s)
[+3.088s] server   sent hidden reasoning_content chunk #2 (hidden phase 2.013s)
[+4.125s] watchdog onIdleTimeout callback fired: LLM idle timeout (3s): no response from model
[+4.127s] result   STREAM FAILED Error: LLM idle timeout (3s): no response from model

Bug reproduced: the turn dies 3.0 s after the watchdog armed while the provider is actively streaming — keep-alives land on the composite signal, but the watchdog listens on the signal it handed in; the identity mismatch drops every keep-alive.

Run 2 — post-fix, same quiet-but-alive server

[+1.091s] server   sent hidden reasoning_content chunk #1 (hidden phase 0.000s)
[+3.100s] server   sent hidden reasoning_content chunk #2 (hidden phase 2.009s)
[+5.101s] server   sent hidden reasoning_content chunk #3 (hidden phase 4.009s)
[+7.107s] server   sent hidden reasoning_content chunk #4 (hidden phase 6.016s)
[+9.120s] server   sent hidden reasoning_content chunk #5 (hidden phase 8.029s)
[+11.125s] server   hidden phase over at 10.034s; sent visible content chunk "OK"
[+11.137s] event    text_delta delta="OK"
[+11.137s] event    done reason=stop
[+11.137s] result   STREAM COMPLETED doneReason=stop text="OK" visibleEvents=4

Fix verified: a 10 s hidden phase survives a 3 s watchdog budget. Nothing visible is emitted until +11.1 s; only the bridged keep-alives re-arm the watchdog.

Run 3 — post-fix control: SSE headers sent, then silence

[+1.032s] server   SILENT scenario: headers sent, no chunks will follow
[+3.960s] watchdog onIdleTimeout callback fired: LLM idle timeout (3s): no response from model
[+3.969s] result   STREAM FAILED Error: LLM idle timeout (3s): no response from model
[+3.972s] [model-fetch] error ... elapsedMs=3024 name=AbortError message=This operation was aborted

Control verified: a genuinely silent provider still times out at ~3 s and the abort propagates into the provider request — the fix does not disarm the watchdog. In all three runs runController.signal.aborted=false at exit; the watchdog is the only abort source.

Why no existing test caught this: run/llm-idle-timeout.test.ts:944 wires baseFn directly under streamWithIdleTimeout with no merge wrapper and no run signal, so it notifies the very object the watchdog registered on; the OpenAI transport loopback coverage passes options with no run signal; and the coverage added by #117731 proves the composite aborts correctly but never composes the idle watchdog. Neither layer is wrong on its own — only their composition is.

Sibling surfaces sharing the same invariant, all downstream of this one merge and all notifying on options.signal: packages/ai/src/transports/anthropic-transport-stream.ts, packages/ai/src/transports/openai-completions-transport.ts, packages/ai/src/providers/anthropic.ts, packages/ai/src/providers/openai-completions.ts, and extensions/amazon-bedrock/stream.runtime.ts. One bridge at the merge restores all of them; none of them needs to change.

Dependency contracts checked directly: packages/ai/src/utils/llm-request-activity.ts uses a signal-keyed WeakMap; packages/llm-core/src/utils/event-stream.ts requires a real terminal event or final result for successful stream completion; Node's lib/internal/abort_controller.js creates a fresh composite, tracks dependencies weakly, and strongly retains composites only when abort listeners are installed.

ClawSweeper finding resolved

The accepted lifecycle finding was valid: the previous cleanup listener on the reusable caller signal retained one completed bridge after every successful stream. The follow-up removes that listener entirely and relies on the existing canonical signal-keyed WeakMap, reducing production code by 16 lines relative to the previous contributor head. Across the entire PR versus its merge base, the necessary new composed-signal activity bridge adds 15 production lines and removes one (net +14); approximately eight executable lines provide the otherwise-missing generic identity bridge at its sole architectural owner. The new deterministic regression proves two genuinely successful completed turns keep caller abort listeners at baseline. Both caller/run cancellation ownership, hidden provider progress, and true-silence timeouts are unchanged.

The first exact-head hosted run also exposed an existing generic owner test file crossing the repository's maximum-line rule after this regression was added. The complete four-case activity/watchdog neighborhood now lives in a focused 187-line owner suite, leaving the generic owner suite at 955 physical lines. This test-only extraction adds 188 lines and removes 219 (net -31 test lines); no lint thresholds, configuration, runtime behavior, or original human regression coverage were weakened.

The original contributor's local proof above is historical evidence on their earlier head. Maintainer review did not execute contributor-controlled source, tests, configuration, or hooks locally; current-head runtime verification is delegated to the isolated GitHub-hosted CI sandbox. Independent source review covered the complete original contribution and follow-up, including the Node and stream dependency contracts.

Not claimed: this has not been reproduced against a paid live provider account.

Original implementation and real loopback investigation by @pacocartones, with an existing activity-cancellation correction by Vincent Koc. Both original human contributions are preserved; @pacocartones remains the primary PR author.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Aug 2, 2026
@pacocartones
pacocartones marked this pull request as ready for review August 2, 2026 07:02
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 10:18 AM ET / 14:18 UTC.

ClawSweeper review

What this changes

The PR forwards provider liveness from a composed cancellation signal back to the embedded-run idle-watchdog signal and adds focused regressions for quiet but active model streams.

Regression provenance

Possible regression — probable (reviewed change; reproduction). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This remains a useful, source-backed repair: current main still passes a fresh composite signal to providers while the watchdog subscribes to its own signal, so quiet provider activity is lost. The branch restores that missing activity path at the sole composition boundary; no correctness finding was identified, but exact-head checks are still pending.

Priority: P1
Reviewed head: 2f24c171753b317c0cf2bc0b1aeefcc882453356

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is narrowly owned and backed by strong real-path evidence plus focused regressions; exact-head CI remains the material merge gate.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body includes an after-fix loopback production-chain trace where a quiet active SSE stream survives the watchdog, plus a control where a truly silent stream still aborts.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body includes an after-fix loopback production-chain trace where a quiet active SSE stream survives the watchdog, plus a control where a truly silent stream still aborts.
Evidence reviewed 7 items Current-main defect: Current main composes the watchdog signal and run signal with AbortSignal.any() but does not bridge request activity back to the watchdog signal.
Activity identity contract: The activity registry is a WeakMap keyed by the exact AbortSignal object, so activity reported on the composite cannot reach a listener registered on the watchdog signal without this bridge.
Owner-boundary repair: The branch bridges activity exactly where both source signals are available, and stops forwarding once the composed request has aborted.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

$ node scripts/run-node.mjs --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 123.32 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.8s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 14.9s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4462ms (slowest: built plugin control-plane loads 3694ms)

OpenClaw 2026.8.1 (2f24c17) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console (silent|fatal|error|warn|info|debug|trace)
  --no-color           Disable ANSI colors
  --profile ‹name›     Use a named profile (iso
… output truncated …

Assertions:

  • PASS expect_output: Usage:

How this fits together

Embedded agent runs wrap provider streams with an idle watchdog and pass cancellation signals down to transports. Providers report hidden progress through a signal-keyed activity registry, which the watchdog uses to keep an active request alive.

flowchart LR
  A[Embedded agent turn] --> B[Idle watchdog]
  B --> C[Composed cancellation signal]
  C --> D[Provider transport]
  D --> E[Request activity registry]
  E --> B
  B --> F[Reply or idle timeout]
Loading

Before merge

  • Resolve merge risk (P1) - The latest head’s required checks are still queued, so its focused proof has not yet been independently confirmed by exact-head CI.
  • Complete next step (P2) - No mechanical repair remains from this review; wait for current-head validation and normal maintainer merge handling.
Agent review details

Security

None.

PR surface

Source +14, Tests +187. Total +201 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 15 1 +14
Tests 1 187 0 +187
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 202 1 +201

Review metrics

Metric Value Why it matters
Production versus regression coverage production +15/-1 (net +14); focused tests +187 The production growth is the single activity bridge at the only signal-composition owner; the new suite covers its lifecycle and watchdog behavior.

Root-cause cluster

Relationship: canonical
Canonical: #117884
Summary: This PR is the canonical open repair for activity loss caused by embedded-run signal composition; earlier work fixed provider progress and introduced the composition boundary, but neither replaces this bridge.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Validate the exact head (recommended)
    Wait for the current head’s required checks before merging this change to the agent-request termination path.

Technical review

Best possible solution:

Merge the single composition-boundary bridge after the current head completes required validation; keep provider transports and timeout policy unchanged.

Do we have a high-confidence way to reproduce the issue?

Yes—current main visibly creates the composite without an activity bridge, and the focused regression describes the exact two-signal quiet-progress path.

Is this the best way to solve the issue?

Yes—the composition boundary is the only place that holds both signal identities, while multiple provider siblings already correctly report activity on their received signal.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against fe6b8bf1e4d4.

Labels

Label justifications:

  • P1: The defect can abort active agent turns whose providers are quietly streaming progress.
  • merge-risk: 🚨 availability: The patch changes the watchdog activity path that determines whether active model requests are aborted.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes an after-fix loopback production-chain trace where a quiet active SSE stream survives the watchdog, plus a control where a truly silent stream still aborts.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes an after-fix loopback production-chain trace where a quiet active SSE stream survives the watchdog, plus a control where a truly silent stream still aborts.

Evidence

What I checked:

Likely related people:

  • steipete: Recent main history includes the original cancellation-preservation work and the latest PR-head lifecycle and test-isolation commits. (role: recent area contributor; confidence: high; commits: 7c1d5dc7ef58, 0138f5b5e37d, 6c1555d4c263; files: src/agents/embedded-agent-runner/stream-resolution.ts, src/agents/embedded-agent-runner/run/attempt-stream.ts, src/agents/embedded-agent-runner/stream-resolution.activity.test.ts)
  • ZOOWH: Current-main blame identifies this author’s merged commit as the provenance of the bare AbortSignal.any() branch. (role: current-line contributor; confidence: high; commits: e69b076e8bd1; files: src/agents/embedded-agent-runner/stream-resolution.ts)
  • vincentkoc: The PR discussion records a focused lifecycle repair that added the aborted-composite guard. (role: lifecycle repair contributor; confidence: medium; commits: aab4e0e7b2c3; files: src/agents/embedded-agent-runner/stream-resolution.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the queued required checks complete on the current head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (22 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-15T17:04:13.744Z sha 0d96a7c12923800a46919a10dad0c68b45d54310 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-19T13:45:51.974Z sha 0d96a7c12923800a46919a10dad0c68b45d54310 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-22T03:08:54.109Z sha 0d96a7c12923800a46919a10dad0c68b45d54310 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-23T03:00:49.243Z sha fb9de08ca5863d4d47ea7e8fdba27ee701277dd1 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-23T11:04:32.619Z sha 3802e2872579b49217ad6609491cacbcfc285510 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-23T12:45:02.749Z sha 5025958 :: needs changes before merge. :: [P2] Dispose the activity bridge after normal completion
  • reviewed 2026-08-23T13:04:21.369Z sha 5025958 :: needs changes before merge. :: [P2] Avoid retaining activity bridges after normal completion
  • reviewed 2026-08-26T13:20:22.465Z sha 6c1555d :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 2, 2026
@vincentkoc vincentkoc self-assigned this Aug 2, 2026
@vincentkoc

vincentkoc commented Aug 2, 2026 •

Copy link
Copy Markdown
Member

Maintainer lifecycle repair pushed at 85b6097a1306c7f3d203abb93b7a0241707ede8a.

The activity bridge now stops forwarding provider liveness once the composed request signal is aborted. Regression coverage exercises both cancellation after signal composition and a run signal that was already aborted before composition.

Exact-head proof:

  • Local Node 26: stream resolution 37/37, idle watchdog 123/123, OpenAI streaming 50/50.
  • Direct probe: activity forwards before cancellation, stays at one callback after run cancellation, and remains zero for a pre-aborted run.
  • Sanitized direct AWS Crabbox, Node 24.15, public network, no Tailscale, no instance role, no hydration:
    • run_af708e75ddec: stream resolution 37/37.
    • run_312213dbcbfd: idle watchdog 123/123 and OpenAI streaming 50/50.
  • Fresh P1 autoreview: clean, no accepted/actionable findings, confidence 0.96.
  • oxfmt --check and git diff --check: clean.

Repair delta: production +3/-1; tests +40.

@clawsweeper re-review

CI follow-up: HOLD. Exact-head CI run https://github.com/openclaw/openclaw/actions/runs/30740886446 failed only checks-node-compact-large-2; an isolated retry failed identically in src/gateway/server-startup-model-runtime.event-loop.test.ts:103 after the test logged barrier-entered -> health-served -> HTTP200 -> release -> startup-complete, then exceeded its 120s timeout. This gateway startup test is outside the PR diff, but openclaw/ci-gate remains red, so this PR should not merge yet. No further retry was triggered.

Current main also changed both stream-resolution files in #117902. A synthetic merge with main at af77477a2ad0f5c8d1df0e3cedbea227d5fa05b6 is conflict-free and retains the activity bridge plus cancellation guard, but the required exact-head CI gate is still the blocker.

@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 2, 2026
@pacocartones

Copy link
Copy Markdown
Contributor Author

Refreshed the head with main to pick up the event-loop budget work that landed today — #117842, #117857, #117897, #117922 and #117931, the last of which widened the aggregate budget from 120s to 300s.

The previous run and its isolated retry both failed at the 120s ceiling in src/gateway/server-startup-model-runtime.event-loop.test.ts after logging the full successful sequence (barrier-entered → health-served → HTTP200 → release → startup-complete), which is exactly the pattern #117931 describes as blocking unrelated PRs despite the behavior proof succeeding. #117757 is currently red on the same check in the same file.

Merged rather than rebased so your commit stays intact. The diff in this PR is unchanged.

@pacocartones

Copy link
Copy Markdown
Contributor Author

Thank you @vincentkoc for the maintainer lifecycle repair at 85b6097a1. The activity bridge fix looks solid — it correctly stops forwarding provider liveness once the composed signal is aborted.

The head refresh I did picked up the 120s→300s budget widening from #117931, which resolved the previous flaky timeout in the event-loop test. All evidence remains current and the regression coverage exercises both post-composition cancellation and pre-aborted signals.

Ready for merge when you are. Let me know if you need anything else verified.

@pacocartones

Copy link
Copy Markdown
Contributor Author

openclaw/ci-gate completed green on this exact head (0d96a7c1) at 2026-08-07T09:51:33Z, run 31166477787: 81 passed, 0 failed, 36 skipped. That includes checks-node-compact-large-2 at 5m5s, the shard whose 120s timeout in src/gateway/server-startup-model-runtime.event-loop.test.ts was the original hold.

That was the only outstanding condition on either side. Both remaining items on the review card are "wait for exact-head CI to complete green", and the card was last updated at 09:41:24Z, about ten minutes before the run finished, so it never recorded the result.

Nothing else has changed: the diff is unchanged, 85b6097a1 is still in the branch, and a synthetic merge with current main is still conflict-free. Flagging only because the blocking condition is stale, no action needed from me.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 15, 2026
@clawsweeper clawsweeper Bot removed the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Aug 22, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 22, 2026
@pacocartones
pacocartones force-pushed the fix/idle-watchdog-merged-signal branch from 0d96a7c to fb9de08 Compare August 23, 2026 02:54
@pacocartones

Copy link
Copy Markdown
Contributor Author

@vincentkoc thank you for the lifecycle repair at 85b6097a1306c7f3d203abb93b7a0241707ede8a — the if (!composedSignal.aborted) guard is in this branch unchanged and I have kept it intact through the rebase below.

I want to be precise about scope, because I checked whether your commit had made this PR unnecessary before doing any more work on it.

Your commit narrowed the bridge; it did not land the bridge on main

85b6097a is a commit on this PR branch, not on main:

  • compare/main...85b6097a → diverged, ahead 2, behind 6219.
  • compare/85b6097a...0d96a7c1 (the previous head) → status: ahead, behind_by 0, i.e. your commit is an ancestor of the PR head.

So your change refines the activity bridge that this PR introduces. Without this PR, there is no bridge for it to guard. On current main (08c39dd6), stream-resolution.ts:280 is still the bare composition, and composeRunSignal / LlmRequestActivity do not appear in the file at all:

280:        ? AbortSignal.any([callerSignal, params.runSignal])

packages/ai/src/utils/llm-request-activity.ts is still an identity-keyed WeakMap<AbortSignal, Set<() => void>>, so the composite returned by AbortSignal.any() is a different key than the signal the watchdog subscribed on, and quiet keep-alives still land on a signal nobody listens to.

The residual case, demonstrated rather than asserted

The case that still slips through on main is exactly: caller signal and run signal both present and distinct, so composition actually happens, and the turn reports liveness only via notifyLlmRequestActivity without emitting a visible event (buffered refusals, hidden reasoning). Single-signal paths are unaffected because no composite is created.

I did not want to claim the bug survives without executing something, so I reverted only the production file to main's version, kept the tests, and ran them. Two tests fail with the real runtime error:

FAIL  src/agents/embedded-agent-runner/stream-resolution.test.ts > resolveEmbeddedAgentStreamFn > keeps provider request activity reaching the caller signal after the run signal merge
AssertionError: expected "vi.fn()" to be called 1 times, but got 0 times

FAIL  src/agents/embedded-agent-runner/stream-resolution.test.ts > resolveEmbeddedAgentStreamFn > keeps the idle watchdog armed when a merged run signal turn only reports hidden progress
AssertionError: promise rejected "Error: LLM idle timeout (0s): no response…" instead of resolving

Caused by: Error: LLM idle timeout (0s): no response from model
 ❯ createIdleTimeoutError src/agents/embedded-agent-runner/run/llm-idle-timeout.ts:435:7

 Test Files  1 failed (1)
      Tests  2 failed | 41 passed (43)

That is the user-visible symptom in the title, reproduced against current main's resolver. Restoring the fix turns both green, so the tests are load-bearing rather than tautological.

Rebase

Rebased onto main at 08c39dd6, which closed 4612 commits of drift (now behind by 5). This was not a no-op: stream-resolution.test.ts conflicted in the import block, where main added createRequireRecord and wrapStreamFnWithProviderPromptState alongside our createAssistantMessageEventStream and streamWithIdleTimeout imports. Resolved by keeping both sides. I confirmed streamWithIdleTimeout is still exported from run/llm-idle-timeout.ts:425 and that composeRunSignal still sits on the live composition path at the callerSignal !== params.runSignal branch, so the patch applies semantically and not merely textually.

New head: fb9de08ca5863d4d47ea7e8fdba27ee701277dd1. Diff is unchanged at +171/-2 across the same two files, and your commit is preserved as a separate commit.

Exact-head test results

node scripts/run-vitest.mjs src/agents/embedded-agent-runner/stream-resolution.test.ts

 ✓  agents-embedded-agent  src/agents/embedded-agent-runner/stream-resolution.test.ts (43 tests) 329ms

 Test Files  1 passed (1)
      Tests  43 passed (43)
   Duration  65.37s

node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/llm-idle-timeout.test.ts

 ✓  agents-embedded-agent-run  src/agents/embedded-agent-runner/run/llm-idle-timeout.test.ts (123 tests) 118ms

 Test Files  1 passed (1)
      Tests  123 passed (123)
   Duration  20.03s

Node 24.15.0. Stream resolution is 43/43 rather than the 37/37 you saw because main has since added tests to this file; the idle watchdog is unchanged at 123/123.

The CI hold you flagged was the checks-node-compact-large-2 timeout in src/gateway/server-startup-model-runtime.event-loop.test.ts, which is outside this diff and was addressed upstream by the 120s→300s budget widening in #117931. Happy to cut the patch down further if you would rather see the bridge live somewhere other than the merge boundary.

pacocartones and others added 3 commits August 23, 2026 14:29
…om model" idle timeout

The embedded runner merges the caller's request signal with the run's
cancellation signal through AbortSignal.any, which produces a new signal
object. The LLM request-activity registry is keyed by signal identity, so
transports that report progress with notifyLlmRequestActivity(options.signal)
now notify the composite while the idle watchdog is still listening on the
signal it handed in. Every keep-alive is dropped, and turns whose only sign of
life is that keep-alive (hidden reasoning on openai-completions, buffered
Claude refusals) are aborted as idle while the model is still responding.

Bridge activity from the composite back to the caller signal at mergeRunSignal,
the single site that holds both, restoring the pre-merge identity for the
activity channel while keeping both cancellation owners. The bridge is disposed
from the caller signal rather than the composite: Node keeps composite signals
that carry an abort listener in a process-wide strong set until the last
listener is removed.
@pacocartones
pacocartones force-pushed the fix/idle-watchdog-merged-signal branch from 3802e28 to 5025958 Compare August 23, 2026 12:35
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 23, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 26, 2026
@steipete
steipete merged commit 0707fcb into openclaw:main Aug 26, 2026
256 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…om model" idle timeout (openclaw#117884)

* fix(agents): quiet model turns are aborted by a false "no response from model" idle timeout

The embedded runner merges the caller's request signal with the run's
cancellation signal through AbortSignal.any, which produces a new signal
object. The LLM request-activity registry is keyed by signal identity, so
transports that report progress with notifyLlmRequestActivity(options.signal)
now notify the composite while the idle watchdog is still listening on the
signal it handed in. Every keep-alive is dropped, and turns whose only sign of
life is that keep-alive (hidden reasoning on openai-completions, buffered
Claude refusals) are aborted as idle while the model is still responding.

Bridge activity from the composite back to the caller signal at mergeRunSignal,
the single site that holds both, restoring the pre-merge identity for the
activity channel while keeping both cancellation owners. The bridge is disposed
from the caller signal rather than the composite: Node keeps composite signals
that carry an abort listener in a process-wide strong set until the last
listener is removed.

* fix(agents): stop idle activity after run cancellation

* style: satisfy oxfmt import ordering in stream-resolution.test.ts

* fix(agents): release completed watchdog activity bridges

* test(agents): isolate provider stream activity regressions

---------

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

Labels

agents Agent runtime and tooling merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants