Skip to content

fix(ui): load heartbeat scratch into the read-only monitor field - #135508

Merged
obviyus merged 5 commits into
openclaw:mainfrom
gaoanze888:fix/heartbeat-scratch
Sep 2, 2026
Merged

obviyus merged 5 commits into
openclaw:mainfrom
gaoanze888:fix/heartbeat-scratch

Conversation

@gaoanze888

@gaoanze888 gaoanze888 commented Sep 1, 2026 •

Copy link
Copy Markdown

Closes #135457

What Problem This Solves

The Control UI showed an empty Heartbeat monitor field for every heartbeat automation, even when the Gateway already held private per-job scratch. The command-line interface showed the stored scratch correctly.

jobToForm projects text from public cron payloads. A heartbeat payload has no text because its monitor instructions live in private scratch. The page never called the existing cron.scratch.get method, so the read-only field always received the empty fallback.

Fix

  • Fetch scratch once when an administrator selects a heartbeat automation.
  • Keep the result in ephemeral page display state, outside CronFormState and all add or update payloads.
  • Revalidate the Gateway connection, selected job, request generation, heartbeat payload kind, and current administrator access after the request resolves.
  • Clear display state when the connection, access, selection, or panel changes.
  • Show scratch-read failures instead of presenting a false empty success state.
  • Keep cron.scratch.get at operator.admin and keep scratch out of cron.list, cron.get, and CronJob.

Command, script, and skill-review automation payloads still use their existing read-only projection.

Evidence

Baseline main: 2837afb07dc9faa27f631760b5f4de9dbb8de940

Sanitized real-Gateway screenshot and observation: #135508 (comment)

  • Red, real Gateway: existing heartbeat scratch was returned by the Gateway, but the Control UI field stayed empty and sent no cron.scratch.get request.
  • Green, real Gateway: the field displayed the exact stored scratch and remained read-only.
  • The green observation recorded one cron.scratch.get, an empty mutable payloadText, and no scratch in cron.list or cron.get.
  • Mock browser end-to-end tests cover the visible authorized result, the read-only operator path, and a visible read failure: 3 passed.
  • The cron page unit suite covers an in-flight administrator-to-read-only downgrade: 35 passed.
  • Real-Gateway browser end-to-end proof: 1 passed.
  • Oxfmt, Oxlint, and git diff --check passed.

Production: +56/-3. Tests and test support: +172/-10.

Regression provenance

PR #112967 introduced private heartbeat scratch without changing the existing UI projection. PR #130030 later made the empty projection explicit with the Heartbeat monitor label.

AI assistance

AI-assisted repair and validation. A maintainer independently inspected the storage owner, Gateway authorization, protocol schemas, UI projection and save boundaries, sibling payload kinds, tests, docs, history, and real browser behavior.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 9:53 AM ET / 13:53 UTC.

ClawSweeper review

What this changes

The PR fetches a selected heartbeat automation’s private scratch for administrators and displays it in the Control UI’s read-only monitor without adding it to editable cron form data.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

The PR remains necessary: current main still leaves heartbeat monitor content empty. The updated branch correctly uses the existing admin-only RPC, rechecks access and selection after the request, and addresses the prior proof requirements; no blocking patch defect was found.

Priority: P2
Reviewed head: 60ce14fc1add86cad527951369b68806b81691cf

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-covered UI repair with exact-head real-Gateway evidence and no remaining actionable correctness finding.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): An exact-head real-Gateway observation shows stored scratch in the selected read-only monitor, with one scratch read and no mutable-form or public-list/get exposure; focused browser and downgrade tests cover the same production owner’s authorization boundary.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): An exact-head real-Gateway observation shows stored scratch in the selected read-only monitor, with one scratch read and no mutable-form or public-list/get exposure; focused browser and downgrade tests cover the same production owner’s authorization boundary.
Evidence reviewed 6 items Current-main gap: Current main projects only public payload text; heartbeat falls through to an empty value, and the page selection path does not request scratch.
Existing authorization contract: The Gateway already advertises cron.scratch.get as operator.admin, distinct from public cron reads at operator.read.
Authorized UI boundary: The introduced selection path clears prior scratch, captures the Gateway connection, checks administrator access before the request, and revalidates connection, access, selected job, payload kind, and request generation before rendering a response.
Findings None None.
Security None None.

How this fits together

The Control UI reads cron job metadata from the Gateway, but heartbeat instructions are kept in separately authorized private scratch. This change bridges that authorized read into ephemeral UI display state while preserving the normal cron save payload boundary.

flowchart LR
  A[Administrator selects heartbeat job] --> B[Control UI cron page]
  B --> C{Administrator access}
  C -->|yes| D[Gateway scratch read]
  C -->|no| E[Empty read-only monitor]
  D --> F[Ephemeral display state]
  F --> G[Heartbeat monitor]
Loading

Before merge

  • Resolve merge risk (P2) - This bug fix adds production state-management code (+56/-3); the localized request-generation and ownership checks are warranted because no existing page abstraction tracks selection, connection, and authorization lifetime together.
Agent review details

Security

None.

PR surface

Source +53, Tests +162. Total +215 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 56 3 +53
Tests 3 172 10 +162
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 228 13 +215

Review metrics

Metric Value Why it matters
Production versus test delta production +56/-3; tests and test support +172/-10 The production growth implements the required selection-, connection-, and scope-bound display read, with focused coverage for authorized, denied, failed, and downgraded states.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #135457
Summary: This PR is the concrete candidate fix for the linked Control UI heartbeat-scratch display bug.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the localized administrator-gated display read after normal exact-head CI gates complete; retain private scratch outside CronFormState and public cron responses.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the localized administrator-gated display read after normal exact-head CI gates complete; retain private scratch outside CronFormState and public cron responses.

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

Yes. The supplied real-Gateway baseline and current-main source both show that heartbeat scratch exists but the selected Control UI monitor receives the empty public-payload fallback.

Is this the best way to solve the issue?

Yes. Reusing the existing admin-only Gateway method and storing its result only in selection-scoped display state fixes the missing projection without widening public job data or creating a second persistence path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 645c0ac609ab.

Labels

Label changes:

  • add P2: The repair fixes a misleading operator-facing monitor while leaving heartbeat execution and stored scratch unchanged.
  • add proof: sufficient: Contributor real behavior proof is sufficient. An exact-head real-Gateway observation shows stored scratch in the selected read-only monitor, with one scratch read and no mutable-form or public-list/get exposure; focused browser and downgrade tests cover the same production owner’s authorization boundary.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): An exact-head real-Gateway observation shows stored scratch in the selected read-only monitor, with one scratch read and no mutable-form or public-list/get exposure; focused browser and downgrade tests cover the same production owner’s authorization boundary.
  • remove P1: Current review triage priority is P2, so this older priority label is no longer current.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review selected no merge-risk labels.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: The repair fixes a misleading operator-facing monitor while leaving heartbeat execution and stored scratch unchanged.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): An exact-head real-Gateway observation shows stored scratch in the selected read-only monitor, with one scratch read and no mutable-form or public-list/get exposure; focused browser and downgrade tests cover the same production owner’s authorization boundary.
  • proof: sufficient: Contributor real behavior proof is sufficient. An exact-head real-Gateway observation shows stored scratch in the selected read-only monitor, with one scratch read and no mutable-form or public-list/get exposure; focused browser and downgrade tests cover the same production owner’s authorization boundary.

Evidence

What I checked:

  • Current-main gap: Current main projects only public payload text; heartbeat falls through to an empty value, and the page selection path does not request scratch. (ui/src/lib/cron/index.ts:921, 645c0ac609ab)
  • Existing authorization contract: The Gateway already advertises cron.scratch.get as operator.admin, distinct from public cron reads at operator.read. (src/gateway/methods/core-descriptors.ts:321, 645c0ac609ab)
  • Authorized UI boundary: The introduced selection path clears prior scratch, captures the Gateway connection, checks administrator access before the request, and revalidates connection, access, selected job, payload kind, and request generation before rendering a response. (ui/src/pages/cron/cron-page.ts:299, 60ce14fc1add)
  • No mutable-form leak: The rendering layer uses heartbeatScratch only for heartbeat display while CronFormState remains the value passed to save operations. (ui/src/pages/cron/view.ts:1381, 60ce14fc1add)
  • Boundary regressions: New browser coverage verifies the authorized read-only display, no request from a read-only operator, and visible read failure; the page test covers an in-flight administrator-to-read-only downgrade. (ui/src/e2e/cron-heartbeat-scratch.e2e.test.ts:48, 60ce14fc1add)
  • Exact-head real behavior proof: The supplied exact-head comment records a real Gateway with existing scratch, an exact read-only monitor value, one scratch read, empty mutable payloadText, and no scratch in public cron responses. (60ce14fc1add)

Likely related people:

  • Peter Steinberger: 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)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-01T19:50:35.471Z sha 33beb21 :: needs real behavior proof before merge. :: [P2] Gate the scratch read for read-only operators
  • reviewed 2026-09-01T20:14:35.350Z sha 48cbb2b :: needs real behavior proof before merge. :: [P1] Recheck admin access before applying scratch

@gaoanze888

This comment was marked as spam.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed P2 Normal backlog priority with limited blast radius. labels Sep 1, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: M triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed size: S labels Sep 2, 2026
@obviyus

obviyus commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Real Control UI proof on exact head 60ce14fc1add86cad527951369b68806b81691cf:

Heartbeat monitor showing stored scratch

  • A real Gateway started with existing heartbeat scratch.
  • The selected Heartbeat monitor field showed the exact stored content and remained read-only.
  • The mutable cron form kept payloadText: "".
  • The page sent one cron.scratch.get request.
  • cron.list and cron.get contained no scratch.
  • The same current-main scenario showed an empty field and sent no scratch request.

Sanitized green observation:

{
  "actualValue": "# Live heartbeat checklist\n\n- Inspect queued work.\n",
  "mutablePayloadText": "",
  "readOnly": "",
  "sentMethods": ["cron.scratch.get", "cron.runs"],
  "publicListContainsScratch": false,
  "publicGetContainsScratch": false
}

Focused validation: cron page 35 passed; mock browser 3 passed; real-Gateway browser 1 passed; Oxfmt, Oxlint, and git diff --check passed.

@obviyus

obviyus commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Sep 2, 2026
@obviyus

obviyus commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. and removed P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Sep 2, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 2, 2026
@obviyus
obviyus merged commit cf28405 into openclaw:main Sep 2, 2026
409 of 417 checks passed
@obviyus

obviyus commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Thanks @gaoanze888!

Proof: A real Gateway with existing heartbeat scratch now shows the exact text in the Control UI's read-only monitor field. The mutable form stays empty, one admin-only scratch read is sent, and public cron list/get responses still contain no scratch. Screenshot and observation.

  • Bug: The heartbeat monitor field always looked empty because the UI projected only public payload text and never read private scratch.
  • Fix: The selected cron page now reads scratch into ephemeral display state and revalidates connection, selection, request generation, payload kind, and administrator access before showing it.
Before After
Existing scratch rendered as an empty monitor. Existing scratch renders read-only and never enters a cron write payload.

Landed: cf28405

Source head: 60ce14f

github-actions Bot pushed a commit to kickb1049kickb10492660/openclaw that referenced this pull request Sep 2, 2026
…5508)

Closes #135457

## What Problem This Solves

The Control UI showed an empty **Heartbeat monitor** field for every heartbeat automation, even when the Gateway already held private per-job scratch. The command-line interface showed the stored scratch correctly.

`jobToForm` projects text from public cron payloads. A heartbeat payload has no text because its monitor instructions live in private scratch. The page never called the existing `cron.scratch.get` method, so the read-only field always received the empty fallback.

## Fix

- Fetch scratch once when an administrator selects a heartbeat automation.
- Keep the result in ephemeral page display state, outside `CronFormState` and all add or update payloads.
- Revalidate the Gateway connection, selected job, request generation, heartbeat payload kind, and current administrator access after the request resolves.
- Clear display state when the connection, access, selection, or panel changes.
- Show scratch-read failures instead of presenting a false empty success state.
- Keep `cron.scratch.get` at `operator.admin` and keep scratch out of `cron.list`, `cron.get`, and `CronJob`.

Command, script, and skill-review automation payloads still use their existing read-only projection.

## Evidence

Baseline main: `2837afb07dc9faa27f631760b5f4de9dbb8de940`

Sanitized real-Gateway screenshot and observation: openclaw/openclaw#135508 (comment)

- Red, real Gateway: existing heartbeat scratch was returned by the Gateway, but the Control UI field stayed empty and sent no `cron.scratch.get` request.
- Green, real Gateway: the field displayed the exact stored scratch and remained read-only.
- The green observation recorded one `cron.scratch.get`, an empty mutable `payloadText`, and no scratch in `cron.list` or `cron.get`.
- Mock browser end-to-end tests cover the visible authorized result, the read-only operator path, and a visible read failure: 3 passed.
- The cron page unit suite covers an in-flight administrator-to-read-only downgrade: 35 passed.
- Real-Gateway browser end-to-end proof: 1 passed.
- Oxfmt, Oxlint, and `git diff --check` passed.

Production: `+56/-3`. Tests and test support: `+172/-10`.

## Regression provenance

PR #112967 introduced private heartbeat scratch without changing the existing UI projection. PR #130030 later made the empty projection explicit with the **Heartbeat monitor** label.

## AI assistance

AI-assisted repair and validation. A maintainer independently inspected the storage owner, Gateway authorization, protocol schemas, UI projection and save boundaries, sibling payload kinds, tests, docs, history, and real browser behavior.

Co-authored-by: gaoanze <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
…nclaw#135508)

Closes openclaw#135457

## What Problem This Solves

The Control UI showed an empty **Heartbeat monitor** field for every heartbeat automation, even when the Gateway already held private per-job scratch. The command-line interface showed the stored scratch correctly.

`jobToForm` projects text from public cron payloads. A heartbeat payload has no text because its monitor instructions live in private scratch. The page never called the existing `cron.scratch.get` method, so the read-only field always received the empty fallback.

## Fix

- Fetch scratch once when an administrator selects a heartbeat automation.
- Keep the result in ephemeral page display state, outside `CronFormState` and all add or update payloads.
- Revalidate the Gateway connection, selected job, request generation, heartbeat payload kind, and current administrator access after the request resolves.
- Clear display state when the connection, access, selection, or panel changes.
- Show scratch-read failures instead of presenting a false empty success state.
- Keep `cron.scratch.get` at `operator.admin` and keep scratch out of `cron.list`, `cron.get`, and `CronJob`.

Command, script, and skill-review automation payloads still use their existing read-only projection.

## Evidence

Baseline main: `1e7394c79ab1f55e912791169dee1bd31052159d`

Sanitized real-Gateway screenshot and observation: openclaw#135508 (comment)

- Red, real Gateway: existing heartbeat scratch was returned by the Gateway, but the Control UI field stayed empty and sent no `cron.scratch.get` request.
- Green, real Gateway: the field displayed the exact stored scratch and remained read-only.
- The green observation recorded one `cron.scratch.get`, an empty mutable `payloadText`, and no scratch in `cron.list` or `cron.get`.
- Mock browser end-to-end tests cover the visible authorized result, the read-only operator path, and a visible read failure: 3 passed.
- The cron page unit suite covers an in-flight administrator-to-read-only downgrade: 35 passed.
- Real-Gateway browser end-to-end proof: 1 passed.
- Oxfmt, Oxlint, and `git diff --check` passed.

Production: `+56/-3`. Tests and test support: `+172/-10`.

## Regression provenance

PR openclaw#112967 introduced private heartbeat scratch without changing the existing UI projection. PR openclaw#130030 later made the empty projection explicit with the **Heartbeat monitor** label.

## AI assistance

AI-assisted repair and validation. A maintainer independently inspected the storage owner, Gateway authorization, protocol schemas, UI projection and save boundaries, sibling payload kinds, tests, docs, history, and real browser behavior.

Co-authored-by: gaoanze <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
@clawsweeper

clawsweeper Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

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

Labels

app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary 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]: Control UI cron page never displays heartbeat scratch — "Heartbeat monitor" field is always empty

2 participants