openclaw - ✅(Solved) Fix [gongyung] Add a plugin-facing heartbeat and timeout timer seam for delegated tasks [1 pull requests, 4 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#68551Fetched 2026-04-19 15:10:09
View on GitHub
Comments
4
Participants
2
Timeline
8
Reactions
0
Author
Participants
Timeline (top)
commented ×4cross-referenced ×2closed ×1referenced ×1

jinon86/openclaw-plugin-a2a#6 remains blocked because the delegated-task runtime still relies on core-owned heartbeat / timeout scheduling and watchdog behavior.

Planning refs:

  • jinon86/openclaw-plugin-a2a#8
  • jinon86/openclaw-plugin-a2a/docs/migration-plan.md sections 1.2, 2.4, 3

Root Cause

Context

jinon86/openclaw-plugin-a2a#6 remains blocked because the delegated-task runtime still relies on core-owned heartbeat / timeout scheduling and watchdog behavior.

Fix Action

Fixed

PR fix notes

PR #68584: feat(plugins): add plugin-facing heartbeat and timeout timer seam for delegated tasks

Description (problem / solution / changelog)

Issue

Closes openclaw/openclaw#68551

Summary

Adds createDelegatedTaskWatchdog — a public seam that lets plugin-owned delegated-task code schedule heartbeat cadence and timeout cleanup without importing internal core timers directly.

Changes

src/plugins/delegated-task-watchdog.ts (new)

  • DelegatedTaskWatchdogConfig — taskId, heartbeatCadenceMs, optional deadlineAtMs, onHeartbeat, onTimeout callbacks
  • DelegatedTaskWatchdogHandle.cancel(), .destroy(), .extend(newDeadlineAtMs), .active, .taskId
  • Explicit teardown: no orphan timers after cancel/destroy
  • Timers are .unref()'d to avoid blocking event loop exit
  • Handler errors are caught and logged — never crash the watchdog loop

src/plugins/delegated-task-watchdog.test.ts (new)

  • 13 test cases:
    1. Rejects invalid heartbeatCadenceMs
    2. Fires heartbeat ticks at configured cadence
    3. Fires onTimeout when deadline is reached
    4. Stops heartbeat after timeout fires
    5. cancel() stops all timers without firing onTimeout
    6. destroy() fires onTimeout with reason "manual"
    7. destroy() is idempotent — onTimeout fires at most once
    8. cancel() is idempotent
    9. extend() moves the deadline forward
    10. extend() with past deadline fires timeout immediately
    11. extend() is a no-op after cancel
    12. Reports remainingMs correctly with deadline
    13. Survives onHeartbeat handler throwing
    14. Survives onTimeout handler throwing

src/plugins/runtime/types.ts (modified)

  • Added createTaskWatchdog method to PluginRuntime type
  • Imports DelegatedTaskWatchdogConfig and DelegatedTaskWatchdogHandle

Design Decisions

  • Factory pattern rather than a class — keeps it functional, easier to test and mock
  • Unref timers — mirrors core-internal timer behavior for agent waits
  • Error boundary around callbacks — a bad plugin callback never poisons the watchdog
  • extend() — supports long-running tasks that need deadline extension mid-flight

Done When (from issue)

  • Plugin-owned delegated-task code can schedule and cancel watchdog behavior through a public seam
  • Timeout and heartbeat behavior can be exercised in tests without private core imports
  • Cleanup behavior is explicit and covered by tests

Changed files

  • src/plugins/delegated-task-watchdog.test.ts (added, +260/-0)
  • src/plugins/delegated-task-watchdog.ts (added, +199/-0)
  • src/plugins/runtime/types.ts (modified, +15/-0)
RAW_BUFFERClick to expand / collapse

Owner

gongyung

Context

jinon86/openclaw-plugin-a2a#6 remains blocked because the delegated-task runtime still relies on core-owned heartbeat / timeout scheduling and watchdog behavior.

Planning refs:

  • jinon86/openclaw-plugin-a2a#8
  • jinon86/openclaw-plugin-a2a/docs/migration-plan.md sections 1.2, 2.4, 3

Scope

  • add a plugin-facing timer/watchdog seam for delegated tasks
  • support heartbeat cadence and timeout cleanup without plugin code importing internal core timers directly
  • preserve current delegated-send semantics for announceTimeoutMs and related watchdog behavior until the runtime move lands
  • keep teardown/cleanup explicit so no orphan timers remain

Done when

  • plugin-owned delegated-task code can schedule and cancel watchdog behavior through a public seam
  • timeout and heartbeat behavior can be exercised in tests without private core imports
  • cleanup behavior is explicit and covered by tests

Reporting

Use issue comments only for Start, Block, and Done. Open the PR directly once the scope is satisfied.

extent analysis

TL;DR

Implement a plugin-facing timer/watchdog seam to allow delegated tasks to schedule and cancel watchdog behavior without relying on core-owned heartbeat/timeout scheduling.

Guidance

  • Introduce a public API or interface for plugins to interact with the timer/watchdog system, allowing them to schedule and cancel timeouts and heartbeats.
  • Update the delegated-task runtime to use this new API, ensuring that plugin code no longer imports internal core timers directly.
  • Develop tests to exercise the new timeout and heartbeat behavior, verifying that cleanup is explicit and correct.
  • Review the migration plan and related documentation to ensure a smooth transition to the new system.

Example

No specific code example can be provided without more context, but the new API might include methods like scheduleTimeout and cancelTimeout for plugins to manage their own timeouts.

Notes

The solution requires careful consideration of the existing delegated-send semantics and watchdog behavior to ensure a seamless transition. The new API should be designed to preserve the current behavior until the runtime move is completed.

Recommendation

Apply workaround by introducing the plugin-facing timer/watchdog seam, as this will allow for a more modular and maintainable system, and pave the way for the eventual runtime move.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING