Skip to content

feat(workboard): run attached automations after linked sessions finish - #125170

Merged
steipete merged 4 commits into
mainfrom
steipete/workboard-event-nudge
Aug 17, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/workboard-event-nudge

Conversation

@steipete

@steipete steipete commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where a Workboard board with an attached automation still waited for the automation's next schedule after a linked agent or subagent finished. The card lifecycle update reached review, but the categorization automation was not nudged from the prepared model generation that emitted the terminal hook.

Series context: #125023, #125076, #125094.

Why This Change Was Made

Workboard now requests the board's operator-owned automation with the additive cron.run mode if-enabled when a matching linked session ends, with one process-wide lifecycle owner and a 60-second per-board debounce. Cron rechecks the authoritative enabled and auto-disabled state under its reservation lock before immediate admission. Prepared model generations register fresh hook closures without starting plugin services, so the active service logger, lifecycle fence, and debounce map are shared through the plugin SDK process singleton. Explicit operator force semantics are unchanged, cron-originated sessions remain excluded to prevent self-triggering, and the stored schedule remains the backstop.

User Impact

Operators can attach an enabled automation to a Workboard board and have it react immediately when linked work finishes. Disabled and auto-disabled jobs are skipped with a typed non-error result; repeated events for the same board coalesce, failures and skips remain non-blocking for card lifecycle updates, and successful requests now leave an attributable log line with the returned automation run ID.

Evidence

Boundary regression proof:

  • src/gateway/server.cron.test.ts creates real far-future enabled and disabled cron rows and dispatches cron.run with mode: "if-enabled" through a bundled-plugin runtime request carrying an ambient foreign agent identity. It proves the trusted synthetic admin client reaches the real method router, runs the enabled row, and returns reason: "disabled" without history for the disabled row.
  • src/cron/service/ops.run-admission.test.ts proves enabled, disabled, auto-disabled, and disable-after-enqueue behavior under cron's authoritative reservation and activation locks. Existing force coverage remains unchanged and still admits explicitly forced disabled jobs.
  • test/e2e/qa-lab/runtime/managed-worktrees-workboard-lifecycle-product-proof.e2e.test.ts failed before the owner repair with the card at review and zero automation history; it passes after the repair through a real isolated Gateway, Workboard service/hook, persisted board/job, and mock provider.
  • Root cause: src/plugins/runtime/generation-scope.ts:18-45 carries the prepared registry, src/plugins/hook-runner-global-state.ts:124-127 selects it for hook dispatch, and extensions/workboard/src/automation-nudge.ts:30-52 now bridges those hook closures to the active service owner.

Focused exact-head checks:

  • node scripts/run-vitest.mjs extensions/workboard/src/lifecycle-sync.test.ts — 41 passed.
  • node scripts/run-vitest.mjs src/gateway/server.cron.test.ts -t 'bundled plugin runtime runs enabled automations and skips disabled ones' — 1 passed.
  • node scripts/run-vitest.mjs src/cron/service/ops.run-admission.test.ts — 20 passed.
  • pnpm protocol:check — passed; additive schema member, no protocol version bump, Swift unchanged.
  • OPENCLAW_BUILD_PRIVATE_QA=1 node scripts/run-vitest.mjs test/e2e/qa-lab/runtime/managed-worktrees-workboard-lifecycle-product-proof.e2e.test.ts -t 'nudges a persisted future automation when a linked worker ends' — 1 passed.
  • Fresh branch autoreview against origin/main — clean, no accepted/actionable findings.

Live isolated Gateway proof used openai/gpt-5.6-luna. Job 98fda088-8468-45a0-b82d-998074f3e90e had schedule 0 3 1 1 * in America/Los_Angeles, exact, with its next due time at 2027-01-01T11:00:00Z (Next in 137d in the recorded UI). It started from the event nudge at 2026-08-17T01:10:13.413-07:00, finished ok in 6.360 seconds, and moved Rough customer follow-up from triage to todo. The linked card reached review.

Gateway log correlation:

2026-08-17T01:10:13.400-07:00 [plugins] workboard automation nudge requested for board peter-tasks: job 98fda088-8468-45a0-b82d-998074f3e90e run manual:98fda088-8468-45a0-b82d-998074f3e90e:1786954213396:1
2026-08-17T01:10:14.234-07:00 [provider-transport-fetch] [model-fetch] start provider=openai api=openai-responses model=gpt-5.6-luna method=POST url=https://api.openai.com/v1/responses timeoutMs=undefined proxy=none policy=custom

History verdict:

runAt: 2026-08-17T01:10:13.413-07:00
finished: 2026-08-17T01:10:19.773-07:00
status: ok
summary: Moved “Rough customer follow-up” from triage to todo.
nextRunAt: 2027-01-01T03:00:00.000-08:00

The recorder's extra Automations-page text locator timed out after the mandated assertions passed. The final video frame visibly shows the Run history tab with Peter tasks event clarifier · OK, gpt-5.6-luna, Run at 1:10:13 AM, Next in 137d, and the successful move summary; coordinator review accepted the live gate.

workboard-event-nudge.webm

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime plugin: workboard size: L maintainer Maintainer-authored PR labels Aug 17, 2026
@steipete steipete self-assigned this Aug 17, 2026
@steipete
steipete marked this pull request as ready for review August 17, 2026 08:24
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. 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 Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 5:24 AM ET / 09:24 UTC.

ClawSweeper review

What this changes

The PR makes Workboard run an attached enabled automation immediately after a linked agent or subagent session ends.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer review: current main lacks the event nudge, while the PR’s latest head addresses the prior disabled-automation blocker with enabled-state checks before cron admission.

Priority: P1
Reviewed head: e2c6fb17677d0e77aa176d6e5f7549393a4d2fa4
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The previous admission blocker is repaired with focused owner-boundary coverage and credible real-flow evidence; only maintainer contract acceptance and exact-head checks remain.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (recording): The PR body supplies an after-fix isolated-Gateway run with correlated history/log output and a linked recording that shows the resulting automation run and card state.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (recording): The PR body supplies an after-fix isolated-Gateway run with correlated history/log output and a linked recording that shows the resulting automation run and card state.
Evidence reviewed 6 items Current-main gap: Current main updates matching Workboard cards on terminal hooks but passes no automation callback; its Cron protocol only accepts due or force modes.
Lifecycle-to-nudge implementation: The PR collects matching non-archived cards, invokes the nudge callback alongside lifecycle persistence, and deduplicates requests by board.
Prior finding repaired at the owner boundary: The new if-enabled mode rejects disabled and auto-disabled jobs during preflight, reservation, and activation while preserving immediate-run scheduling semantics.
Findings None None.
Security None None.

How this fits together

Workboard records cards linked to agent sessions and optionally to an operator-owned automation. Terminal session hooks update the card, then this change asks Cron to admit the attached automation without overriding disabled or auto-disabled jobs.

flowchart LR
A[Linked agent session] --> B[Workboard terminal hook]
B --> C[Card lifecycle update]
B --> D[Board automation nudge]
D --> E[Enabled-only cron admission]
E --> F{Automation enabled?}
F -->|Yes| G[Queued automation run]
F -->|No| H[Skipped result and preserved schedule]
Loading

Decision needed

Question Recommendation
Should cron.run expose if-enabled as a supported additive mode for trusted Gateway event sources beyond Workboard? Accept the generic cron contract: Keep the documented enabled-only immediate mode and merge once exact-head required checks are green.

Why: This is a public Gateway protocol expansion, so code review cannot determine the intended long-term contract alone.

Before merge

  • Resolve merge risk (P1) - Merging makes if-enabled a documented additive Gateway protocol mode for trusted event sources; existing clients remain compatible, but maintainers should explicitly accept that permanent contract.
  • Complete next step (P2) - Maintainer confirmation is needed for the newly documented Gateway protocol contract; no mechanical repair remains.
Agent review details

Security

None.

PR surface

Source +231, Tests +433, Docs +6. Total +670 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 11 283 52 +231
Tests 6 436 3 +433
Docs 2 8 2 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 19 727 57 +670

Review metrics

Metric Value Why it matters
Production versus test delta production +283/-52; tests +436/-3; docs +8/-2 The positive production growth implements a new plugin service and additive Cron protocol mode, with substantially larger focused boundary coverage.

Stored data model

Persistent data-model change detected: serialized state: src/cron/service/state.ts, serialized state: test/e2e/qa-lab/runtime/managed-worktrees-workboard-lifecycle-product-proof.e2e.test.ts, vector/embedding metadata: extensions/workboard/src/lifecycle-sync.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: canonical
Canonical: #125170
Summary: This PR is the canonical implementation of event-triggered attached automations; the cited Workboard PRs are prerequisites with distinct user behavior.

Members:

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

Merge-risk options

Maintainer options:

  1. Accept the additive protocol contract (recommended)
    Confirm that trusted Gateway event sources may use the documented enabled-only immediate mode, then merge after exact-head checks pass.
  2. Pause for a narrower interface
    Do not merge the public mode until maintainers choose a more limited contract if generic event-source use is not desired.

Technical review

Best possible solution:

Retain one generic Cron-owned enabled-only immediate admission path and use it from Workboard rather than adding a Workboard-specific execution bypass.

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

Yes—current-main source shows terminal lifecycle updates without any automation nudge, while the PR’s focused tests define the affected linked-session path; this review did not execute it in the read-only environment.

Is this the best way to solve the issue?

Yes—the generic Cron admission is the narrowest maintainable solution because it preserves disablement, auto-disablement, concurrency, and scheduled-run ownership instead of duplicating them in Workboard.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies an after-fix isolated-Gateway run with correlated history/log output and a linked recording that shows the resulting automation run and card state.
  • 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 (recording): The PR body supplies an after-fix isolated-Gateway run with correlated history/log output and a linked recording that shows the resulting automation run and card state.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: Attached Workboard automations currently wait for a future schedule instead of reacting to linked work completion.
  • merge-risk: 🚨 compatibility: The PR adds a documented cron.run mode that becomes a supported Gateway contract for trusted callers.
  • 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 (recording): The PR body supplies an after-fix isolated-Gateway run with correlated history/log output and a linked recording that shows the resulting automation run and card state.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies an after-fix isolated-Gateway run with correlated history/log output and a linked recording that shows the resulting automation run and card state.
  • proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. The PR body supplies an after-fix isolated-Gateway run with correlated history/log output and a linked recording that shows the resulting automation run and card state.

Evidence

What I checked:

  • Current-main gap: Current main updates matching Workboard cards on terminal hooks but passes no automation callback; its Cron protocol only accepts due or force modes. (extensions/workboard/index.ts:53, b77671ced26f)
  • Lifecycle-to-nudge implementation: The PR collects matching non-archived cards, invokes the nudge callback alongside lifecycle persistence, and deduplicates requests by board. (extensions/workboard/src/lifecycle-sync.ts:83, e2c6fb17677d)
  • Prior finding repaired at the owner boundary: The new if-enabled mode rejects disabled and auto-disabled jobs during preflight, reservation, and activation while preserving immediate-run scheduling semantics. (src/cron/service/ops-run-preparation.ts:261, e2c6fb17677d)
  • Boundary coverage: Tests cover the bundled-plugin Gateway request, disabled and auto-disabled admission, disable-after-enqueue, schedule preservation, and the Workboard lifecycle path. (src/gateway/server.cron.test.ts:1582, e2c6fb17677d)
  • History and ownership: Blame ties the new lifecycle callback to the PR’s initial Workboard commit and the enabled-only guard to its latest repair commit; the surrounding current-main lifecycle baseline is attributed to Peter Steinberger. (extensions/workboard/src/lifecycle-sync.ts:81, e2c6fb17677d)
  • Release and environment check: No local release tag contains the PR head; latest provided release v2026.7.1-2 predates the Workboard series. pnpm docs:list could not run because Corepack attempted a cache write in the read-only environment, so relevant changed docs were inspected directly from the PR object. Public docs: docs/plugins/workboard.md. (docs/plugins/workboard.md:114, e2c6fb17677d)

Likely related people:

  • steipete: Current lifecycle baseline and the PR’s lifecycle/admission repairs are attributed to Peter Steinberger; related merged Workboard work in the supplied context has the same author. (role: recent Workboard and cron contributor; confidence: high; commits: 4e1f26dc1892, e2c6fb17677d; files: extensions/workboard/index.ts, extensions/workboard/src/lifecycle-sync.ts, src/cron/service/ops-run-preparation.ts)

Rank-up moves

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

  • Confirm the additive Gateway protocol contract.
  • Wait for exact-head required checks to finish green.

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-08-17T08:32:20.129Z sha 286367dc9421e188334e2b9375efe87737739ccc :: found issues before merge. :: [P1] Respect disabled automations before force-running
  • reviewed 2026-08-17T08:55:09.334Z sha a9477c3d15df6fe0e048dd8636d0aff3249397f4 :: needs changes before merge. :: [P1] Use enabled-only immediate cron admission

@steipete
steipete force-pushed the steipete/workboard-event-nudge branch from 286367d to a9477c3 Compare August 17, 2026 08:45
@clawsweeper clawsweeper Bot added the proof: 🎥 video Contributor real behavior proof includes video or recording evidence. label Aug 17, 2026
@steipete
steipete force-pushed the steipete/workboard-event-nudge branch from a9477c3 to e2c6fb1 Compare August 17, 2026 09:17
@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Aug 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Addressed the P1 and every listed rank-up move on e2c6fb17677d0e77aa176d6e5f7549393a4d2fa4.

  • Added additive cron.run mode if-enabled; existing force behavior is unchanged.
  • Cron now owns the invariant: if-enabled runs immediately only while the authoritative row is enabled and not auto-disabled. It rechecks after queueing under the reservation/activation lock, so a concurrent disable wins without a plugin-side read-then-act race.
  • Disabled and auto-disabled rows return { ok: true, ran: false, reason: "disabled" }. A disable after enqueue follows the existing canonical queued-skip history path.
  • Workboard uses if-enabled, logs typed skips, and never changes card state because of a skipped nudge.
  • Added enabled, disabled, auto-disabled, disable-race, real plugin-runtime dispatch, and no-history coverage. Existing force-disabled coverage remains green.
  • Production/test type failures are resolved. Exact-head CI run 32014429192 is green.

Focused proof includes 20 cron admission tests, 30 protocol validator tests, 42 Workboard lifecycle tests, the real Gateway boundary, the isolated Workboard E2E, pnpm protocol:check, production/extension typechecks, and clean branch autoreview.

@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 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 Aug 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer decision: accept the additive generic cron.run contract mode: "if-enabled" for trusted Gateway event sources. Existing due and explicit operator force semantics remain unchanged; no protocol version bump is required.

Exact-head required CI run 32014429192 is green, review artifacts validate READY FOR /prepare-pr, and the Testbox-backed prepare gate passed. No ClawSweeper rank-up move is skipped.

@steipete
steipete merged commit 2b55b55 into main Aug 17, 2026
225 checks passed
@steipete
steipete deleted the steipete/workboard-event-nudge branch August 17, 2026 09:29
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 18, 2026
openclaw#125170)

* feat(workboard): nudge attached automations on session events

* fix(workboard): share automation nudge lifecycle state

* fix(workboard): satisfy nudge type guards

* fix(cron): add enabled-only immediate runs
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 docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. plugin: workboard proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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