Skip to content

refactor(async): deslop retry, timeout, and abort handling - #164278

Merged
steipete merged 4 commits into
mainfrom
deslop/x01-retry-timeout-abort-20261002
Oct 3, 2026
Merged

steipete merged 4 commits into
mainfrom
deslop/x01-retry-timeout-abort-20261002

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Retry, timeout, and cancellation flows had accumulated separate timer races, abort listeners, and one-use wait wrappers across core, plugins, packages, and the UI.

User Impact

No intended user-visible behavior change. Timeout values, retry counts and delays, error identities, cancellation ordering, and resource-settlement requirements stay with their existing owners. No configuration, persisted-data, protocol, or dependency changes are required.

Why This Change Was Made

This coherent batch removes 1,020 net production lines (+1,131 / −2,151), excluding tests, fixtures, docs, and generated files.

  • Make the dependency-free retry package the owner of observation-only timeout races and abort-listener cleanup. Callers retain their existing result/error, timer reference policy, and timer-before-work ordering.
  • Share the numeric and options retry attempt loop while preserving the numeric overload's zero-delay yield and delay normalization.
  • Replace matching local sleep and signal-forwarding implementations with existing timer primitives and signal composition. Specialized authority checks, fencing, physical cleanup, and settlement barriers remain with their original owners.
  • Route bundled plugins through the existing local-only time-runtime SDK entrypoint and document the wait semantics.
  • Delete the unused chat-metadata startup-retry mode and queued retry deadlines. Its last production caller was removed in feat(models): read session catalogs directly in the Control UI #142165; normal revalidation, publication, and queue behavior remain covered.

Fixes Found Along the Way

Two IRC tests raced real cold SQLite admission against arbitrary three-second completion guards. They now await their existing durable-write events within Vitest's cancellation signal, preserving cold admission, real TCP, every assertion, and finally cleanup. No timeout or retry limit was raised. A temporary mutation that silently accepted a sanitized-empty send still failed the original error assertion in about one second. The iMessage durable-delivery fixture now strictly expects the host media-access owner’s existing openFile capability while retaining all delivery, reader-identity, and no-replay assertions.

Evidence

  • Independent Codex autoreview of the full batch and follow-ups: no actionable P0–P2 findings. The final rebase was conflict-free and changed only surrounding test-import context.
  • Retry/abort owner tests: 73 passed on macOS and Linux (Node 24.21.0); the three-file runs took 29.65 seconds and 8.81 seconds, respectively. Local fallback preceded recovery of the remote provider.
  • Full build passed on Hetzner. Canonical matched-base UI performance comparison passed: startup JavaScript 373,250 bytes gzip, below the 373,454-byte enforced allowance. No visual UI changes.
  • Plugin contracts: 48 files / 1,132 tests passed. SDK API diff: no public export additions/removals or signature changes; only reachable declarations changed in the initial comparison; later repairs changed parameter names and annotations, not supported call signatures.
  • All 155 selected focused-test files passed. After the final rebase, pnpm test <13 affected files> --maxWorkers=1 passed 386 tests in 435.77 seconds across ten project shards; this includes the five edited test files. The standalone IRC shard took 38.03 seconds including cold transforms.
  • IRC completion cases: 21 Linux iterations each passed (--repeats 20), with no retries masking failures; the 42-run stability cell took 42.76 seconds.
  • Both import-cycle checks reported zero on the final head, and all 1,132 plugin contract tests passed again there.
  • CI exposed a widened timeout sentinel, shadowed callback names, a board retry-state lint diagnostic, and use of an ES2024 test declaration outside that test target. These are repaired without changing runtime timing or rejection identity. Focused lint, package/extension test types, and repair tests passed on Linux; the board loop is byte-identical to its pre-refactor implementation.
  • The repaired iMessage suite passed all 19 tests (pnpm test extensions/imessage/src/test-plugin.test.ts --maxWorkers=1, 63.38 seconds wall time including cold worker transforms). Independent review of both repair commits found no actionable P0–P2 findings.
  • The broad changed-file pass completed ratchets, boundaries, architecture, production core types, and 17 core-test type shards before finding the now-repaired package test declaration mismatch. Its failed inputs were checked directly; the entire broad command was not repeated. Hosted CI remains the final gate.

Linux remote proof commands included pnpm install --frozen-lockfile, node scripts/run-vitest.mjs <focused files>, both import-cycle checks, node scripts/check-changed.mjs, pnpm build, pnpm ui:check-performance:base <base>, and the canonical Plugin SDK API diff tool. Hosted CI must run on the exact pushed head.

Coordinator Verification

The previous compaction failure was reproduced on a clean pre-fix main checkout (d0ce76b7a3087a94b710110646b1a14b7e30665e): 1 failed, 11 passed, with Cannot add property providerReplay, object is not extensible. Clean current main (6cae5628b09a2e3893a02dc018f182ba6442e854) passes all 12 tests because main independently landed 60e849f1a4aa, which seeds replay metadata before appending the session message. No change or cherry-pick from #163471 is included.

A conflict-only rebase retains main's complete native-session authority/settlement and MCP App lifecycle changes; the conflict resolutions add only the shared sleep import and the bounded teardown helper. Eight focused files (189 tests) and both cycle checks passed on the verified candidate source tree. The contract suite passed 1,131 tests and found one inherited Codex fixture classification failure; that exact case also reproduces on clean current main, with the fixture, scanner, and package manifest unchanged by this PR.

The fresh review's startup-retry concern was rejected after checking all production callers: neither passes startupRetryWindowMs, and the last production opt-in caller was removed by #142165. The removed branch is test-only behavior; ordinary metadata requests retain the same path.

@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nostr Channel integration: nostr channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web app: web-ui App: web-ui gateway Gateway runtime extensions: lobster Extension: lobster extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb cli CLI command changes commands Command implementations agents Agent runtime and tooling channel: feishu Channel integration: feishu channel: twitch Channel integration: twitch channel: irc extensions: acpx extensions: anthropic extensions: minimax extensions: qa-lab extensions: codex plugin: google-meet plugin: file-transfer labels Oct 3, 2026
@clawsweeper clawsweeper Bot added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Oct 3, 2026
@steipete
steipete disabled auto-merge October 3, 2026 17:26
@steipete
steipete force-pushed the deslop/x01-retry-timeout-abort-20261002 branch from 3a118d6 to de85ebc Compare October 3, 2026 18:43
@steipete
steipete force-pushed the deslop/x01-retry-timeout-abort-20261002 branch from de85ebc to 3d5f935 Compare October 3, 2026 19:08
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Coordinator-requested baseline verification, using clean isolated Linux checkouts and the repository test runner:

node scripts/run-vitest.mjs src/agents/embedded-agent-runner/server-endpoint-compaction.test.ts

Before the independently landed fixture repair, clean main commit d0ce76b7a3087a94b710110646b1a14b7e30665e reproduced the exact failure:

Test Files  1 failed (1)
Tests       1 failed | 11 passed (12)
FAIL leaves a missing canonical checkpoint window to client budget compaction
TypeError: Cannot add property providerReplay, object is not extensible
  packages/ai/src/transports/openai-responses-compaction-replay.ts:127:10
  src/agents/embedded-agent-runner/server-endpoint-compaction.test.ts:255:5

Clean origin/main fetched as 6cae5628b09a2e3893a02dc018f182ba6442e854 passed:

Test Files  1 passed (1)
Tests       12 passed (12)

Both checkouts had empty Git status before the command and no source edits. Main had already landed 60e849f1a4aa2101382883e91e97f87aaf297451 (test(agents): seed compaction replay before session append), which constructs replay metadata before the session owner freezes its snapshot. This establishes pre-existing fixture drift, not a producer or security regression in this PR. No code or commit was taken from #163471.

The required conflict-only rebases retained main's native-session authority and MCP App lifecycle changes and dropped the now-duplicated iMessage fixture commit. Net production reduction remains 1,020 lines.

An additional contract failure also reproduces on clean main 6cae5628b09a2e3893a02dc018f182ba6442e854:

node scripts/run-vitest.mjs src/plugins/contracts/extension-runtime-dependencies.contract.test.ts -t "extensions/codex declares every runtime package import"
Test Files  1 failed (1)
Tests       1 failed | 486 skipped (487)
Received: { vitest: ["extensions/codex/native-session-binding.test-api.ts"] }
Expected: {}

That fixture module, dependency scanner, and Codex package manifest are unchanged by this PR.

Exact-head hosted CI completed for 3d5f935c1250042b4405487cbcc047d548092333: run 37146823166. All security checks passed. The two failed jobs, plus their downstream CI gate, contain these independently reproduced main failures:

  1. checks-node-compact-small-1: test/scripts/tsdown-runtime-config.test.ts expects no schema-inlining plugin for a graph that main now includes in the standalone executable registry. Clean main 6b230c82fc52161e644b9e94c17dd30ccc680b72 reproduces it:

    node scripts/run-vitest.mjs test/scripts/tsdown-runtime-config.test.ts
    Test Files  1 failed (1)
    Tests       1 failed | 32 passed (33)
    AssertionError: expected [ 'openclaw:inline-state-schemas' ] to have a length of +0 but got 1
    

    Main commit 99fccf43358c added the heartbeat worker to the executable registry; the test's explicit expected graph set omitted it. This PR changes neither the test nor the configuration/registry owners.

  2. checks-node-changed-extensions-bundle-1-2: Copilot bridge fixtures assume raw tool ordering before main's Tool Search presentation. The exact main parent used by CI, 7e3ba7fd8286b1ba038f6519db795c6ab05284c2, reproduces the same 11 failures:

    node scripts/run-vitest.mjs extensions/copilot/src/tool-bridge.test.ts
    Test Files  1 failed (1)
    Tests       11 failed | 28 passed (39)
    expected web_fetch to be defined
    expected [tool_search, tool_describe, tool_call, read] to deeply equal [read]
    

    Main commit ba8cb920a6f synthesizes Tool Search controls; the fixture selects tools[0], now tool_search. The quarantine-named case fails finding web_fetch before it exercises quarantine. The bridge, fixtures, and Tool Search presentation owners are unchanged by this PR; this batch's Copilot receipt/cleanup timers are not invoked by those fixtures.

Both reproductions used clean isolated main checkouts, without editing tests or producers. No failing check is being relabeled as passing. Under the coordinator's explicit instruction, proceeding with an admin squash pinned to the API head after posting this evidence.

Maintainer compatibility confirmation for the automated review checklist: no user configuration keys/defaults, schemas, retained fields, migrations, or storage formats change. The Mattermost backfill and memory corpus/embedding hunks only consolidate existing timeout/abort plumbing; their data owners and timing policies remain intact. The private UI retry option has no production opt-in caller. The review itself found no correctness/security defect or stored-data contract change; the filename/truncated-inventory checklist flags do not identify a compatibility change.

@steipete
steipete merged commit ab4d26a into main Oct 3, 2026
192 of 196 checks passed
@steipete
steipete deleted the deslop/x01-retry-timeout-abort-20261002 branch October 3, 2026 19:50
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
…164278)

Consolidate matching retry, timeout, and abort plumbing through shared owners while preserving timing, retry counts, error identity, and cleanup barriers. Remove the unused metadata startup-retry mode.

Focused behavior and cycle checks passed. Exact-head CI completed with independently reproduced main fixture/build-test failures; baseline commands, output, and maintainer-authorized admin landing evidence are recorded in the PR.

Net production reduction: 1,020 lines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: imessage Channel integration: imessage channel: irc channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nostr Channel integration: nostr channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: twitch Channel integration: twitch channel: whatsapp-web Channel integration: whatsapp-web cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: acpx extensions: active-memory extensions: anthropic extensions: browser extensions: clickclack extensions: codex extensions: copilot extensions: github-copilot extensions: lobster Extension: lobster extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb extensions: minimax extensions: ollama extensions: qa-lab gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: facetime FaceTime plugin plugin: file-transfer plugin: google-meet rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: XL 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.

1 participant