Skip to content

fix(cron): preserve scheduled accounts and restart retry deadlines - #180677

Merged
vincentkoc merged 5 commits into
mainfrom
fix/cron-inference-loop-liveness-1022-01a163a6
Oct 23, 2026
Merged

vincentkoc merged 5 commits into
mainfrom
fix/cron-inference-loop-liveness-1022-01a163a6

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Cron inference capture could bind a scheduled job to the creator's interactive account even when scheduled execution selected a different configured model or account. Recurring jobs interrupted by a Gateway restart could also record a retry deadline earlier than their enforced error backoff, then shift an every schedule after the retry succeeded.

User Impact

Scheduled jobs retain the account selected by their scheduled model policy, including Gmail hook and explicitly bound execution-session selection. Restarted recurring jobs expose the deadline the scheduler can actually honor and resume their authored interval afterward. One-shot retries, cancellation semantics, failure limits, and explicit model overrides remain unchanged. No new configuration or automatic repair of existing stored account bindings is introduced.

Why This Change Was Made

Inference capture now uses the scheduled-model owner, including model overrides from a persistent execution target; creator auth inheritance remains separate. Restart scheduling reuses the canonical failure backoff and interval-anchor calculation. A real failed retry normalizes malformed persisted failure counts before incrementing them; interrupted or cancelled attempts do not count as new failures.

The native tooling dependency resolver also keeps repository-local hook Git variables out of explicit donor metadata probes, without changing the commit environment or qualification guards. The prepared-runtime test fixture includes its required catalog and uses the canonical runtime directory resolver. Existing fixture setup lives in coherent sibling test-support modules to satisfy required line caps without removing assertions.

Evidence

  • Complete 23-path candidate passed fresh independent full-delta source review through P2. Signed commit 38a58056ecef1f06cba2d5787d7a575bfbddb792 has exactly the reviewed tree; required hooks, staged line-cap ratchet and whitespace checks passed.
  • Exact-head CI https://github.com/openclaw/openclaw/actions/runs/39883214714 completed success:53 successful jobs,26 nonselected/skipped jobs (not passes), no failures. Required owning/affected proof is178 passing tests across13 files, including13 operator-continuation cases, both original scheduled-recipe archive identity assertions, the22-case tooling suite and all38 Gateway inference-binding cases.
  • Focused bootstrap regression is red on the original resolver and green after the fix under inherited hook Git directory/worktree/temporary index context. Genuine sparse and different-origin donors reject; parent environment/index remain unchanged.
  • Prior-head CI https://github.com/openclaw/openclaw/actions/runs/39880599593 failed9 operator-continuation cases because the shared catalog fixture supplied a different credential-owner directory for capture than execution. This revision corrects that fixture owner without weakening the real authorization guard; the formerly failing13-case suite now passes. That failed run is neither passing nor inherited evidence.
  • Four new Gateway cases actually passed: isolated/current exclusion of creator model overrides, persistent target capture, and explicit payload precedence. All three requested type leaves (services-cron, commands-doctor, gateway-methods), tooling test types, lint, exact23-file oxfmt/Bun parity and baseline/line-cap ratchets passed on this exact head.
  • Earlier CI https://github.com/openclaw/openclaw/actions/runs/39877412156 failed on fixture/catalog, invalid public-RPC fixture and Number.NaN lint issues. Those corrections remain included; that run is not reported as passing.
  • No production restart/deployment, local project dependency install/relink or replacement test resource. The formatter staged the unchanged checksum-pinned Bun binary in its tool cache.

Keep the existing recurring backoff in persisted restart retry times without increasing the failure streak. Cover restart delivery, one-shot timing, cancellation, and repeated recovery.
Reuse cron model precedence for inference capture and migrate internal callers to a model-only selector input. Prove selected-account persistence and real embedded-runner requests after defaults change.
@vincentkoc vincentkoc self-assigned this Oct 22, 2026
@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.

@vincentkoc
vincentkoc marked this pull request as ready for review October 22, 2026 14:02
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations size: M labels Oct 22, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro 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 captures accounts using scheduled-model precedence and includes recurring restart backoff in saved retry deadlines.

Example: The interactive model selects openai:platform, while subagents.model selects openai/gpt-4o@openai:subscription.

  • Before: A new automation records openai:platform despite its scheduled account selection.
  • After: The automation records openai:subscription and retains that binding across later default changes.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused, useful source changes with meaningful integration coverage; supplied execution evidence is harness-based and current-head CI failures remain unattributed.
Proof confidence 🦐 gold shrimp (3/6) The ordinary proof gate is exempt for this maintainer-authored PR; inspected production-path fixtures cover Gateway account persistence, restart delivery, forbidden personal callers, and revoked or replaced bindings before HTTP, with provider I/O substituted.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: New automations can retain the wrong account, and recurring restart retries can advertise a deadline at which they cannot run.
Reason: The maintainer-authored direction restores existing account-selection and scheduling contracts with a small implementation.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses two current cron defects with focused changes. No definite introduced bug was found, but current-head CI failures remain unattributed.

Priority: P2
Reviewed head: b340be7689fa948ca5a59e49e1ca5baf1256f8d2

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway cron admission captures model-account ownership into SQLite; scheduled execution consumes that binding, while the scheduler persists and enforces retry deadlines.

flowchart TD
  A[Gateway cron request] --> B[Scheduled model selector]
  B --> C[Credential authorization owner]
  C --> D[Cron SQLite store]
  D --> E[Scheduler and restart recovery]
  E --> F[Agent execution]
  F --> G[Provider request]
Loading

Technical review

Best possible solution:

Retain the shared scheduled-model selector and existing scheduler backoff owner, then settle current-head CI attribution before landing.

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

Current main uses interactive model selection during account capture and publishes a restart retry earlier than recurring admission permits; the added regressions target both paths, but no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch fixes both producer-side inconsistencies using existing owners, migrates selector callers together, and adds no parallel policy or persistent state.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 3cd9bddb36d9.

Provenance checked

  • Inference-account capture keeps the original intent (d25a316: Retain the selected authorized account across model/default changes without switching identity or billing.)
  • Restart retry timing keeps the original intent (2d3cb1c: Continue eligible interrupted scheduled work through a fresh cron occurrence with current authority.)
  • Shared scheduled-model selector keeps the original intent (f1a2155: Centralize precedence while preserving explicit rejection, advisory fallback, account selection, and policy scope.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 2d3cb1c adds src/cron/service/jobs-scheduling.ts:36 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2d3cb1c426ab; files: src/cron/service/jobs-scheduling.ts)
  • Jason (Json): Raw commit d25a316 adds src/cron/inference-binding.runtime.ts:18 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d25a316fc7c3; files: src/cron/inference-binding.runtime.ts)
  • stevenlee-oai: Raw commit a5956b0 adds src/cron/inference-binding.runtime.ts:63 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: a5956b00d23d; files: src/cron/inference-binding.runtime.ts)

PR surface

Source +19, Tests +106, Docs +6. Total +131 across 15 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 44 25 +19
Tests 7 172 66 +106
Docs 2 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 222 91 +131

Review metrics

Metric Value Why it matters
Production versus test changes Production +44/-25; tests +172/-66 The production growth reuses existing selection and scheduling owners; test growth covers persisted account choice and restart delivery at the advertised deadline.

Labels

Label changes:

  • add P2: Wrong scheduled-account capture and misleading recurring retry deadlines affect specific automation configurations without establishing a broad outage.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Wrong scheduled-account capture and misleading recurring retry deadlines affect specific automation configurations without establishing a broad outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Determine whether the current-head typecheck and auth-profile propagation failures are introduced or inherited.

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.

Reviewed October 22, 2026, 10:20 AM ET / 14:20 UTC.

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 23, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the clawsweeper:intake:bug Preliminary submission classification; full source review pending. label Oct 23, 2026
@clawsweeper clawsweeper Bot added the clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. label Oct 23, 2026
@vincentkoc
vincentkoc merged commit 393a1ea into main Oct 23, 2026
169 checks passed
@vincentkoc
vincentkoc deleted the fix/cron-inference-loop-liveness-1022-01a163a6 branch October 23, 2026 01:37
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
…penclaw#180677)

* fix(cron): align restart retry deadlines with admission

Keep the existing recurring backoff in persisted restart retry times without increasing the failure streak. Cover restart delivery, one-shot timing, cancellation, and repeated recovery.

* fix(cron): capture scheduled model account selection

Reuse cron model precedence for inference capture and migrate internal callers to a model-only selector input. Prove selected-account persistence and real embedded-runner requests after defaults change.

* fix(cron): preserve scheduled inference and restart cadence

* fix(tooling): preserve explicit donor probes in Git hooks

* fix(cron): align target-session capture and fixture owners

Co-authored-by: Vincent Koc <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 3, 2026
…og owner

Since #180677, cron.add captures its inference binding through the published
model catalog owner. A booted Gateway publishes that owner at startup; the
in-process mutation fixture has no Gateway lifecycle, so its first cron.add
cold-built a read-only model runtime before reaching validation and hit the
10s in-process request timeout on hosted Node. Supply the published owner the
Gateway would serve so the cases measure caller closure, not catalog warmup.

(cherry picked from commit 5e495de)
RomneyDa added a commit that referenced this pull request Nov 3, 2026
…og owner (#191904)

Since #180677, cron.add captures its inference binding through the published
model catalog owner. A booted Gateway publishes that owner at startup; the
in-process mutation fixture has no Gateway lifecycle, so its first cron.add
cold-built a read-only model runtime before reaching validation and hit the
10s in-process request timeout on hosted Node. Supply the published owner the
Gateway would serve so the cases measure caller closure, not catalog warmup.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 4, 2026
…og owner (openclaw#191904)

Since openclaw#180677, cron.add captures its inference binding through the published
model catalog owner. A booted Gateway publishes that owner at startup; the
in-process mutation fixture has no Gateway lifecycle, so its first cron.add
cold-built a read-only model runtime before reaching validation and hit the
10s in-process request timeout on hosted Node. Supply the published owner the
Gateway would serve so the cases measure caller closure, not catalog warmup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts 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