Skip to content

Fix isolated cron cold runner setup timeout#86893

Closed
dredozubov wants to merge 1 commit into
openclaw:mainfrom
dredozubov:codex/cron-codex-isolation
Closed

Fix isolated cron cold runner setup timeout#86893
dredozubov wants to merge 1 commit into
openclaw:mainfrom
dredozubov:codex/cron-codex-isolation

Conversation

@dredozubov

@dredozubov dredozubov commented May 26, 2026

Copy link
Copy Markdown

Summary

  • let long isolated cron jobs wait up to 5 minutes for cold Codex runner setup
  • keep the existing 60s setup watchdog floor for short jobs
  • add regression coverage for the long-job watchdog window

Tests

  • node scripts/run-vitest.mjs src/cron/service/timer.regression.test.ts

Real behavior proof

Behavior addressed: isolated cron agent-turn setup no longer aborts at the old fixed 60s runner-start watchdog when the job has a longer timeout budget; the run stays alive past 60s and then reaches the new bounded setup timeout.

Real environment tested: local OpenClaw cron runtime on PR head 2c969858b6389c7e3e056c1a5e51ab894868bc6b, macOS, Node 26.0.0, isolated temp cron store, no external credentials or network services.

Exact steps or command run after this patch: ran a real-time node --import tsx --input-type=module script from the PR checkout that instantiated CronService, created an isolated agentTurn cron job with timeoutSeconds: 130, started a manual run, withheld the runner-start signal, sampled state after 61s, then let cron reach the derived setup bound.

Evidence after fix: copied terminal output from the real-time cron runtime run:

{
  "openclawHead": "2c969858b6389c7e3e056c1a5e51ab894868bc6b",
  "scenario": "isolated cron agent-turn waits before runner start",
  "configuredTimeoutSeconds": 130,
  "expectedPatchedSetupBoundMs": 65000,
  "after61s": {
    "elapsedMs": 61035,
    "runnerHookEnteredMs": 41,
    "abortObserved": false,
    "cleanupCalls": 0
  },
  "final": {
    "elapsedMs": 65067,
    "abortObservedAtMs": 65044,
    "cleanupCalls": 1,
    "cleanupTimeoutMs": 130000,
    "runResult": {
      "ok": true,
      "ran": true
    },
    "lastRunStatus": "error",
    "lastStatus": "error",
    "lastError": "cron: isolated agent setup timed out before runner start",
    "persistedJobs": 1
  },
  "events": [
    {
      "action": "started",
      "elapsedMs": 34,
      "jobId": "2ddaca0a-a12e-4b7c-b7d9-2ab0746ee121"
    },
    {
      "elapsedMs": 65061,
      "level": "warn",
      "message": "cron: job run returned error status",
      "payload": {
        "jobId": "2ddaca0a-a12e-4b7c-b7d9-2ab0746ee121",
        "jobName": "PR 86893 live setup-window proof",
        "error": "cron: isolated agent setup timed out before runner start",
        "diagnosticsSummary": "cron: isolated agent setup timed out before runner start"
      }
    },
    {
      "action": "finished",
      "elapsedMs": 65062,
      "jobId": "2ddaca0a-a12e-4b7c-b7d9-2ab0746ee121",
      "status": "error",
      "error": "cron: isolated agent setup timed out before runner start",
      "durationMs": 65014
    }
  ]
}

Observed result after fix: at 61.035s cron had not aborted and cleanup had not run; at about 65.044s cron aborted the pre-runner setup phase and recorded cron: isolated agent setup timed out before runner start, matching the patched derived bound for a 130s isolated job instead of the previous fixed 60s abort.

What was not tested: a full external Codex provider cold start with live model credentials was not run; this proof isolates the cron watchdog path before runner start, which is the changed runtime behavior.

@clawsweeper

clawsweeper Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close this PR as superseded: the useful cron setup-timeout idea is now covered by a newer clean replacement that implements the change in the current watchdog owner with telemetry and proof, while this branch is conflicting and targets the old timer.ts owner.

Root-cause cluster
Relationship: superseded
Canonical: #96219
Summary: The current PR and the replacement both address the fixed isolated cron setup watchdog; the replacement is the clean canonical landing path.

Members:

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

Canonical path: Close this branch and let maintainers review or land #96219 as the clean canonical implementation if they accept the availability tradeoff.

So I’m closing this here and keeping the remaining discussion on #96219.

Review details

Best possible solution:

Close this branch and let maintainers review or land #96219 as the clean canonical implementation if they accept the availability tradeoff.

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

Yes. Current main source still uses a fixed 60s pre-runner setup watchdog while isolated agentTurn jobs can have much larger timeout budgets; the PR body also supplies after-fix runtime output.

Is this the best way to solve the issue?

No. The idea is valid, but this branch is no longer the best implementation path because #96219 applies the same fix in the current watchdog owner and carries telemetry/proof.

Security review:

Security review cleared: The diff only changes cron timeout logic and tests; no dependency, secret, CI, package, or supply-chain surface was introduced.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • ghitafilali: Authored the merged setup-timeout gateway restart work that added the current restart/telemetry consumer around this failure class. (role: recent adjacent contributor; confidence: medium; commits: b2c5e790b441; files: src/cron/service/agent-watchdog.ts, src/cron/service/timer.ts, src/gateway/server-cron.ts)
  • steipete: Recent path history shows the split of cron timer helpers into agent-watchdog.ts, which is the owner this PR now needs to target. (role: current watchdog module refactor contributor; confidence: medium; commits: 9d31cbbd6ad8, 1e7510ae103e; files: src/cron/service/agent-watchdog.ts, src/cron/service/timer.ts)
  • vincentkoc: Recent main history includes cron timer and regression-test maintenance near the affected service files. (role: recent cron service contributor; confidence: medium; commits: 44ae2fd93601, efbefceb0e2e; files: src/cron/service/timer.ts, src/cron/service/timer.regression.test.ts)
  • aaroneden: Authored the clean replacement PR and is credited in the merged setup-timeout retry work that touches the same failure family. (role: canonical replacement author and adjacent retry contributor; confidence: medium; commits: ea14857772d2, 73aab309894d; files: src/cron/service/agent-watchdog.ts, src/cron/service/timer.ts, src/cron/retry-hint.ts)

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

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 26, 2026
@clawsweeper

clawsweeper Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg: ✨ hatched ✨ glimmer Cosmic Shellbean. Rarity: ✨ glimmer. Trait: polishes edge cases.

Details

Share on X: post this hatch
Copy: My PR egg hatched a ✨ glimmer Cosmic Shellbean in ClawSweeper.
Hatchability:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

About:

  • Eggs appear after real-behavior proof passes. They are collectible flavor only.
  • Review momentum changes the shell state: follow-up work warms it, re-review makes it wobble, and a clean final review lets it hatch.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 26, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels May 26, 2026
@dredozubov
dredozubov force-pushed the codex/cron-codex-isolation branch from 634e73c to 2c96985 Compare May 28, 2026 06:37
@openclaw-barnacle openclaw-barnacle Bot added size: S proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 28, 2026
@dredozubov

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 28, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed 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. labels May 29, 2026
@dredozubov
dredozubov force-pushed the codex/cron-codex-isolation branch from 2c96985 to e864cf5 Compare May 29, 2026 04:52
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels May 29, 2026
@clawsweeper clawsweeper Bot removed the status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. label May 29, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 15, 2026
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Jun 19, 2026
@clawsweeper

clawsweeper Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S 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.

2 participants