Skip to content

[Bug]: Public cron declarations can impersonate migrated heartbeat tasks #123728

Closed

Description

@steipete

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Public automation creation accepts declaration keys beginning with heartbeat-task:, causing an ordinary main-session system event to be treated as a doctor-migrated heartbeat task.

Steps to reproduce

  1. Start an isolated Gateway with heartbeat disabled.
  2. Create a recurring main-session systemEvent automation whose declaration key begins with heartbeat-task:.
  3. Force the automation to run.
  4. Observe that cron reports success and requests a heartbeat-task wake instead of enqueueing the normal system event.

Expected behavior

Only the system-owned heartbeat-task migration path may create jobs in the reserved heartbeat-task: declaration namespace. Ordinary public declarations should be rejected before persistence.

Actual behavior

The public declaration is persisted. Prefix-based runtime classification routes it through the guarded heartbeat wake path and reports success even when heartbeat is disabled, so the normal system-event delivery path is bypassed.

OpenClaw version

Current main before the fix; reproduced at 493a3e46b3f2921269cfb0af5dfc86efb569ceaa. The affected files were unchanged through 2bc1699a37fb957fe8e80c0cd4a087d4b3c279c6.

Operating system

macOS 26 focused reproduction; Ubuntu 24.04 isolated Gateway confirmation.

Install method

Source checkout with built CLI and isolated Gateway state.

Model

N/A (scheduler-only path; no model invoked)

Provider / routing chain

N/A (local CLI → local Gateway cron service)

Additional provider/model setup details

N/A

Logs

AssertionError: promise resolved instead of rejecting
Received declarationKey: heartbeat-task:main:<redacted-hash>

The pre-fix service run then enters the heartbeat-task branch, calls the heartbeat wake queue, skips normal main-session event enqueueing, and returns an ok cron result.

Screenshots, recordings, and evidence

Focused pre-fix regression and an isolated built CLI/Gateway proof are available in the linked repair PR.

Impact and severity

Affected: operators or automation callers using a reserved-looking declaration key.

Severity: medium; the automation reports success while its normal system event is not delivered.

Frequency: deterministic for matching main-session systemEvent declarations.

Consequence: silent automation non-delivery, especially when heartbeat is disabled.

Additional information

The clean repair belongs at cron creation ownership: reserve the namespace through the existing systemOwned service authority while keeping already-migrated rows executable, editable, and removable. No Gateway schema, public config, protocol, or storage change is required.

Activity

  1. self-assigned this
    on Aug 14, 2026
  2. added
    bug
    on Aug 14, 2026
  3. added
    maintainer
    on Aug 14, 2026
  4. added
    clawsweeper:linked-pr-open
    clawsweeper:no-new-fix-pr
    clawsweeper:source-repro
    impact:other
    issue-rating: 🦞 diamond lobster
    P1
    on Aug 14, 2026
  5. clawsweeper commented on Aug 14, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed August 14, 2026, 12:22 PM ET / 16:22 UTC.

    Summary
    Keep open: current main accepts the reserved prefix, classifies it as a heartbeat task at execution, and bypasses normal system-event delivery. The open linked repair PR owns the focused fix, while the protected maintainer label prevents automatic closure or duplicate repair dispatch.

    Reproducibility: yes. —source inspection provides a high-confidence path: create a main-session system-event cron job with a heartbeat-task: declaration key, force-run it, and observe the earlier heartbeat-task branch.

    Root-cause cluster
    Relationship: canonical
    Canonical: #123728
    Summary: This issue is the canonical report, and the linked open PR is its candidate fix.

    Members:

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

    Next step
    The linked open PR already owns the narrow repair, and the protected maintainer label keeps this issue out of automatic fix and close lanes.

    Review details

    Best possible solution:

    Land the linked repair after PR-specific review confirms only system-owned migration calls can create the reserved prefix while existing migrated rows remain manageable.

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

    Yes—source inspection provides a high-confidence path: create a main-session system-event cron job with a heartbeat-task: declaration key, force-run it, and observe the earlier heartbeat-task branch.

    Is this the best way to solve the issue?

    Yes—the linked repair addresses creation ownership, the boundary that can reject untrusted reserved keys before persistence while preserving doctor-migrated rows.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • Until the linked repair lands, a public matching declaration can report a successful cron run while silently bypassing normal system-event delivery.

    Codex review notes: model internal, reasoning high; reviewed against 2b31cf114ba4.

    Label changes

    Label changes:

    • add P1: A deterministic current-main cron path silently suppresses a scheduled main-session event while reporting success.
    • add impact:other: The concrete impact is silent automation non-delivery, which does not map cleanly to the more specific issue impact classes.
    • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
    • add clawsweeper:source-repro: Current issue advisory state selects this label.
    • add clawsweeper:linked-pr-open: Current issue advisory state selects this label.
    • add clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.

    Label justifications:

    • P1: A deterministic current-main cron path silently suppresses a scheduled main-session event while reporting success.
    • impact:other: The concrete impact is silent automation non-delivery, which does not map cleanly to the more specific issue impact classes.
    Evidence reviewed

    What I checked:

    Likely related people:

    • Ayaan Zaidi: The latest locally available history for the timer execution path is a heartbeat-focused change by this contributor. (role: recent heartbeat-path contributor; confidence: medium; commits: 7fcddedaaf63; files: src/cron/service/timer-execution.ts)
    • steipete: Authored the source-backed report and the linked open repair PR for this exact owner boundary. (role: reporter and repair author; confidence: high; commits: ba8d34954d3e; files: src/cron/heartbeat-task.ts, src/cron/service/ops-mutations.ts, src/cron/service.heartbeat-payload.test.ts)
    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.
  6. steipete commented on Aug 14, 2026

    @steipete
    ContributorAuthor

    Fixed on main by PR #123729, merged as ffd42dd.

    The cron creation owner now rejects public heartbeat-task: declaration keys before persistence unless the caller has the existing system-owned authority. Migrated rows remain executable, editable, and removable.

    Proof: 14 focused cron/migration tests, the exact five-path changed gate, full build, isolated built CLI/Gateway behavior with heartbeat disabled, clean immutable autoreview, ClawSweeper with no findings, and green exact-head CI run https://github.com/openclaw/openclaw/actions/runs/31818553650.

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

Metadata

Metadata

Assignees

Labels

P1bugclawsweeper:linked-pr-openclawsweeper:no-new-fix-prclawsweeper:source-reproimpact:otherissue-rating: 🦞 diamond lobstermaintainer

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions