Skip to content

Recover stale embedded tool calls during gateway diagnostics#82369

Merged
joshavant merged 2 commits into
mainfrom
fix/issue-81976-diagnostic-recovery
May 16, 2026
Merged

Recover stale embedded tool calls during gateway diagnostics#82369
joshavant merged 2 commits into
mainfrom
fix/issue-81976-diagnostic-recovery

Conversation

@joshavant

Copy link
Copy Markdown
Contributor

Summary

  • Recover active embedded runs when diagnostics detect a stale native tool call that has exceeded the stuck-session abort threshold.
  • Keep gateway restart recovery from waiting indefinitely on active embedded runs while preserving the existing active-task drain budget.
  • Add focused regression coverage for stale native tool calls, recent active tool calls, and restart drain behavior.

Verification

  • node scripts/run-vitest.mjs src/logging/diagnostic-session-attention.test.ts src/logging/diagnostic.test.ts src/logging/diagnostic-stuck-session-recovery.runtime.test.ts src/cli/gateway-cli/run-loop.test.ts
  • codex review --uncommitted
  • git diff --check
  • OPENCLAW_LIVE_CODEX_HARNESS=1 OPENCLAW_LIVE_TEST_QUIET=0 node scripts/test-live.mjs -- src/logging/issue81976.tmp.live.test.ts

Behavior addressed: stale native tool calls inside active embedded runs can now be recovered by diagnostic abort once the tool/progress age exceeds the stuck-session abort threshold; gateway restart also caps active embedded-run drain before aborting those runs without shortening unrelated active-task drain.

Real environment tested: local live OpenClaw gateway with Codex live harness and real provider auth; direct live provider CLI probe also passed.

Exact steps or command run after this patch: node scripts/run-vitest.mjs src/logging/diagnostic-session-attention.test.ts src/logging/diagnostic.test.ts src/logging/diagnostic-stuck-session-recovery.runtime.test.ts src/cli/gateway-cli/run-loop.test.ts; codex review --uncommitted; git diff --check; OPENCLAW_LIVE_CODEX_HARNESS=1 OPENCLAW_LIVE_TEST_QUIET=0 node scripts/test-live.mjs -- src/logging/issue81976.tmp.live.test.ts

Evidence after fix: focused Vitest suite passed; Codex review found no actionable correctness issues after fixes; live gateway/provider synthetic recovery probe passed.

Observed result after fix: diagnostic recovery aborts the stale embedded run, and restart drain aborts active embedded runs after the configured grace while preserving normal active-task wait behavior.

What was not tested: full Telegram/provider E2E was not run. Broad changed check is blocked by an unrelated existing type failure in src/cron/isolated-agent.model-formatting.test.ts.

Fixes #81976

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: M maintainer Maintainer-authored PR labels May 16, 2026
@joshavant joshavant force-pushed the fix/issue-81976-diagnostic-recovery branch from fa74ada to e9b46e2 Compare May 16, 2026 00:29
@clawsweeper

clawsweeper Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: Recover stale embedded tool calls during gateway diagnostics This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@joshavant joshavant merged commit a1e208e into main May 16, 2026
113 of 114 checks passed
@joshavant joshavant deleted the fix/issue-81976-diagnostic-recovery branch May 16, 2026 00:37
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…w#82369)

* fix(gateway): recover stale embedded tool calls

* chore(changelog): note stale embedded tool recovery
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
…w#82369)

* fix(gateway): recover stale embedded tool calls

* chore(changelog): note stale embedded tool recovery
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
…w#82369)

* fix(gateway): recover stale embedded tool calls

* chore(changelog): note stale embedded tool recovery
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
…w#82369)

* fix(gateway): recover stale embedded tool calls

* chore(changelog): note stale embedded tool recovery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway can deadlock on nested openclaw sessions tool call; diagnostics report recovery=none

1 participant