Skip to content

fix(cron): let session automations refresh pinned widgets - #137666

Merged
Patrick-Erichsen merged 10 commits into
mainfrom
openclaw/access-to-openclaw-discord-store
Sep 4, 2026
Merged

Patrick-Erichsen merged 10 commits into
mainfrom
openclaw/access-to-openclaw-discord-store

Conversation

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes an issue where automations bound to persistent sessions could not create or refresh their pinned dashboard widgets because headless scheduled turns do not originate from an inline-widget-capable client. The tool was filtered out before its existing board-only path could run.

Why This Change Was Made

Scheduled turns with a validated server-authored tool policy may now receive a pin-only show_widget surface when the policy explicitly allows that tool and the run targets a persistent session. The schema requires pin: true, runtime enforcement rejects unpinned or presentation-targeted calls, detached cron-run sessions remain excluded, and real inline clients retain the normal dual inline/pinned behavior.

All persistent sessions own a dashboard; the exception is therefore session-scoped rather than restricted to keys whose display category happens to be dashboard.

User Impact

Session-owned automations can safely refresh dashboards without an open browser. They cannot use this exception to create invisible inline widgets, post through a channel presenter, target a device, or write to detached cron-run boards.

Evidence

  • Before: a live Clawtributor Radar cron turn completed its dispatcher step, then reported show_widget unavailable and preserved widget revision 9.
  • node scripts/run-vitest.mjs src/agents/openclaw-tools.scheduled-widget.test.ts src/agents/openclaw-tools.registration.test.ts src/canvas/widget-tool.scheduled.test.ts src/canvas/widget-tool.test.ts — 91 tests passed across four owner/sibling files.
  • node scripts/check-changed.mjs — formatting, production/test types, lint, dependency, architecture, import-cycle, storage, and dead-export gates passed.
  • pnpm docs:check-mdx — 753 files passed.
  • Autoreview: scoped-clean at P0, confidence 0.98, no findings.
  • Local pnpm docs:check-links could not load a stale linked-checkout dependency; exact-head CI remains the authoritative docs-link proof.

Worked on by


View the OpenClaw team session

roboclaw-bot and others added 2 commits September 3, 2026 23:40
Worked on by:
- @Patrick-Erichsen

Co-authored-by: Patrick-Erichsen <[email protected]>
OpenClaw-Publication: 6f3f9c02-ebb9-494d-bf74-e0f2cd28cff7
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 3, 2026 23:43
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 3, 2026
roboclaw-bot and others added 2 commits September 4, 2026 01:18
Worked on by:
- @Patrick-Erichsen

Co-authored-by: Patrick-Erichsen <[email protected]>
OpenClaw-Publication: b5e9377a-9f92-4e2e-8a88-9ed60172f26e
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 3, 2026, 9:53 PM ET / September 4, 2026, 01:53 UTC.

ClawSweeper review

What this changes

The PR lets explicitly authorized scheduled turns create or update pinned session-dashboard widgets without an inline client, while documenting and testing the restricted surface.

Merge readiness

⛔ Blocked before merge - 4 items remain

The prior P1 blocker remains: this PR still exposes pinned-widget authoring to scheduler-private trigger sessions, so it needs a small gate correction before merge.

Priority: P1
Reviewed head: 3294de63e196a1e44dc8843cb92d65f7fec13d37

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has a focused repair shape, but the unresolved scheduler-session write path blocks merge.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is exempt from the external-contributor proof gate; the supplied tests do not cover the remaining trigger-session defect.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is exempt from the external-contributor proof gate; the supplied tests do not cover the remaining trigger-session defect.
Evidence reviewed 6 items Introduced eligibility gate: The PR's scheduled exception admits any scheduled, explicitly allowlisted session that is not an exact cron run session; it does not exclude other scheduler-private cron keys.
Trigger scripts use a different private key: The cron trigger runtime creates cron:<job>:trigger, canonicalizes it to an agent-scoped key, then constructs scheduled coding tools with the runtime allowlist and scheduled policy.
Canonical predicate distinguishes the cases: isCronRunSessionKey accepts only cron:<job>:run:<id>, while isCronSessionKey covers every agent-scoped cron session, including trigger sessions.
Findings 1 actionable finding [P1] Exclude all scheduler-private cron sessions
Security None None.

How this fits together

Cron builds a headless agent tool list from a scheduled policy and session key. The widget tool then writes durable content to a session dashboard through the Gateway.

flowchart LR
  A[Scheduled policy] --> C[Headless tool construction]
  B[Session key] --> D[Widget eligibility gate]
  C --> D
  D --> E[Restricted widget tool]
  E --> F[Session dashboard]
  G[Trigger-script session] --> D
Loading

Before merge

  • Exclude all scheduler-private cron sessions (P1) - The gate excludes only :run: cron keys, but trigger scripts use agent:&lt;id>:cron:&lt;job>:trigger; with a valid scheduled policy and wildcard cap, they receive show_widget and write to that hidden scheduler session. Use the existing all-cron-session predicate and cover the trigger path. This was visible at the prior reviewed head and remains unresolved.
  • Resolve merge risk (P1) - Scheduler trigger scripts can receive show_widget under a wildcard scheduled cap and persist a widget to a hidden cron session instead of a user-owned dashboard.
  • Resolve merge risk (P1) - The bug-fix diff has a net +53 production lines; its distinct pinned-only schema and runtime enforcement may justify that growth, but no safe net-neutral compression is demonstrated until the eligibility condition is corrected.
  • Complete next step (P2) - Replace the run-only exclusion with the canonical cron-session exclusion and add trigger-script coverage before merge.

Findings

  • [P1] Exclude all scheduler-private cron sessions — src/agents/openclaw-tools.ts:323
Agent review details

Security

None.

PR surface

Source +53, Tests +179, Docs +5. Total +237 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 2 77 24 +53
Tests 2 179 0 +179
Docs 2 8 3 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 264 27 +237

Review metrics

Metric Value Why it matters
Production versus test delta production +77/-24 (net +53); docs +8/-3; tests +179/-0 The patch adds a new restricted runtime mode and substantial focused coverage; the production growth needs the corrected owner-boundary gate.

Merge-risk options

Maintainer options:

  1. Correct scheduler-session eligibility (recommended)
    Reject all cron-private session keys from the scheduled widget exception and prove trigger scripts lack the tool while persistent session automations retain it.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Use the canonical cron-session predicate for scheduled widget eligibility and add trigger-script coverage proving the tool is absent there but present for an eligible persistent session.

Technical review

Best possible solution:

Use the canonical cron-session predicate to exclude every scheduler-private key, add trigger-runtime coverage alongside the persistent-session case, and retain the explicit pinned-only schema/runtime enforcement needed for the durable-board boundary.

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

Yes, from source: a trigger script constructs agent:<id>:cron:<job>:trigger, receives scheduled policy and wildcard-cap processing, and passes the run-only exclusion.

Is this the best way to solve the issue?

No. The current condition excludes only cron run keys; using the existing all-cron-session predicate is the narrower owner-boundary repair.

Full review comments:

  • [P1] Exclude all scheduler-private cron sessions — src/agents/openclaw-tools.ts:323
    The gate excludes only :run: cron keys, but trigger scripts use agent:&lt;id>:cron:&lt;job>:trigger; with a valid scheduled policy and wildcard cap, they receive show_widget and write to that hidden scheduler session. Use the existing all-cron-session predicate and cover the trigger path. This was visible at the prior reviewed head and remains unresolved.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: A reachable scheduled path can silently write a widget to a scheduler-private dashboard rather than the intended persistent user session.
  • merge-risk: 🚨 session-state: The added eligibility rule controls which session key receives durable dashboard state.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This member-authored PR is exempt from the external-contributor proof gate; the supplied tests do not cover the remaining trigger-session defect.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/agents/openclaw-tools.scheduled-widget.test.ts src/cron/trigger-script.preparation.test.ts src/cron/trigger-script.test.ts src/canvas/widget-tool.scheduled.test.ts.
  • [P1] node scripts/check-changed.mjs -- src/agents/openclaw-tools.ts src/agents/openclaw-tools.scheduled-widget.test.ts src/cron/trigger-script.preparation.test.ts.

What I checked:

  • Introduced eligibility gate: The PR's scheduled exception admits any scheduled, explicitly allowlisted session that is not an exact cron run session; it does not exclude other scheduler-private cron keys. (src/agents/openclaw-tools.ts:323, 3294de63e196)
  • Trigger scripts use a different private key: The cron trigger runtime creates cron:<job>:trigger, canonicalizes it to an agent-scoped key, then constructs scheduled coding tools with the runtime allowlist and scheduled policy. (src/cron/trigger-script.ts:157, 3294de63e196)
  • Canonical predicate distinguishes the cases: isCronRunSessionKey accepts only cron:<job>:run:<id>, while isCronSessionKey covers every agent-scoped cron session, including trigger sessions. (src/sessions/session-key-utils.ts:268, 3294de63e196)
  • Wildcard caps retain all tools: An explicit wildcard allowlist leaves the constructed tool list intact, making the trigger-session path reachable when its scheduled policy is valid. (src/agents/embedded-agent-runner/run/attempt-tool-construction-plan.ts:75, 3294de63e196)
  • Prior finding remains unchanged: Blame ties the exact gate to the initial PR commit; the follow-up head did not change this condition, so the earlier trigger-session concern still applies. (src/agents/openclaw-tools.ts:323, 144f8f78424c)
  • Current main has not superseded this work: Fetched current main does not contain the scheduled widget eligibility block, while its trigger runtime retains the same scheduler-private key construction; the PR remains necessary once corrected. (src/agents/openclaw-tools.ts:305, ee6d003629b0)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Exclude all scheduler-private cron keys from the exception.
  • Add a trigger-runtime assertion that show_widget is absent while a persistent scheduled session remains eligible.

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 (1 earlier review cycle)
  • reviewed 2026-09-04T01:36:35.332Z sha 2ef99e0 :: blocked before merge. :: [P1] Exclude trigger-script sessions from pinned widget authoring

roboclaw-bot and others added 4 commits September 4, 2026 01:38
Worked on by:
- @Patrick-Erichsen

Co-authored-by: Patrick-Erichsen <[email protected]>
OpenClaw-Publication: 22166308-a697-45ab-84ca-a425f1513dd8
Worked on by:
- @Patrick-Erichsen

Co-authored-by: Patrick-Erichsen <[email protected]>
OpenClaw-Publication: 3b52db99-2781-4524-a579-4878b5923a17
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: L and removed size: M labels Sep 4, 2026
roboclaw-bot and others added 2 commits September 4, 2026 01:45
Worked on by:
- @Patrick-Erichsen

Co-authored-by: Patrick-Erichsen <[email protected]>
OpenClaw-Publication: 5505caac-c55a-419b-aff2-7b02575bb186
@openclaw-barnacle openclaw-barnacle Bot added size: M and removed scripts Repository scripts size: L labels Sep 4, 2026
@Patrick-Erichsen
Patrick-Erichsen merged commit d1e3fa8 into main Sep 4, 2026
306 of 310 checks passed
@Patrick-Erichsen
Patrick-Erichsen deleted the openclaw/access-to-openclaw-discord-store branch September 4, 2026 02:15
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
…37666)

* fix(cron): allow pinned widget updates

* fix(cron): let session automations refresh pinned widgets

Worked on by:
- @Patrick-Erichsen

Co-authored-by: Patrick-Erichsen <[email protected]>
OpenClaw-Publication: 6f3f9c02-ebb9-494d-bf74-e0f2cd28cff7

* fix(cron): keep widget prompt within compact budget

Worked on by:

- @Patrick-Erichsen

Co-authored-by: Patrick-Erichsen <[email protected]>

* fix(cron): let session automations refresh pinned widgets

Worked on by:
- @Patrick-Erichsen

Co-authored-by: Patrick-Erichsen <[email protected]>
OpenClaw-Publication: b5e9377a-9f92-4e2e-8a88-9ed60172f26e

* ci: refresh checks against current main

* fix(cron): let session automations refresh pinned widgets

Worked on by:
- @Patrick-Erichsen

Co-authored-by: Patrick-Erichsen <[email protected]>
OpenClaw-Publication: 22166308-a697-45ab-84ca-a425f1513dd8

* fix(ci): retry transient npm advisory timeouts (openclaw#137716)

Co-authored-by: Dallin Romney <[email protected]>

* fix(cron): let session automations refresh pinned widgets

Worked on by:
- @Patrick-Erichsen

Co-authored-by: Patrick-Erichsen <[email protected]>
OpenClaw-Publication: 3b52db99-2781-4524-a579-4878b5923a17

* fix(cron): let session automations refresh pinned widgets

Worked on by:
- @Patrick-Erichsen

Co-authored-by: Patrick-Erichsen <[email protected]>
OpenClaw-Publication: 5505caac-c55a-419b-aff2-7b02575bb186

---------

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: Patrick-Erichsen <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: Dallin Romney <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants