Skip to content

feat(tui,cli-runner): expose streamingWatchdogMs config + bump watchdog defaults#79997

Open
josephfelixbamba wants to merge 1 commit into
openclaw:mainfrom
josephfelixbamba:feature/expose-streaming-watchdog-config
Open

feat(tui,cli-runner): expose streamingWatchdogMs config + bump watchdog defaults#79997
josephfelixbamba wants to merge 1 commit into
openclaw:mainfrom
josephfelixbamba:feature/expose-streaming-watchdog-config

Conversation

@josephfelixbamba

Copy link
Copy Markdown

feat(tui,cli-runner): expose streamingWatchdogMs config + bump watchdog defaults

Table of Contents

Summary

  • Plumbs cli.tui.streamingWatchdogMs through runTui()createEventHandlers({ streamingWatchdogMs }). The consumer site at src/tui/tui-event-handlers.ts:80 was already reading context.streamingWatchdogMs but no caller ever set it, so the in-source default fired unconditionally.
  • Raises in-source defaults that were tripping prematurely on long-reasoning models, multi-minute tool calls, and SSE-keepalive gaps:
    • TUI streaming watchdog: 30s → 10m
    • CLI fresh-run watchdog ceiling: 10m → 60m
    • CLI resume watchdog ceiling: 3m → 60m

Motivation

Operators running OpenClaw against long-reasoning models (Anthropic extended thinking, OpenAI reasoning chains) and slow tool runs were seeing the TUI report idle and surface the "This response is taking longer than expected. Send another message to continue." prompt mid-run, while the model was still thinking — because the 30s streaming-delta watchdog was both (a) too short for modern models and (b) had no config knob.

The same operators were also seeing CLI runs aborted by the no-output watchdog at the 10-minute / 3-minute ceilings (fresh / resume). Per-backend overrides at cli.watchdog.fresh.maxMs were already supported, but the in-source defaults left every operator who hadn't tuned per-backend exposed.

This PR closes both gaps in one stroke: exposes the TUI streaming-watchdog as a first-class config knob, and lifts the CLI ceilings to a value (60m) that matches the longest legitimate run we've observed in production while still allowing per-backend overrides to dial it back.

Changes

File Change
src/tui/tui-event-handlers.ts DEFAULT_STREAMING_WATCHDOG_MS: 30_000 → 600_000 (with explanatory comment)
src/tui/tui.ts New exported helper resolveTuiStreamingWatchdogMs(config); wired into the existing createEventHandlers({...}) call inside runTui
src/config/types.cli.ts New CliTuiConfig type with optional streamingWatchdogMs?: number; added under CliConfig.tui
src/config/zod-schema.ts Added strict cli.tui.streamingWatchdogMs: z.number().int().nonnegative().optional()
src/agents/cli-watchdog-defaults.ts CLI_FRESH_WATCHDOG_DEFAULTS.maxMs: 600_000 → 3_600_000; CLI_RESUME_WATCHDOG_DEFAULTS.maxMs: 180_000 → 3_600_000
src/tui/tui.test.ts 5 new unit tests for resolveTuiStreamingWatchdogMs (unset, happy, zero, fractional, hostile inputs)
src/tui/tui-event-handlers.test.ts 1 new test asserting the new 10m default fires past 600s but not at 31s
docs/gateway/configuration-reference.md Documented the new cli.tui.streamingWatchdogMs knob in the existing ## CLI section

Test plan

pnpm install
pnpm build:strict-smoke
pnpm vitest run --config test/vitest/vitest.tui.config.ts \
  src/tui/tui-event-handlers.test.ts src/tui/tui.test.ts
pnpm vitest run --config test/vitest/vitest.agents-core.config.ts \
  src/agents/cli-runner.reliability.test.ts
pnpm vitest run --config test/vitest/vitest.runtime-config.config.ts \
  src/config/schema.test.ts
pnpm tsgo:test
pnpm lint

Manual verification:

  1. openclaw configure → set cli.tui.streamingWatchdogMs: 60000 → run a long-reasoning prompt → confirm the "taking longer" notice fires at 60s.
  2. Remove the override → confirm it now fires at 10 minutes (not 30s).
  3. Set cli.tui.streamingWatchdogMs: 0 → confirm the watchdog is disabled.

Backward compatibility

  • cli.tui.streamingWatchdogMs is optional. Configs that don't set it pick up the new in-source default of 10 minutes (was 30 seconds). This is a user-facing default change, justified above; flagged in the changelog.
  • CLI_*_WATCHDOG_DEFAULTS.maxMs changes only affect callers that did not set their own per-backend cli.watchdog.fresh.maxMs / .resume.maxMs. The existing resolveCliNoOutputTimeoutMs test at src/agents/cli-runner.reliability.test.ts:999 still passes because its computed value (480000 = 600000 * 0.8) sits below both the old and new ceilings.
  • No schema removals, no field renames, no deprecations. Pure addition + default-tuning.

…og defaults

F16 — TUI streaming-watchdog wiring:
- Adds `cli.tui.streamingWatchdogMs` config field (zod-validated, optional).
- `runTui` now reads this value and passes it to `createEventHandlers`,
  closing the gap where `context.streamingWatchdogMs` was a consumer-side
  knob with no producer-side wiring.
- Raises the in-code default from 30s to 600000ms (10 minutes). The 30s
  default tripped on long-reasoning models, slow tool runs, and SSE
  keepalive gaps; the 10m value matches the empirically validated
  downstream patch.
- Adds `resolveTuiStreamingWatchdogMs(config)` helper + unit tests for
  config-shape edge cases (NaN, negative, Infinity, fractional, string).
- Adds tui-event-handlers test verifying the new default fires at 10m
  (not 30s) when no override is supplied.

F18 — CLI watchdog defaults:
- Raises `CLI_FRESH_WATCHDOG_DEFAULTS.maxMs` from 600000 (10m) to
  3600000 (60m).
- Raises `CLI_RESUME_WATCHDOG_DEFAULTS.maxMs` from 180000 (3m) to
  3600000 (60m).
- Per-CLI-backend overrides at `cli.watchdog.fresh.maxMs` /
  `.resume.maxMs` continue to apply unchanged; this commit only moves
  the fallback ceiling so users without a per-backend override don't
  see false aborts on long but legitimate runs.

Backward compatibility:
- `cli.tui.streamingWatchdogMs` is optional; existing configs without it
  pick up the new 10m default rather than the prior 30s.
- The CLI watchdog defaults change only affects callers that did NOT
  set their own per-backend ratio/min/max, where previously the
  computed `maxMs` ceiling was 600000/180000.
- All existing tests for `resolveCliNoOutputTimeoutMs` continue to pass
  because their assertions (e.g. 480000 = 600000 * 0.8) sit below the
  new ceiling.

Docs:
- `docs/gateway/configuration-reference.md` documents the new
  `cli.tui.streamingWatchdogMs` field with default + disable semantics.

Co-Authored-By: Forge <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 9, 2026
@clawsweeper

clawsweeper Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 3, 2026, 11:49 PM ET / 03:49 UTC.

Summary
The PR adds cli.tui.streamingWatchdogMs, wires it into TUI event handlers, raises TUI and CLI watchdog defaults, and updates tests, docs, and the changelog.

PR surface: Source +35, Tests +80, Docs +9. Total +124 across 9 files.

Reproducibility: yes. at source level. Current main accepts an internal streamingWatchdogMs handler override but runTui never passes a user-configured value, and current CLI resolver tests show inherited resumed user runs are intentionally capped at 180 seconds.

Review metrics: 1 noteworthy metric.

  • Config/default surfaces: 1 config field added, 3 watchdog defaults changed. The PR changes public configuration and fallback timeout behavior, so maintainers need an explicit compatibility and upgrade decision before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #68596
Summary: This PR is a candidate implementation for the canonical TUI streaming-watchdog configuration request and partially overlaps separate CLI no-output watchdog cap work.

Members:

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

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🧂 unranked krab
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Rebase on current main and use the top-level tui config shape with schema/help/labels/docs/tests.
  • Remove or split the blanket CLI default bump unless maintainers explicitly accept the longer inherited-resume stall window.
  • [P2] Add redacted real behavior proof showing the configured TUI watchdog path and any retained CLI timeout behavior.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body has a manual test plan but no after-fix real setup evidence such as redacted terminal output, logs, screenshots, recording, copied live output, or linked artifacts; contributors should redact private data and update the PR body to trigger re-review.

Risk before merge

  • [P1] Adding cli.tui.streamingWatchdogMs would split TUI settings between cli.* and current top-level tui.*, making docs, config UI, and future migrations ambiguous.
  • [P1] Raising CLI_RESUME_WATCHDOG_DEFAULTS.maxMs to 60 minutes changes existing unconfigured resumed CLI runs so a genuinely wedged process can remain alive far longer before recovery.
  • [P1] The branch is conflicting and its watchdog test expects pre-current-main idle-reset/system-message semantics instead of the current pending-notice behavior.
  • [P1] External contributor proof is still missing; the PR only describes manual steps and does not show observed after-fix behavior from a real setup.
  • [P1] The PR edits CHANGELOG.md, which is release-owned in this repository and should be dropped from a normal feature PR.

Maintainer options:

  1. Rebase and narrow the public surface (recommended)
    Move the TUI watchdog setting into the current top-level tui config namespace, refresh the tests/docs/schema/help/labels for current semantics, and remove release-owned changelog edits.
  2. Split the CLI timeout policy
    Keep this PR focused on TUI configurability and handle the broader CLI default changes separately on the open CLI watchdog tracker with explicit upgrade proof.
  3. Accept longer watchdog windows deliberately
    Maintainers may choose the 60-minute defaults, but the PR should state the stalled-process retention tradeoff and prove fresh-install plus upgrade behavior before merge.

Next step before merge

  • [P2] The remaining blocker is maintainer/contributor follow-up on public config namespace, CLI timeout policy, conflicts, and real behavior proof rather than a safe autonomous repair.

Security
Cleared: No concrete security or supply-chain concern is visible in the docs, config, tests, changelog, and watchdog-default diff.

Review findings

  • [P1] Use the current top-level TUI config namespace — src/config/types.cli.ts:23-24
  • [P1] Preserve inherited resume watchdog behavior — src/agents/cli-watchdog-defaults.ts:16
  • [P2] Update the watchdog test to current behavior — src/tui/tui-event-handlers.test.ts:1253-1255
Review details

Best possible solution:

Refresh the branch against current main, put the TUI knob under the existing top-level tui config contract with schema/help/labels/docs/tests, keep current pending-notice watchdog semantics, split or explicitly approve any CLI default policy change, drop the changelog edit, and add redacted real behavior proof.

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

Yes, at source level. Current main accepts an internal streamingWatchdogMs handler override but runTui never passes a user-configured value, and current CLI resolver tests show inherited resumed user runs are intentionally capped at 180 seconds.

Is this the best way to solve the issue?

No as submitted. The TUI config idea is useful, but the maintainable fix should align with current top-level tui config, current pending-notice watchdog semantics, and the narrower post-PR-90912 CLI timeout policy.

Full review comments:

  • [P1] Use the current top-level TUI config namespace — src/config/types.cli.ts:23-24
    Current main already has a top-level tui config object with schema/help/label coverage. Adding cli.tui.streamingWatchdogMs creates a competing public TUI settings namespace, which will split docs, config UI, and migrations; please move this under the existing tui surface.
    Confidence: 0.91
  • [P1] Preserve inherited resume watchdog behavior — src/agents/cli-watchdog-defaults.ts:16
    Current main distinguishes deliberate/configured long CLI timeouts from ordinary inherited resumes, and the merged timeout-provenance fix preserved the 180-second inherited guard. Raising the resume default to 60 minutes changes every unconfigured resumed CLI run, so a wedged child can sit much longer before recovery.
    Confidence: 0.88
  • [P2] Update the watchdog test to current behavior — src/tui/tui-event-handlers.test.ts:1253-1255
    This test expects the watchdog to set idle, clear the active run, and append a system message. Current main keeps the active run and posts a pending notice for ordinary stream silence, only clearing on reconnect recovery; after rebasing, this expectation would either fail or reintroduce stale semantics.
    Confidence: 0.86
  • [P3] Drop the release-owned changelog edit — CHANGELOG.md:7
    CHANGELOG.md is generated/release-owned in this repo and normal feature PRs should carry release-note context in the PR body or squash message instead. Please remove the direct changelog entry from this branch.
    Confidence: 0.84

Overall correctness: patch is incorrect
Overall confidence: 0.87

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P1: The PR targets real TUI and CLI watchdog failures that can disrupt long-running agent workflows, but it has merge-blocking compatibility and proof gaps.
  • merge-risk: 🚨 compatibility: The PR adds a new public config surface beside current tui.* and changes default timeout behavior for existing unconfigured users.
  • merge-risk: 🚨 availability: The CLI default bump can keep genuinely stalled CLI-backed agent processes alive up to 60 minutes before OpenClaw recovers.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body has a manual test plan but no after-fix real setup evidence such as redacted terminal output, logs, screenshots, recording, copied live output, or linked artifacts; contributors should redact private data and update the PR body to trigger re-review.
Evidence reviewed

PR surface:

Source +35, Tests +80, Docs +9. Total +124 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 5 38 3 +35
Tests 2 80 0 +80
Docs 2 9 0 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 127 3 +124

What I checked:

  • Repository policy read: Root AGENTS.md and scoped src/tui/AGENTS.md, src/agents/AGENTS.md, and docs/AGENTS.md were read; root policy treats config/default additions and watchdog fallback behavior as compatibility-sensitive. (AGENTS.md:30, 9d68f877ac3e)
  • Live PR state: Live GitHub data shows the PR is open, external-authored, non-draft, head b0f7ac68e781ad6a8672028ac6330ea79d749114, and currently DIRTY/conflicting. (b0f7ac68e781)
  • Current main lacks user-facing TUI watchdog config plumbing: createEventHandlers accepts an internal streamingWatchdogMs override and falls back to 30 seconds, but the current runTui call creates handlers without passing any configured value. (src/tui/tui-event-handlers.ts:55, 9d68f877ac3e)
  • Current main already has a top-level TUI config namespace: Current main defines top-level OpenClawConfig.tui.footer.showRemoteHost and validates top-level tui.footer, while cli currently owns only banner presentation settings. (src/config/types.openclaw.ts:172, 9d68f877ac3e)
  • PR adds a competing TUI config surface: The PR adds CliConfig.tui.streamingWatchdogMs, creating a second public namespace for TUI settings instead of extending the existing top-level tui surface. (src/config/types.cli.ts:23, b0f7ac68e781)
  • Current CLI resume policy preserves inherited 180-second guard: Current main selects fresh watchdog defaults for resumed runs only for cron or explicit/configured timeout intent; the regression test keeps inherited user resumes at 180,000 ms. (src/agents/cli-runner/reliability.ts:31, 9d68f877ac3e)

Likely related people:

  • xantorres: Authored PR 67401 commits that added the internal streamingWatchdogMs option and TUI watchdog behavior this PR tries to expose. (role: introduced TUI watchdog behavior; confidence: high; commits: f44ab20d4db5; files: src/tui/tui-event-handlers.ts, src/tui/tui-event-handlers.test.ts)
  • obviyus: Pushed/merged the PR 67401 follow-up that kept the watchdog bound to the active run and landed the current TUI watchdog history. (role: recent TUI watchdog reviewer and merger; confidence: high; commits: a4240498e8a9, 352527393079; files: src/tui/tui-event-handlers.ts, src/tui/tui-event-handlers.test.ts)
  • onutc: PR 14257 introduced the supervisor-backed CLI watchdog defaults and resolver path this PR changes. (role: introduced CLI watchdog foundation; confidence: high; commits: cd44a0d01e9f; files: src/agents/cli-watchdog-defaults.ts, src/agents/cli-runner/reliability.ts, src/agents/cli-backends.ts)
  • ai-hpc: Authored the merged PR 90912 series that changed CLI resume-timeout provenance and overlaps this PR's CLI default changes. (role: recent CLI watchdog contributor; confidence: high; commits: 11a1d0703692, b3cacfc1d8e0, 0328ca53cded; files: src/agents/cli-runner/reliability.ts, src/agents/cli-runner.reliability.test.ts, src/agents/cli-runner/execute.ts)
  • vincentkoc: Maintainer verification on PR 90912 explicitly accepted the current timeout-provenance shape while preserving inherited resume behavior. (role: recent reviewer and contributor; confidence: high; commits: 0328ca53cded; files: src/agents/cli-runner/reliability.ts, src/agents/cli-runner/execute.ts, src/agents/cli-runner.reliability.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 1, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jun 1, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 2, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 2, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 14, 2026
@clawsweeper

clawsweeper Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@josephfelixbamba thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward.

Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive.

Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant