Repository navigation
fix: keep command cron turns lightweight - #81868
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb4772d5e0
ℹ️ 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".
| } | ||
|
|
||
| const COMMAND_STYLE_CRON_PREFIX = | ||
| /^(?:(?:[A-Z_][A-Z0-9_]*=\S+\s+)+)?(?:cd\s+\S+|(?:\.{1,2}|~)?\/\S+|[A-Za-z]:[\\/]\S+|(?:bash|bun|cargo|deno|docker|gh|git|go|make|node|npm|npx|pnpm|python|python3|ruby|sh|tsx|uv|zsh)\b)/u; |
There was a problem hiding this comment.
Expand command detection to cover generic shell commands
The new auto-lightweight path only triggers when the cron message matches a small allowlist of command prefixes (bash|bun|...|zsh, cd, or path-like forms), so many valid exact commands such as ls -la, echo ok, or sed ... are treated as natural language and keep full bootstrap context. That means the timeout/token-bloat regression this commit targets can still occur for common command-style cron jobs unless users manually set lightContext, which contradicts the commit’s “default exact-command” behavior.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: no. high-confidence live reproduction was established. Source inspection shows current main only honors explicit lightContext and the PR targets that seam, but no failing current-main cron run or after-fix live cron run was executed here. Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Land a version that broadens exact-command detection across embedded and CLI cron paths, preserves the explicit lightContext:false opt-out, and includes redacted real cron run proof. Do we have a high-confidence way to reproduce the issue? No high-confidence live reproduction was established. Source inspection shows current main only honors explicit lightContext and the PR targets that seam, but no failing current-main cron run or after-fix live cron run was executed here. Is this the best way to solve the issue? No. The direction is right, but the proposed command detector needs to cover generic exact shell commands before the PR reliably fixes the described cron timeout/token-bloat regression. Full review comments:
Overall correctness: patch is incorrect What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against c9b6b0be0e36. |
fb4772d to
09c59b0
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09c59b0108
ℹ️ 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".
| } | ||
|
|
||
| const COMMAND_STYLE_CRON_PREFIX = | ||
| /^(?:(?:[A-Z_][A-Z0-9_]*=\S+\s+)+)?(?:cd\s+\S+|(?:\.{1,2}|~)?\/\S+|[A-Za-z]:[\\/]\S+|(?:bash|bun|cargo|deno|docker|gh|git|go|make|node|npm|npx|pnpm|python|python3|ruby|sh|tsx|uv|zsh)\b)/u; |
There was a problem hiding this comment.
Avoid classifying verb-led prose as exact shell commands
The command-style detector treats any single-line cron message starting with allowlisted binaries like make or go as an exact command, so natural-language payloads such as "make sure the nightly report is posted" are misclassified as command-style and forced into lightweight bootstrap mode. This drops normal workspace/bootstrap context for prose requests, changing behavior for legitimate non-command cron turns and making summaries/planning prompts less reliable.
Useful? React with 👍 / 👎.
Summary
lightContext: false.Verification
Behavior addressed: exact-command cron jobs could time out after the Codex migration because scheduled turns loaded workspace identity/bootstrap context before running the command.
Real environment tested: local OpenClaw source checkout, with focused cron isolated-agent tests and Codex app-server turn construction tests.
Exact steps or command run after this patch:
pnpm test src/cron/isolated-agent.session-identity.test.ts;pnpm test extensions/codex/src/app-server/run-attempt.test.ts -t "cron Codex|lightweight cron";pnpm exec oxfmt --check --threads=1 CHANGELOG.md extensions/codex/src/app-server/run-attempt.test.ts extensions/codex/src/app-server/thread-lifecycle.ts src/agents/cli-runner/prepare.ts src/agents/cli-runner/types.ts src/cron/isolated-agent.session-identity.test.ts src/cron/isolated-agent/run-executor.ts;node scripts/run-oxlint.mjs extensions/codex/src/app-server/thread-lifecycle.ts src/agents/cli-runner/prepare.ts src/agents/cli-runner/types.ts src/cron/isolated-agent.session-identity.test.ts src/cron/isolated-agent/run-executor.ts;git diff --check.Evidence after fix: cron regression tests assert command-style payloads get
bootstrapContextMode=lightweight, natural-language cron payloads keep the default context, andlightContext: falseopts out; the Codex app-server test asserts the revised cron instructions.Observed result after fix: all listed checks passed.
What was not tested: live gateway cron execution against a real scheduled job; this PR covers the focused cron/Codex execution seams.