Repository navigation
fix(agents): disable default cron idle timeout for isolated runs - #60210
skainguyen1412 wants to merge 3 commits into
Conversation
Greptile SummaryThis PR fixes a bug where cron-triggered isolated runs inadvertently inherited the embedded runner's default 60-second LLM idle watchdog, causing background scheduled jobs to abort early even when Key changes:
The fix is narrow, correct, and well-tested. One minor coverage gap exists: the new cron test only exercises the Confidence Score: 5/5Safe to merge — the change is minimal, correctly scoped, and well-tested with no risk to non-cron trigger paths. The function signature change is backwards-compatible (single call site updated), the cron guard is placed after all explicit-config checks so explicit user config always wins, existing non-cron behavior is unchanged, and the two new test cases directly lock in the regression scenario described in the bug report. No files require special attention. The only minor gap is a missing companion test for the cfg-present-but-no-idleTimeoutSeconds + trigger: cron path in llm-idle-timeout.test.ts. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/agents/pi-embedded-runner/run/llm-idle-timeout.test.ts
Line: 24-26
Comment:
**Missing cron test with cfg present but unset idleTimeoutSeconds**
The new cron test only checks the `cfg: undefined` path. The case where `cfg` is provided (e.g. agents section exists) but `idleTimeoutSeconds` is not set is a distinct code path that is also exercised by the `trigger === "cron"` guard. It would strengthen the regression lock-in to add a companion case:
```suggestion
it("disables the default idle timeout for cron triggers when not explicitly configured", () => {
expect(resolveLlmIdleTimeoutMs({ cfg: undefined, trigger: "cron" })).toBe(0);
const cfgNoTimeout = { agents: { defaults: { llm: {} } } } as OpenClawConfig;
expect(resolveLlmIdleTimeoutMs({ cfg: cfgNoTimeout, trigger: "cron" })).toBe(0);
});
```
This makes the guard resilient to future refactors that might split the `undefined`-cfg and present-but-empty-llm paths.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "agents: disable default cron idle timeou..." | Re-trigger Greptile |
|
Clean fix, tight scope. The trigger-aware default in One thing I liked: checking Tests cover the two key scenarios (cron default disabled, explicit config still applies). LGTM. |
steipete
left a comment
There was a problem hiding this comment.
Root cause and fix direction both check out.
I verified the relevant call path locally: isolated cron runs invoke runEmbeddedPiAgent with trigger: "cron", and the current shared idle-timeout resolver still defaults to 60s whenever agents.defaults.llm.idleTimeoutSeconds is unset. Moving the cron-specific default policy into resolveLlmIdleTimeoutMs is the right layer, and the regression coverage added here matches that boundary.
This is the stronger fix for the ~60s cron idle-timeout cluster.
Thanks for the review, Peter. Let me know if you’d like any changes. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 293a4416c3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Hi @steipete, I think the PR is ready to merge. The CI/CD failures are not related to this PR. |
|
Thanks @skainguyen1412. This was the right cron-specific behavior. I landed the maintainer patch on main in d9dc75774b. It disables the unconfigured LLM idle watchdog for cron-triggered runs, while still honoring explicit Closing this PR as superseded by the landed commit. |
Summary
Describe the problem and fix in 2–5 bullets:
payload.timeoutSecondswas much higher.payload.timeoutSeconds.agents.defaults.llm.idleTimeoutSecondsis explicitly configured; added regression coverage for the trigger-aware policy.agents.defaults.llm.idleTimeoutSecondsstill wins when set.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause / Regression History (if applicable)
60_000ms) was applied to all triggers, includingcron, even though scheduled background runs can be intentionally quiet for longer than that.git blame, prior PR, issue, or refactor if known): the idle-timeout behavior came fromfeat: add LLM idle timeout for streaming responses(84b72e66b91); cron already had separate outer timeout coverage and logic.2026.4.1, cron-triggered embedded runs started picking up the same default 60-second watchdog as interactive runs.payload.timeoutSeconds; the cron outer timeout path still honors job timeouts and already has regression coverage.Regression Test Plan (if applicable)
For bug fixes or regressions, name the smallest reliable test coverage that should have caught this. Otherwise write
N/A.src/agents/pi-embedded-runner/run/llm-idle-timeout.test.tsagents.defaults.llm.idleTimeoutSecondsis explicitly configured; explicit config still applies to cron.src/cron/service.issue-regressions.test.tsalready covers cron honoringpayload.timeoutSecondson the outer timeout path.User-visible / Behavior Changes
agents.defaults.llm.idleTimeoutSeconds, cron runs still use that configured value.Diagram (if applicable)
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:N/ARepro + Verification
Environment
v22.22.1payload.timeoutSeconds > 60,agents.defaults.llm.idleTimeoutSecondsunsetSteps
payload.timeoutSeconds.Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
./node_modules/.bin/vitest run src/agents/pi-embedded-runner/run/llm-idle-timeout.test.ts./node_modules/.bin/vitest run src/cron/service.issue-regressions.test.ts -t "applies timeoutSeconds to manual cron.run isolated executions"pnpm buildidleTimeoutSeconds: 0still disables the watchdogReview Conversations
Compatibility / Migration
Yes)No)No)N/ARisks and Mitigations
agents.defaults.llm.idleTimeoutSecondsis still honored, and the new regression test locks in the cron-only default behavior change.