Skip to content

feat(plugins): keep requester command schedules across Gateway restarts - #180844

Merged
fuller-stack-dev merged 2 commits into
openclaw:mainfrom
fuller-stack-dev:feat/plugin-command-schedule-restart
Oct 22, 2026
Merged

fuller-stack-dev merged 2 commits into
openclaw:mainfrom
fuller-stack-dev:feat/plugin-command-schedule-restart

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Requester-admitted scheduled command turns (#180282) currently end when the Gateway restarts. #180282 shipped that as v1 and listed restart continuity as a follow-up. This PR implements that follow-up: an accepted schedule now survives a Gateway restart, within its original bounds and under the same per-occurrence authority checks.

Behavior

  • Persistence. A schedule accepted from a plugin with captured source records a private restart binding (pluginCommandBinding) in the job's runtime state. The binding holds the Gateway process and plugin instance serving it, and the plugin generation's captured sourceDigest. The stored schedule (pluginCommand envelope, payload kind pluginCommand) keeps the shape released in feat(plugins): let requester commands schedule bounded follow-up turns #180282. No table, column or schema version is added.
  • Code identity. feat(plugins): let requester commands schedule bounded follow-up turns #180282 ended schedules at restart because persisted plugin metadata does not prove that the same code is loaded afterwards. This PR uses the digest of the source the plugin instance actually loaded, which the plugin loader already captures, as that durable code identity. A plugin with the same ID, location and version but different code does not match. Core-bundled plugins load host-owned modules without a captured digest, so their schedules still end with the Gateway process. (Follow-up: feat(plugins): keep core-bundled command schedules across restarts on the same build #181331 gives them an identity from the exact loaded build, so on the same build they now re-arm under the same rules.) schedule() now returns survivesRestart so a plugin knows which case applies.
  • Re-arm. After a restart, the scheduler's launch claim re-arms the schedule onto the newly loaded instance of the same plugin code. That instance must have the same plugin ID, source, root, version and exact captured source digest, and must still register the target command as authenticated and native-subagent capable. The re-arm, the budget check, the receipt and the attempt charge all happen in one state transaction. The Gateway thread supplies the loaded instances (resolvePluginCommandScheduleHosts), so the worker never reads plugin state itself.
  • Bounds. The deadline, maxRuns and spent attempts carry over unchanged. Expired or exhausted schedules are never re-armed; the claim retires them.
  • Fire-time checks. Each occurrence still restores the original requester and rechecks the operator, parent session, plugin instance, command and tool ceiling exactly as before. It uses the re-armed instance in place of the creating one, and also rechecks that instance's source digest. A demoted or removed requester is refused before the command or its input is accepted. A disabled, uninstalled or changed plugin has no matching loaded instance, so the claim retires the schedule without running plugin code or spending an attempt. Re-enabling the plugin later does not revive it.
  • No double-fire, no resurrection. The claim is the only place a schedule is re-armed, and it shares the running-receipt fence. A racing force request or a recovery claim during an occurrence launches nothing and does not move the binding. Restart recovery never refunds an attempt. An occurrence that may have started its command is not replayed; one that never reached it is retried once, as a charged attempt. Disabled, removed and completed schedules stay ended.
  • Unchanged within one process. An in-process plugin reload still retires schedules bound to the replaced instance on their first refusal.
  • Cap. The 8-per-parent cap also counts unexpired restartable schedules of the same plugin code left by an earlier process, since a claim can still re-arm them. Schedules that can never run again still do not hold the cap: those bound to a replaced instance, those from other code, and those without continuity.
  • Capability. command-scheduled-turns-restart-v1 advertises restart continuity, and each accepted schedule reports survivesRestart. When it is true, plugins should not re-enroll that schedule after a restart. Otherwise they keep the feat(plugins): let requester commands schedule bounded follow-up turns #180282 behavior and re-enroll from a later requester command.

Rollback and older readers

Tests

  • Worker (src/cron/store/plugin-command-schedule.worker.test.ts)
    • Re-arm inside the claim. The test checks the binding, the charge and the unchanged envelope; that a racing claim launches nothing; and that recovery refunds nothing.
    • Retirement without a matching location, version, source digest or command, and for expired or exhausted schedules.
    • A schedule accepted without captured source keeps ending with its process.
    • An occurrence interrupted by a restart is not replayed once its command may have started, and is retried once when it never reached its command.
    • Cap accounting for restartable, replaced-instance, other-build, other-code, expired and non-restartable schedules.
  • Rollback (src/cron/store/plugin-command-schedule-rollback.worker.test.ts)
    • The released reader ends a re-armed schedule, and upgrading again never revives it.
    • A schedule the released reader never reached re-arms after upgrading again.
  • Integration (src/auto-reply/reply/commands-plugin.scheduled-turns-restart.test.ts)
    • Uses the real plugin loader, channel requester, cron service and state database. The in-process restart stops the scheduler, retires the plugin instances, changes the process identity, reloads plugins and starts a new scheduler on the same database.
    • Covers resuming onto the new instance up to the budget, a completed schedule staying ended across another restart, a cancelled schedule not being resurrected, demoted and removed requesters being refused, and disabled, uninstalled and changed plugins never firing. The changed plugin keeps its ID, location and version but has different source.
    • The shared fixture moved into commands-plugin.scheduled-turns.test-support.ts, unchanged apart from the restart hook.
  • E2E (test/plugin-command-scheduled-restart.e2e.test.ts)
    • Real Gateway processes on one isolated state directory, with a configured-path plugin, a paired operator device as the requester, cron enabled and a model server that fails the test if called.
    • A schedule runs once, the Gateway is killed (crashGateway), and the remaining budget runs in the new process. It ticks exactly maxRuns times, then retires.
    • A cancelled schedule never runs. A schedule whose plugin is disabled while the Gateway is down never ticks; its next claimed occurrence retires it.

Evidence

Head 660d137c8f1f9fa7fe1a921d1ba6366e1b360fed, on main a8be68fc0d6746996e540a25fa8a271966b8613f. None of the 23 later commits on main touches this PR's files. Every run used private HOME, TMPDIR and state, with inherited OPENCLAW_* variables stripped. Nothing ran against a live Gateway.

Real Gateway processes: authority after a restart, through to provider I/O

Setup:

  • The requester is a durable trusted-proxy profile, [email protected], whose role grants operator.admin. A separate admin identity performs the demotion.
  • A third-party plugin is loaded from a configured path. A mock OpenAI Responses provider sits behind a real models.providers entry, so the real embedded runner and provider transport run.
  • tools.swarm.maxConcurrent is 1.
Step Observed
Requester chat.send /proof-schedule (Gateway pid 8803) Accepted with survivesRestart: true, maxRuns: 3
crashGateway, then a new Gateway (pid 8830) Same state directory
Occurrence 1 after the restart (cron.run force) Plugin code ran in pid 8830. Its native child reached the provider (S6V2-CHILD-TASK request), and collect returned done, S6V2-CHILD-DONE
Occurrence 2: a holder child takes the single lane, a target child queues Holder reached the provider. Target agent.wait returned timeout, with no provider request
users.setRole → member (demotion), then release the holder Holder ended subagent run terminated. Target ended terminal Restart recovery operator authority changed; start a new user turn., with no acceptedAt or startedAt. The provider never received S6V2-QUEUED-TASK
Occurrence 3 after the demotion Run error: Restart recovery operator identity changed. (4 ms). No plugin effect and no provider request

Real Gateway processes: upgrade, rollback and upgrade again

One state directory alternates between the released command-schedule build (main a8be68f without this PR, which has #180282) and this PR's build.

Phase Observed
A. Released build Schedule accepted (no survivesRestart field) and ticked once. An ordinary disabled automation was added
B. This PR Both jobs load unchanged. The released build's schedule has no binding, so its claim ends it (ended with its Gateway process) without running. A new schedule reports survivesRestart: true and ticks
C. Rollback to the released build All three jobs load. Claiming the new schedule ends it (ended with its Gateway process) without running
D. This PR again The ended schedule stays disabled; cron.run does not run it. The ordinary automation is intact. 0 provider requests

Real Gateway processes: upgrade from the latest stable release

Latest stable is npm [email protected] (fe06181, which predates scheduled command turns).

Step Observed
Stable Gateway writes the profile A session with a real provider reply (STABLE_PRE_UPGRADE_REPLY), an enabled agentTurn job, a disabled job, the managed heartbeat-main job, and the setting agents.defaults.timeoutSeconds: 321
This head's openclaw doctor --fix --non-interactive --yes, against that profile only Exit 0. A launchctl shim on PATH recorded no service calls
This head's Gateway on the upgraded profile All three jobs load; the disabled job stays disabled and doctor converted the heartbeat to agentTurn. chat.history still has the stable reply, and timeoutSeconds is still 321
Scheduled turns on the upgraded profile The updated plugin's schedule reports survivesRestart: true. It ticked in pid 60703, the Gateway crashed, and it ticked again in pid 61994

Tests and checks

Check Result
Focused (9 files) 194 passed
E2E test/plugin-command-scheduled-restart.e2e.test.ts 1 passed (84 s)
Affected suites on the previous base (104 files) 1,249 passed
All of src/cron on the previous base 273 files, 2,251 passed
tsgo:core and core test shards clean
Type-aware oxlint on the changed files 0 warnings, 0 errors
Runtime and madge import cycles 0 each
Line-cap ratchet OK
Docs formatting OK

Each new check fails without its production change:

  • Removing the re-arm call fails the re-arm, rollback re-arm, interrupted-occurrence and integration resume/requester tests.
  • Removing the digest comparison fails the changed-plugin integration test.
  • Removing restartable cap accounting fails the cap test.
  • Removing the fire-time digest recheck fails the new scheduled-run test.

Production code has no test-only hook. The in-process restart tests replace, with a module mock, only the process identity the Gateway thread reports to the scheduler. The claim, plugin loader and state database are real, and the E2E repeats the restart with real processes.

E2E timing. The first CI run killed the E2E at CI's 300 s no-output limit. Its 4 s interval made every restart miss a slot, and each missed slot waits out the scheduler's two-minute startup deferral. The E2E now uses a 20 s interval, so the next slot comes after the restart, and it claims the disabled-plugin occurrence directly with cron.run.

Rollback test. As in #180274, plugin-command-schedule-rollback.worker.test.ts keeps a frozen copy of the released reader's strict envelope and claim rule, so a future envelope change fails in CI. The real released build above provides the corresponding process-level proof.

Docs

docs/plugins/sdk-runtime/background-work.md now describes restart continuity, rollback behavior and the cap accounting, replacing the restart-scoped v1 wording. docs/plugins/manifest/capabilities.md lists the new capability.

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling plugin: file-transfer size: XL labels Oct 22, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves bounded requester-command schedules across Gateway restarts when the same captured plugin code is available.

Example: A plugin schedules three follow-up runs and the Gateway restarts after the first.

  • Before: The schedule ends without executing its remaining runs.
  • After: The same plugin code can execute the remaining two runs under the original deadline and current requester authority.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Complete feature with shipped-entry-point evidence, latest-stable upgrade and rollback coverage, resolved prior feedback, and no open finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The complete PR body records real isolated Gateway processes on the reviewed head: matching plugin code resumes after a crash, an authorized native child reaches provider transport, demotion prevents queued and subsequent effects, and cancelled or disabled-plugin schedules remain ended.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: A plugin's accepted follow-up schedule stops when the Gateway restarts, requiring another requester command to resume it.
Reason: The maintainer-authored follow-up supplies durable continuity within existing bounds and explicitly documents unsupported captured-source cases.

Merge readiness

✅ Ready for maintainer review

This PR delivers the planned restart-continuity feature; the earlier finding and upgrade blocker are resolved, and no introduced blocking defect remains.

Priority: P2
Reviewed head: 660d137c8f1f9fa7fe1a921d1ba6366e1b360fed

Before merge

None.

Findings

None.

Agent review details

How this fits together

Authenticated plugin commands create requester-bound cron jobs; the worker claims occurrences, and the Gateway restores current authority before dispatching plugin commands and native children.

flowchart TD
A[Authenticated requester command] --> B[Native schedule creation]
B --> C[Cron job and private binding]
D[Loaded plugin code identity] --> E[Worker occurrence claim]
C --> E
E --> F[Gateway authority checks]
F --> G[Plugin command]
G --> H[Native child provider transport]
Loading

Technical review

Best possible solution:

Use the existing cron claim owner to re-arm matching captured plugin code while preserving budgets, terminal retirement and current-authority checks.

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

Current main explicitly rejects schedules from a previous Gateway process, establishing the designed limitation without executing target code during this review.

Is this the best way to solve the issue?

The change extends existing cron and plugin lifecycle owners, uses captured source identity instead of metadata alone, and keeps per-occurrence authorization independent of persistence.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 70b25401a70a.

Provenance checked

  • Process-scoped schedule lifetime and cap accounting changes intended behavior with a stated reason (ad40743: Persisted plugin metadata could not establish implementation identity across processes, so schedules ended and previous-process rows did not consume the active cap.)
  • Transactional cron claim and activation keeps the original intent (d7aa7a9: Batch claim and activation while retaining receipt idempotency, capacity ordering and execution authority.)
  • Private envelope and older-reader behavior keeps the original intent (ad40743: Dedicated pluginCommand storage prevents older hosts from interpreting scheduled commands as ordinary model prompts.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced change and current-main boundary: The pinned introduction diff adds restart binding and re-arm behavior; fetched main still ends schedules whose creating Gateway process has exited. (src/cron/plugin-command-schedule.ts:128, 660d137c8f1f)
  • Authority remains separate from continuity: Re-arm shares the existing worker claim transaction; dispatch independently checks the live binding, plugin digest, parent session and restored requester authority. (src/gateway/plugin-command-scheduled-run.ts:225, 660d137c8f1f)
  • Supplied final-effect and upgrade evidence: The complete PR body records an authorized post-restart child reaching provider I/O, demotion blocking a queued child before provider I/O, rollback without resurrection, and an upgrade from [email protected] preserving jobs, conversation history and timeoutSeconds=321. The full body was retrieved beyond the supplied excerpt; its captured source identity is 65a7060bf24bd8696f4df5c0889fbfc9e82295ad690f6fb204d8a449c8ca01ed. (660d137c8f1f)
  • Intent and accepted compatibility tradeoff: feat(plugins): let requester commands schedule bounded follow-up turns #180282 deliberately ended schedules at restart because metadata did not establish code identity and identified continuity as follow-up work; this maintainer-authored PR supplies captured-source identity while retaining process-scoped behavior for plugins without it and preserving the older envelope. (src/cron/plugin-command-schedule.types.ts:33, ad407430c464)
  • Exact-head gates: The current-head combined status is success, including CI, dependency review and applicable security review; one additional macOS scan-scope check remained in progress. (660d137c8f1f)
  • Feature history and inspection limit: History identifies the requester-schedule implementation and earlier cron claim and plugin-lifecycle work, including the job-mutations.worker.ts rename; a deeper --follow traversal encountered an unavailable promisor object, without obscuring the relevant introduction or current behavior. (src/cron/store/job-mutations.ts, 70b25401a70a)

PR surface

Source +353, Tests +1038, Docs +31. Total +1422 across 37 files. Added test files: 4.

View PR surface stats
Area Files Added Removed Net
Source 25 388 35 +353
Tests 10 1496 458 +1038
Docs 2 56 25 +31
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 37 1940 518 +1422

Review metrics

Metric Value Why it matters
Production versus test changes Production +388/-35; tests and test support +1496/-458 Production growth implements private continuity state and existing-owner plumbing; test growth covers distinct restart, revocation, budget and rollback boundaries, with substantial fixture relocation.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: Restart continuity is a useful bounded plugin capability without evidence of an urgent shipped regression.
  • merge-risk: 🚨 compatibility: The PR extends the plugin result and capability contract and changes persisted schedule lifetime; maintainer direction, preserved envelope shape and upgrade/rollback evidence address the tradeoff.
  • merge-risk: 🚨 security-boundary: Requester-bound execution can outlive its creating process; supplied final-effect evidence covers authorized execution and requester demotion before queued provider I/O.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-22T18:02:05.051Z sha 7dc20d24ef4e81ade41e3a039a2a7a5f35d53871 :: needs real behavior proof before merge. :: [P3] Remove the test-only process identity setter
  • reviewed 2026-10-22T19:05:22.292Z sha 660d137 :: blocked before merge. :: none

Reviewed October 22, 2026, 3:24 PM ET / 19:24 UTC (Revision 3).

Requester-admitted scheduled command turns (openclaw#180282) ended when the Gateway
restarted. Accepted schedules now survive a restart, within their original
bounds and under the same per-occurrence authority checks.

- A schedule accepted from a plugin whose loaded source has a captured
  digest records a private restart binding in job state: the serving
  Gateway process and plugin instance, plus that source digest. The released
  `pluginCommand` envelope and payload kind are unchanged; no table, column or
  schema version is added.
- After a restart, the scheduler's launch claim re-arms the schedule onto the
  newly loaded instance only if it runs the same code: the same plugin ID,
  source, root and version, the exact captured source digest, and the target
  command still registered. The re-arm, the budget check, the receipt and the
  charge share one state transaction. The Gateway thread supplies the loaded
  instances.
- The deadline, maxRuns and spent attempts carry over. Expired, exhausted,
  disabled, removed and completed schedules are never re-armed. Without a
  matching instance (disabled, uninstalled or changed plugin) the claim
  retires the schedule before running plugin code or spending an attempt.
- Each occurrence still restores the original requester and rechecks the
  operator, parent session, plugin instance and code, command and tool
  ceiling; a demoted or removed requester is refused before the command runs.
- In-process plugin reloads still retire schedules bound to the replaced
  instance. Core-bundled plugins have no captured digest and keep
  restart-scoped schedules.
- The active cap also counts unexpired restartable schedules of the same
  code left by an earlier process.
- `command-scheduled-turns-restart-v1` advertises continuity, and `schedule()`
  returns `survivesRestart` for each accepted schedule.
- Released openclaw#180282 readers decode the unchanged envelope, ignore the binding
  and end the schedule at its next occurrence; that ended schedule stays
  ended after upgrading again.
@fuller-stack-dev
fuller-stack-dev force-pushed the feat/plugin-command-schedule-restart branch from 7dc20d2 to 6b3dabf Compare October 22, 2026 18:17
Remove the test-only process identity setter from the scheduler module. The
in-process restart tests now replace the identity the Gateway thread reports
to the scheduler with a module mock; the claim, plugins and state database stay
real, and real Gateway processes cover the same restart in the E2E.
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Responses to the review of 7dc20d24. The current head is 660d137c.

  • Real behavior proof / security final-effect evidence / merge risk. Added to the PR body, from real Gateway processes on one state directory.
    • After a crash and restart, the authorized schedule's occurrence ran in the new process, and its native child reached the provider and returned done.
    • A child queued behind a holder was refused when its requester was demoted (users.setRole), with no acceptedAt or startedAt and no provider request. The in-flight holder was killed.
    • The next occurrence after the demotion was refused before any plugin effect or provider request (Restart recovery operator identity changed.).
  • [P3] test-only process identity setter. Removed from src/cron/plugin-command-schedule.ts. The in-process restart tests now replace that identity with a module mock; the E2E covers the real process restart.
  • Merge conflict. Rebased onto a8be68fc0d6 and resolved alongside test: scheduled-command demotion case depends on test order #180818's capacity helper and the cron runner's storePath.
  • Data-model compatibility. Added to the PR body. The released command-schedule build and this build alternated over one state directory: upgrade, rollback, then upgrade again. Existing schedules and automations load. A released-build schedule ends at its claim on this build, as it would after any restart. Rolling back ends a re-armed schedule, and that schedule stays ended after upgrading again. This PR adds no table, column or schema version. The stable v2026.10.5 upgrade path is unchanged; feat(plugins): let requester commands schedule bounded follow-up turns #180282 (comment) covers it.
  • Rollback test value. I kept it on purpose, following feat(plugins): let plugins recover native subagents they launched #180274: it freezes the released reader's strict envelope contract, so a future envelope change fails in CI. The real released build above now provides the process-level proof.

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 22, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Data-model compatibility: latest-stable upgrade. I added a run from npm [email protected] (fe06181) to the PR body, using real processes on one isolated profile.

  1. The stable Gateway wrote:
    • a session with a real provider reply;
    • an enabled agentTurn job, a disabled job and the managed heartbeat;
    • the setting agents.defaults.timeoutSeconds: 321.
  2. This head's openclaw doctor --fix --non-interactive --yes exited 0. A launchctl shim recorded no service calls.
  3. This head's Gateway then loaded everything intact:
    • all three jobs, with the disabled job still disabled and the heartbeat converted to agentTurn;
    • the stable reply, still in chat.history;
    • the setting.
  4. On the upgraded profile, a new schedule reported survivesRestart: true. It ticked, the Gateway crashed, and it ticked again in the new process.

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor 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. labels Oct 22, 2026
@fuller-stack-dev
fuller-stack-dev merged commit dfe0396 into openclaw:main Oct 22, 2026
167 checks passed
steipete added a commit that referenced this pull request Oct 22, 2026
Remove redundant observation and audit forwarding paths and the obsolete message-tool-outcome schema module. Preserve synchronous warm dispatch, cold input capture before recovery, receiver binding, no-replay behavior, and the existing audit writer ownership. SQL, transactions, schemas, request counts, public SDK surfaces and effect-authority checks are unchanged.

Production +22/-45 (net -23); total net -25. Direct commands allocate one fewer adapter and forwarding closure; no timing claim.

Validation: focused schema, audit, Workboard/observation and wrapper-inventory tests; type-aware lint, types, source/architecture guards, Knip/Madge and database ratchets. All three exact-head PostgreSQL conformance shards passed. The CI owner-selection assertion introduced on newer main by #180844 reproduces identically on main dfe0396; recorded for main repair. Independent component reviews and exact-head coordinator/PostgreSQL review approved the change.

Source provenance: #170138, #165561 and #177694 (Peter Steinberger).
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
…ts (openclaw#180844)

* feat(plugins): keep requester command schedules across Gateway restarts

Requester-admitted scheduled command turns (openclaw#180282) ended when the Gateway
restarted. Accepted schedules now survive a restart, within their original
bounds and under the same per-occurrence authority checks.

- A schedule accepted from a plugin whose loaded source has a captured
  digest records a private restart binding in job state: the serving
  Gateway process and plugin instance, plus that source digest. The released
  `pluginCommand` envelope and payload kind are unchanged; no table, column or
  schema version is added.
- After a restart, the scheduler's launch claim re-arms the schedule onto the
  newly loaded instance only if it runs the same code: the same plugin ID,
  source, root and version, the exact captured source digest, and the target
  command still registered. The re-arm, the budget check, the receipt and the
  charge share one state transaction. The Gateway thread supplies the loaded
  instances.
- The deadline, maxRuns and spent attempts carry over. Expired, exhausted,
  disabled, removed and completed schedules are never re-armed. Without a
  matching instance (disabled, uninstalled or changed plugin) the claim
  retires the schedule before running plugin code or spending an attempt.
- Each occurrence still restores the original requester and rechecks the
  operator, parent session, plugin instance and code, command and tool
  ceiling; a demoted or removed requester is refused before the command runs.
- In-process plugin reloads still retire schedules bound to the replaced
  instance. Core-bundled plugins have no captured digest and keep
  restart-scoped schedules.
- The active cap also counts unexpired restartable schedules of the same
  code left by an earlier process.
- `command-scheduled-turns-restart-v1` advertises continuity, and `schedule()`
  returns `survivesRestart` for each accepted schedule.
- Released openclaw#180282 readers decode the unchanged envelope, ignore the binding
  and end the schedule at its next occurrence; that ended schedule stays
  ended after upgrading again.

* test(plugins): simulate the restarted process without a production hook

Remove the test-only process identity setter from the scheduler module. The
in-process restart tests now replace the identity the Gateway thread reports
to the scheduler with a module mock; the claim, plugins and state database stay
real, and real Gateway processes cover the same restart in the E2E.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
…w#180928)

Remove redundant observation and audit forwarding paths and the obsolete message-tool-outcome schema module. Preserve synchronous warm dispatch, cold input capture before recovery, receiver binding, no-replay behavior, and the existing audit writer ownership. SQL, transactions, schemas, request counts, public SDK surfaces and effect-authority checks are unchanged.

Production +22/-45 (net -23); total net -25. Direct commands allocate one fewer adapter and forwarding closure; no timing claim.

Validation: focused schema, audit, Workboard/observation and wrapper-inventory tests; type-aware lint, types, source/architecture guards, Knip/Madge and database ratchets. All three exact-head PostgreSQL conformance shards passed. The CI owner-selection assertion introduced on newer main by openclaw#180844 reproduces identically on main d41e3f8; recorded for main repair. Independent component reviews and exact-head coordinator/PostgreSQL review approved the change.

Source provenance: openclaw#170138, openclaw#165561 and openclaw#177694 (Peter Steinberger).
fuller-stack-dev added a commit to fuller-stack-dev/openclaw that referenced this pull request Oct 23, 2026
… the same build

Requester-command schedules from core-bundled plugins ended at every Gateway
restart because those plugins load host-owned modules without a captured
source digest (openclaw#180844). Give them a code identity derived from the exact
loaded OpenClaw build: the build ID in that build's dist/build-info.json, read
once at process start, plus the plugin ID and the real root and entry inside
the build's own dist or dist-runtime extensions. They then re-arm under the
same rules as installed plugins. Any other build, a disabled plugin, a source
run without a build record, or bundled code outside the build's output ends
the schedule as before.
fuller-stack-dev added a commit that referenced this pull request Oct 23, 2026
… the same build (#181331)

Requester-command schedules from core-bundled plugins ended at every Gateway
restart because those plugins load host-owned modules without a captured
source digest (#180844). Give them a code identity derived from the exact
loaded OpenClaw build: the build ID in that build's dist/build-info.json, read
once at process start, plus the plugin ID and the real root and entry inside
the build's own dist or dist-runtime extensions. They then re-arm under the
same rules as installed plugins. Any other build, a disabled plugin, a source
run without a build record, or bundled code outside the build's output ends
the schedule as before.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 24, 2026
… the same build (openclaw#181331)

Requester-command schedules from core-bundled plugins ended at every Gateway
restart because those plugins load host-owned modules without a captured
source digest (openclaw#180844). Give them a code identity derived from the exact
loaded OpenClaw build: the build ID in that build's dist/build-info.json, read
once at process start, plus the plugin ID and the real root and entry inside
the build's own dist or dist-runtime extensions. They then re-arm under the
same rules as installed plugins. Any other build, a disabled plugin, a source
run without a build record, or bundled code outside the build's output ends
the schedule as before.
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 gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. plugin: file-transfer proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XL 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