Skip to content

fix(agents): prevent stalled-run aborts after completed async tools - #166997

Merged
steipete merged 5 commits into
openclaw:mainfrom
SunnyShu0925:fix/watchdog-completed-async-tools-166770
Oct 8, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
SunnyShu0925:fix/watchdog-completed-async-tools-166770

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #166770

What Problem This Solves

Fixes agent runs being aborted as repeated_model_requests_without_progress after successful asynchronous tools when the enclosing Responses request ends at its output limit.

User Impact

Successful embedded tool execution counts as progress even when the provider later returns length. Failed or blocked tools and completions from retired owners retain watchdog evidence. No settings, migrations, timeout increases, or protocol changes are required.

Why This Change Was Made

The response classifier sees proposed calls; it cannot establish execution. The core tool wrapper already owns actual execution and terminal-result classification. It now captures the current diagnostic owner immediately before invoking the tool and publishes successful settlement through the existing private semantic-progress event. The progress owner revalidates that exact registration before emission and again at FIFO delivery, including replacements that reuse a run ID.

Removed the proposed separate settlement-marker API, unrelated CLI/ACP/worker changes, and test-file lint exception. Public and trusted-plugin completion events remain mechanical activity. Original fix by @SunnyShu0925; maintainer cleanup narrows the repair to embedded execution and the existing progress owner, preserves exact ownership, and replaces the broad diagnostic matrix with a focused execution-boundary regression. Human issue feedback from @hippoley informed the execution/provenance distinction.

Evidence

Final head: 7b34d64114d384e886d333d108307dc542119ffa. All AWS checks below run sequentially on fresh secretless lease cbx_e02e47e6a9a3 (r7a.xlarge, 32,135,876 KiB RAM), runs run_416a9484ba9132a5b96d867689b0bfda and run_1535e75366dfdb1623058464f9f03a42. The clean trusted-main bootstrap verified the full SHA and IAM-credentials endpoint returning 404. No hydration or Tailscale; only CI environment forwarded. Contributor source never executed on the maintainer host.

Check Result Wall time
Production-only negative control Only the completed-tool case fails: expected 659000 to be undefined; four controls pass. Production restored and checked clean. 32.99 s
All 17 module/sibling files, --maxWorkers=1 339 tests pass across seven configurations 489.32 s
Standalone five-case regression, --maxWorkers=1 5/5 pass; 40 ms total case bodies 26.05 s
pnpm tsgo:core Pass 70.27 s
pnpm tsgo:core:test --ci-graphs-json '["core-test-agents-root","core-test-infra"]' Both covering graphs pass 118.27 s

The module wall time includes the existing E2E tests’ required 348.4 s runtime build. The focused regression is import-bound: cold compiled-worker preparation took 17.992 s. It uses fake time and exercises the production execution wrapper; a classifier-only fixture would miss the execution/owner defect. In CI, its five cases took 6/2/2/2/2 ms (14 ms total), and the owning 15-file/261-test shard passed in 25.17 s.

Real Gateway proof completed, using isolated state and ports, a local mock Responses provider, and the unchanged six-minute watchdog/thirty-second heartbeat. Each scripted response admits an async read before a ten-second tail ends with length.

Cell Observed tool results Outcome Node wall time
Main 0043bb028914 39 successful reads; 38 completed before matching length terminals False watchdog abort at 382 s stagnation, despite a read completing 1 s earlier; no final marker 456.83 s
Fix 7b34d64114d3 All 43 reads completed before matching length terminals Original run returns REL6_WATCHDOG_ALL_TOOLS_COMPLETED; no stalled classification or abort 480.92 s
Fix with missing files 38 failed reads, zero successful reads Watchdog still aborts and drains at 382 s; no final marker 459.87 s

Selected main recovery fields:

reason=repeated_model_requests_without_progress
lastProgress=tool:read:ended lastProgressAge=1s repeatedRequestNoProgressAge=382s
status=aborted action=abort_embedded_run aborted=true drained=true forceCleared=false

The error cell independently records the same abort-and-drain outcome. All three Gateway process trees were confirmed stopped; fixture error lists and cleanup error lists were empty. The successful fixed cell passed its assertions. The main command initially exited 1 on an extra assertion expecting agent.wait.status === "error"; its actual backend cancellation and transcript evidence were already recorded. Source inspection showed that a stalled chat dispatch can hand off recovery without terminal-outcome metadata and publish a generic ok settlement. That field does not establish successful model completion. Follow-up run run_1535e75366dfdb1623058464f9f03a42 verified the saved exact-head, same-session recovery record, matching submitted run, settled receipt, absent final marker, transcript ordering, and cleanup, then passed the live error cell. Cancellation assertions use the recovery owner’s explicit abort-and-drain facts and retain the RPC status verbatim. The original submitted run is distinguished from any automatic continuation. No runtime source or watchdog timing was changed for proof.

CI 37766464565 passed unit tests, production/test types, and all other executed jobs except one inherited main lint failure: src/agents/sessions/session-manager-model-context.test.ts:72 uses .sort() instead of .toSorted(). CI’s combined tree includes main 83421e15378489d0ba473a3cd653592bf424b3c0; that line comes from d8c8047cab63 and is absent from this PR head. Job 113276527062 and the aggregate CI gate are red for that inherited error. It is now fixed on main by d1d8b113cdf9. No unrelated source change or green-only rerun was made. Local formatting, targeted lint, and git diff --check pass. Fresh independent Codex autoreview is scoped-clean with no actionable P0–P2 findings.

ClawSweeper revision 9 reports no code findings. Earlier findings are resolved: the separate completion-marker path that lost object identity is removed; the existing emitter marks its final object. Successful execution captures the exact owner and FIFO delivery rejects a retired same-run-ID generation. The max-lines exception is removed.

The review’s main-integration concern was checked against its cited main 9c763cb168e9461f76e9c3a9059c7b38838a7d3b: git merge-tree --write-tree succeeds, producing tree 0a40481f66e1b0f216fbd5a324bb76980f695c37. Main’s wrapper change (cfee851150c5) extracts skill-usage reporting after execution. Inspection of the combined wrapper confirms progress capture still occurs before execution and successful settlement before that helper. The wrapper, classifier, progress owner, and recovery files are identical between that reviewed main and the live baseline 0043bb028914e6f92632623a99b482a8cd93b3b5. CI also tested the clean combined branch/main result. A final refresh against main b925148b83b7ebddb32e1dd68769d6588d16f800 also merges cleanly (tree b1f9e6a39f88079e2bfa8e4e9ae732485d7eefe8), with the relevant watchdog paths unchanged. A branch merge was unnecessary.

The five owner cases prove success/error/blocked and retirement during execution/before delivery through stall classification. They use the production six-minute threshold and the issue’s 659-second stagnation, with successful work 76 seconds before classification. The existing recovery integration separately drives heartbeat/recovery, observes the active operation’s abort signal, and verifies queued work is delivered once. Same-run-ID owner replacement remains controlled owner-level proof; the provider cannot manufacture that internal registration transition. No public control or test-only production seam was added to fabricate it.

An earlier fixed-head live attempt (a5280b, lease cbx_6b06fc9c786d) completed 43 reads and returned the marker, but its harness failed by rejecting five unrelated utility-model calls; main did not run. The source path and retry cadence matched Activity recaps. The corrected task fixture disables that optional route with the documented per-agent empty utilityModel, retaining strict primary-provider assertions. That attempt is not counted as a passing comparison. Its lease and the earlier unit-proof lease cbx_ab2338a77315 are released. Final proof lease cbx_e02e47e6a9a3 is also released; crabbox list --provider aws confirms no task-owned leases remain.

Production +82/-25 (+57), tests +127/-2 (+125), docs +1/-1 (0); total +210/-28 across eight files. The positive production delta is the work order’s LOC exception: exact owner capture, private provenance, and delivery-time validation are necessary; unrelated deletions would obscure the repair. The contributor’s follow-up classifier assertions are retained with corrected timing and narrower proof wording.

Exact unit, type, and Gateway commands

The negative control retains the new tests and reverses only the five production-file changes against merge base b9533fbd155b0d0b455b23825d9e3c32f3a1eb7a, requires the intended assertion failure, reapplies the production patch, and checks git diff --exit-code.

pnpm test src/agents/agent-tools.before-tool-call.progress.test.ts --maxWorkers=1
pnpm test \
  src/logging/diagnostic-run-activity.test.ts \
  src/logging/diagnostic-stuck-session-recovery.integration.test.ts \
  src/logging/diagnostic-backend-liveness.test.ts \
  src/logging/diagnostic-run-activity-owners.test.ts \
  src/agents/agent-tools.before-tool-call.integration.e2e.test.ts \
  src/agents/agent-tools.before-tool-call.voice-authority.test.ts \
  src/infra/diagnostic-events.test.ts \
  src/agents/agent-tools.before-tool-call.e2e.test.ts \
  src/agents/agent-tools.before-tool-call.approval-policy.test.ts \
  src/agents/agent-tools.before-tool-call.network-error.test.ts \
  src/agents/agent-tools.before-tool-call.progress.test.ts \
  src/agents/agent-tools.before-tool-call.decision.test.ts \
  src/agents/embedded-agent-runner/run/attempt.model-diagnostic-lifecycle.test.ts \
  src/agents/embedded-agent-runner/run/attempt.model-diagnostic-events.test.ts \
  src/agents/agent-tools.before-tool-call.diagnostics.test.ts \
  src/agents/agent-tools.before-tool-call.embedded-mode.test.ts \
  packages/agent-core/src/agent-loop.async-tools.test.ts \
  --maxWorkers=1
pnpm tsgo:core
pnpm tsgo:core:test --ci-graphs-json '["core-test-agents-root","core-test-infra"]'
OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build
node --import ./scripts/tsx.mjs /tmp/live-watchdog-proof.mjs fixed /tmp/rel6-166997-live-fixed
# Full main checkout, with its own frozen install and private-QA build:
node --import ./scripts/tsx.mjs /tmp/live-watchdog-proof.mjs main /tmp/rel6-166997-live-main
node /tmp/verify-watchdog-main.mjs
# Return to the fixed checkout:
node --import ./scripts/tsx.mjs /tmp/live-watchdog-proof.mjs failed /tmp/rel6-166997-live-failed

Timed commands use /usr/bin/time -p. The Gateway process, native async execution, transcript store, diagnostic owner, heartbeat, and recovery remain real; only the external model provider is synthetic. All Gateway state, files, and ports are isolated from operator state.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Oct 8, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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 Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 8, 2026, 8:23 AM ET / 12:23 UTC (Revision 10).

ClawSweeper review

What this changes

The branch counts successfully completed embedded tools as watchdog progress under their exact current run owner, independently of later response truncation.

Example: An agent completes asynchronous reads before the provider response ends with length.

  • Before: The recorded baseline aborts at 382 seconds of stagnation despite a read completing one second earlier.
  • After: The fixed run completes all 43 reads and returns REL6_WATCHDOG_ALL_TOOLS_COMPLETED without a stalled-run abort.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, worthwhile repair with real Gateway before/after evidence, meaningful negative controls, and no remaining actionable finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The updated body records the real Gateway, embedded execution, transcript, heartbeat, and recovery owners processing synthetic Responses traffic: successful async reads survive length termination and return the final marker, while failed reads still cause observed abort-and-drain. Exact-generation controls reject retirement during execution and before FIFO delivery; existing recovery coverage observes cancellation and queued delivery. These controls resolve the prior concern without claiming a live same-run-ID replacement replay. The proven owner/dispatcher blobs remain unchanged after main integration; the wrapper's subsequent skill-use extraction preserves progress ordering. No stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An agent can be stopped as stalled despite recently completing useful asynchronous tools.
Reason: The linked report establishes broken progress accounting, and the repair stays within the existing execution and watchdog owners. Prior area ownership and the recorded cleanup support this narrow direction.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary and is ready from this review: current main retains the defect, earlier code findings are resolved, and the updated Gateway evidence satisfies the behavior-proof gap.

Priority: P1
Reviewed head: b45e0a4512145960bea2224283d6ea627a3f0d64

Before merge

None.

Findings

None.

Agent review details

How this fits together

The embedded agent executes tools while provider responses stream. Its watchdog consumes progress observations to distinguish useful work from repeated requests and decide whether to cancel a stalled run.

flowchart TD
  A[Streaming provider response] --> B[Embedded tool execution]
  B --> C{Successful settlement?}
  C -->|Yes| D[Private progress event with captured owner]
  C -->|No| E[Keep stagnation evidence]
  D --> F{Exact owner still current?}
  F -->|Yes| G[Clear stagnation evidence]
  F -->|No| E
  E --> H[Existing watchdog recovery]
Loading

Technical review

Best possible solution:

Keep successful-execution accounting in the existing wrapper and progress owner, preserving failed-tool recovery and exact-generation retirement safeguards.

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

Yes: current source establishes the omission, and the recorded real Gateway baseline demonstrates successful reads followed by false watchdog cancellation. This read-only review did not execute target code.

Is this the best way to solve the issue?

Yes: recording validated settlement at the existing execution boundary repairs the cause without inferring execution from response shape or increasing watchdog timeouts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b33494d0dfdf.

Provenance checked

Testing

Proof path: shipped entry point. Added test files: 2.

Security

None.

Evidence

What I checked:

  • Execution-boundary repair: The wrapper captures progress ownership immediately before source execution and publishes only a completed terminal result whose signal is not aborted; error and blocked results do not take this path. (src/agents/agent-tools.before-tool-call.wrapper.ts:545, b45e0a451214)
  • Exact owner revalidation: Capture resolves the current registration; settlement revalidates it, and FIFO delivery revalidates the same owner object before clearing repeated-request evidence. The resolver also checks the generation installed at the owner's work key. (src/logging/diagnostic-run-activity.ts:152, b45e0a451214)
  • Private provenance remains unforgeable through event payloads: The core emitter marks the final emitted object in a private WeakMap. The trusted dispatcher consumes that identity once and carries the exact owner in internal metadata; ordinary and trusted-plugin payload fields cannot create this provenance. (src/infra/diagnostic-semantic-run-progress-provenance.ts:8, b45e0a451214)
  • Updated production Gateway comparison: The captured PR body, sourceRevision b30b2813834540f49c67a7c7d318bfe73ef220891a01ad6c6010cb719def9107, records isolated real Gateway runs using a local Responses provider and unchanged watchdog timing. Baseline completed reads still led to abort-and-drain at 382 seconds; fixed execution completed 43 reads and returned the final marker; the fixed missing-file control recorded 38 failed reads and actual abort-and-drain. The corrected baseline verification uses explicit recovery facts rather than treating generic agent.wait status as model completion. (7b34d64114d3)
  • Retirement controls and regression value: The five-case regression drives the production execution wrapper and FIFO dispatcher through successful, error, blocked, retired-during-execution, and retired-before-delivery outcomes. Retired cases reuse the run ID yet retain stalled classification. The body records a production-only negative control failing only the completed case. Existing recovery integration separately observes the active operation's abort signal and exactly-once queued delivery; retirement coverage is controlled owner-level evidence, not a claimed live replacement replay. (src/agents/agent-tools.before-tool-call.progress.test.ts:34, b45e0a451214)
  • Proof remains applicable after main integration: Tree inspection shows the progress test, dispatcher, provenance modules, and run-activity owner are blob-identical to the proven head. Reading the earlier wrapper through GitHub's blob API and inspecting the main commit confirms the wrapper difference is the skill-use helper cutover after progress publication. A local older-blob diff encountered a partial-clone HTTP 403; the read-only GitHub blob fallback supplied the relevant original content. (src/agents/agent-tools.before-tool-call.wrapper.ts:548, b45e0a451214)

Likely related people:

  • joshavant: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

PR surface

Source +57, Tests +125, Docs 0. Total +182 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 5 82 25 +57
Tests 2 127 2 +125
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 210 28 +182

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #166770
Summary: This PR is the candidate repair for the canonical completed-async-tool watchdog report.

Members:

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove merge-risk: 🚨 availability: Current PR review selected no merge-risk labels.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: The linked report and Gateway baseline establish premature cancellation of useful agent work.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-08T06:29:26.204Z sha 07fdd5ee8afb74d11e15fa3bc960b14a6aa20918 :: needs real behavior proof before merge. :: [P1] [P1] Require exact execution provenance before clearing stagnation
  • reviewed 2026-10-08T07:23:37.313Z sha 9c38827 :: needs real behavior proof before merge. :: [P1] [P1] Mark the final embedded completion object | [P1] [P1] Bind settlement to the exact current owner generation
  • reviewed 2026-10-08T07:34:12.008Z sha 9c38827 :: needs real behavior proof before merge. :: [P1] [P1] Mark the final emitted embedded completion object | [P1] [P1] Bind settlement to the exact current owner generation
  • reviewed 2026-10-08T08:38:45.356Z sha a5280bf897a68f6f2bd4d21e6e5059b2609dc725 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-08T08:55:30.876Z sha a5280bf897a68f6f2bd4d21e6e5059b2609dc725 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-08T10:14:05.230Z sha a5280bf897a68f6f2bd4d21e6e5059b2609dc725 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-08T10:33:27.156Z sha bb1345e :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-08T11:09:48.069Z sha 7b34d64 :: needs real behavior proof before merge. :: none

@SunnyShu0925
SunnyShu0925 force-pushed the fix/watchdog-completed-async-tools-166770 branch 2 times, most recently from 07fdd5e to fdaa564 Compare October 8, 2026 07:01
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M and removed size: S labels Oct 8, 2026
When a tool execution completes successfully under the current run owner,
clear repeated-request stagnation evidence so the watchdog does not abort
a run that recently did useful work. Previously, only model-call semantic
results could clear stagnation, so a response truncated by max_output_tokens
after successful async tool calls was treated as no progress.

Error and blocked tool terminals do not clear stagnation. Stale owner
events are rejected by runId comparison against the current embedded run.

Fixes openclaw#166770
@SunnyShu0925
SunnyShu0925 force-pushed the fix/watchdog-completed-async-tools-166770 branch from fdaa564 to 9c38827 Compare October 8, 2026 07:05
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Replace completion markers with exact owner provenance on the existing semantic-progress event. Capture before execution and validate at FIFO delivery; preserve failure and stale-owner stagnation. Drop unrelated backend changes and lint exceptions.

Co-authored-by: SunnyShu0925 <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S and removed gateway Gateway runtime scripts Repository scripts size: M labels Oct 8, 2026
@steipete steipete changed the title fix(logging): clear watchdog stagnation on completed tool execution fix(agents): prevent stalled-run aborts after completed async tools Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. label Oct 8, 2026
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@SunnyShu0925
SunnyShu0925 force-pushed the fix/watchdog-completed-async-tools-166770 branch from a5280bf to bb1345e Compare October 8, 2026 10:25
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@SunnyShu0925

SunnyShu0925 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

@steipete Thanks for the cleanup on this one. I pushed a small follow-up on top of your head to address the outstanding proof gap from the latest ClawSweeper review (Revision 6).

It's test-only (bb1345e7, +50/-3 in agent-tools.before-tool-call.progress.test.ts) — no production code changed. The five existing cases now also assert the watchdog's final cancellation decision via isRepeatedModelRequestStalled and classifySessionAttention at the issue's abort boundary, not just the intermediate repeatedRequestNoProgressAgeMs state:

  • completed tool → evidence cleared, watchdog does not stall
  • error / blocked / retired-during-execution / retired-before-delivery → evidence preserved, watchdog still stalls; the retired-before-delivery case covers the same-run-ID recovery negative

Verified with a pre-fix fail / post-fix pass negative control (reverting the repair makes the completed case fail at expected 659000 to be undefined).

A live Gateway replay wasn't run locally — the local provider can't reproduce the Responses async-tool length terminal semantics. PR body updated with the new evidence; everything you wrote is preserved.

Whenever you have a moment to take another look, that'd be great. No rush.

#166997

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 8, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 8, 2026
@steipete

steipete commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Landing qualification for exact head b45e0a4512145960bea2224283d6ea627a3f0d64 (the reviewed fix plus clean main integration).

The reliability campaign coordinator authorized the native inherited-failure exception for CI run 37775697435, attempt 1. The only failed jobs are the four UI shards below and their aggregate openclaw/ci-gate (job 113315207956):

  • Shard 1/9, job 113306404658: ui/src/e2e/chat-flow.stream-reconciliation.e2e.test.ts, 9 failures. Coordinator reproduced the same 9 on main b3196dfda3355; culprit af210e1f3fbfc (fix: Control UI shows run commentary twice during long tool runs #167054), whose parent passes 10/10.
  • Shard 2/9, job 113306404517: ui/src/e2e/chat-active-turn-recovery.e2e.test.ts, “preserves pre-steer commentary order through a full reload.” Coordinator reproduced 1 failure / 6 passes on main 89c01cd979efb; the same culprit's parent passes 7/7.
  • Shard 5/9, job 113306404470: ui/src/e2e/chat-flow.active-run-follow-ups.e2e.test.ts, 4 failures.
  • Shard 8/9, job 113306404478: ui/src/e2e/session-placement.move.e2e.test.ts, 1 failure. The coordinator reproduced these last two files together on main 89c01cd979efb (5 failures); the same culprit's parent passes 19/19.

The failed jobs all checked out merge c873997cde4b13ee44bc08266e264c218426240e, combining baseline d45c09ee13b4efb89e4858cdab7957c44d438276 with this exact PR head. This PR changes no UI files. The mocked Gateway UI scenarios do not execute the embedded tool wrapper or diagnostic progress path changed by this PR. Independent baseline reproduction and bisection establish the inherited cause; unchanged UI and harness inputs support that qualification.

All other executed exact-head checks passed, including lint, production/test types, Node test shards, security-fast, security review lanes, and the applicable Critical Quality lane. Skipped checks and neutral CodeQL are not claimed as passing coverage. The aggregate log attributes its failure solely to checks-ui-e2e.

ClawSweeper revision 10 reviewed this exact head at 2026-10-08T12:23:27.124Z: Ready for maintainer review; findings: none; fix scope: complete. The PR body's negative control, 339 tests across 17 files, type checks, and real Gateway comparison remain the coordinator's accepted behavior evidence. Successful asynchronous reads survive length; failed reads still abort and drain. No PR code was executed locally by this landing worker. CI remains failed and is not relabeled green.

@steipete
steipete merged commit 45447ea into openclaw:main Oct 8, 2026
144 of 150 checks passed
@steipete

steipete commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 9, 2026
…penclaw#166997)

* fix(logging): clear watchdog stagnation on completed tool execution

When a tool execution completes successfully under the current run owner,
clear repeated-request stagnation evidence so the watchdog does not abort
a run that recently did useful work. Previously, only model-call semantic
results could clear stagnation, so a response truncated by max_output_tokens
after successful async tool calls was treated as no progress.

Error and blocked tool terminals do not clear stagnation. Stale owner
events are rejected by runId comparison against the current embedded run.

Fixes openclaw#166770

* fix(agents): count completed tools under their live watchdog owner

Replace completion markers with exact owner provenance on the existing semantic-progress event. Capture before execution and validate at FIFO delivery; preserve failure and stale-owner stagnation. Drop unrelated backend changes and lint exceptions.

Co-authored-by: SunnyShu0925 <[email protected]>

* test(agents): use the current tool schema dependency

* test(agents): align watchdog replay with production timing

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: SunnyShu0925 <[email protected]>
RomneyDa pushed a commit that referenced this pull request Oct 11, 2026
…166997)

* fix(logging): clear watchdog stagnation on completed tool execution

When a tool execution completes successfully under the current run owner,
clear repeated-request stagnation evidence so the watchdog does not abort
a run that recently did useful work. Previously, only model-call semantic
results could clear stagnation, so a response truncated by max_output_tokens
after successful async tool calls was treated as no progress.

Error and blocked tool terminals do not clear stagnation. Stale owner
events are rejected by runId comparison against the current embedded run.

Fixes #166770

* fix(agents): count completed tools under their live watchdog owner

Replace completion markers with exact owner provenance on the existing semantic-progress event. Capture before execution and validate at FIFO delivery; preserve failure and stale-owner stagnation. Drop unrelated backend changes and lint exceptions.

Co-authored-by: SunnyShu0925 <[email protected]>

* test(agents): use the current tool schema dependency

* test(agents): align watchdog replay with production timing

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: SunnyShu0925 <[email protected]>
(cherry picked from commit 45447ea)
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 22, 2026
…penclaw#166997)

* fix(logging): clear watchdog stagnation on completed tool execution

When a tool execution completes successfully under the current run owner,
clear repeated-request stagnation evidence so the watchdog does not abort
a run that recently did useful work. Previously, only model-call semantic
results could clear stagnation, so a response truncated by max_output_tokens
after successful async tool calls was treated as no progress.

Error and blocked tool terminals do not clear stagnation. Stale owner
events are rejected by runId comparison against the current embedded run.

Fixes openclaw#166770

* fix(agents): count completed tools under their live watchdog owner

Replace completion markers with exact owner provenance on the existing semantic-progress event. Capture before execution and validate at FIFO delivery; preserve failure and stale-owner stagnation. Drop unrelated backend changes and lint exceptions.

Co-authored-by: SunnyShu0925 <[email protected]>

* test(agents): use the current tool schema dependency

* test(agents): align watchdog replay with production timing

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: SunnyShu0925 <[email protected]>
(cherry picked from commit 45447ea)
(cherry picked from commit 6d3c7ea)
Co-authored-by: RomneyDa <[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 docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

[Bug]: Watchdog ignores completed async tools when the enclosing response ends with length

2 participants