qwen-code/packages
Tianyuan 0633b8a985
feat(scheduler): make recurring cron/loop job expiration configurable (#6173)
* feat(scheduler): make recurring cron/loop job expiration configurable

Recurring cron/loop jobs previously auto-expired after a hardcoded 7 days with no way to extend or disable the limit, forcing long-running daemon deployments to recreate jobs weekly.

Add an experimental.cronRecurringMaxAgeDays setting (default 7) and a QWEN_CODE_CRON_MAX_AGE_DAYS environment-variable override (takes precedence, for cloud/container deployments). A value of 0 disables expiry so jobs run until deleted; negative or unparseable values fall back to the 7-day default. The configured limit also applies to durable tasks restored from disk, and the CronCreate tool description now reflects the effective limit instead of a hardcoded '7 days'.

Closes #6167

* refactor(scheduler): drop unused DEFAULT_RECURRING_MAX_AGE_MS export

Review feedback on #6173 — the ms constant is only used inside the module as the constructor default; keep only the days constant public.

* fix(scheduler): align zero max-age semantics and warn on cron expiry misconfiguration

Review feedback on #6173:

- CronScheduler constructor now maps 0 to Infinity (never expire), matching the config layer instead of silently substituting the 7-day default for direct callers.
- Invalid QWEN_CODE_CRON_MAX_AGE_DAYS / cronRecurringMaxAgeDays values now log a warning before falling back to the default, leaving a breadcrumb for misconfigured deployments.
- Durable tasks found past the recurring max age at load now log a warning before their final fire + delete, since a lowered max age retroactively expires long-lived tasks and deletion is unrecoverable.
- New durable-restore tests: a custom max age applies to tasks reloaded from disk, and a disabled max age (Infinity) restores a 30-day-old task as live instead of aging it out.

* fix(scheduler): surface cron expiry warnings on the console

Review feedback on #6173:

- The invalid-config and retroactive-expiry warnings moved from debugLogger (file-only, off unless QWEN_DEBUG_LOG_FILE is set) to console.warn so they reach container/daemon logs where this knob matters; the config warning is latched to fire once per Config instance.
- CronCreateTool's constructor now resolves the max age once instead of three times, so an invalid env var can't emit duplicate warnings during tool registration.

* fix(scheduler): reject non-finite timestamps in durable task validation

Review feedback on #6173: JSON like -1e999 parses to -Infinity, which passes the typeof-number check and then poisons date math — with a finite lastFiredAt the entry reads as an overdue aged task and the retroactive-expiry warning's toISOString() throws RangeError mid-load, so one malformed persisted entry blocks durable cron startup/takeover. Validation now requires finite createdAt (and lastFiredAt when non-null), routing such entries through the existing fix-or-delete contract for corrupt files. Verified the new end-to-end test reproduces the RangeError without the fix.

* refactor(scheduler): single-source the max-age contract and freeze it at Config construction

Review follow-ups on #6173:
- Extract normalizeRecurringMaxAge as the single owner of the
  0/Infinity no-expiry contract, used by both the Config layer and the
  CronScheduler constructor, so the constructor's 0 handling can no
  longer be removed as apparent dead code.
- Resolve QWEN_CODE_CRON_MAX_AGE_DAYS once at Config construction into
  a readonly field, honoring the setting's requiresRestart contract;
  mid-session env changes can no longer make the tool description,
  tool output, and scheduler report different expiries. The warn
  once-latch is now unnecessary (construction warns at most once).
2026-07-03 06:34:37 +00:00
..
acp-bridge chore(release): v0.19.5 (#6194) 2026-07-02 13:38:46 +00:00
audio-capture chore(release): v0.19.5 (#6194) 2026-07-02 13:38:46 +00:00
channels chore(release): v0.19.5 (#6194) 2026-07-02 13:38:46 +00:00
chrome-extension chore(release): v0.19.5 (#6194) 2026-07-02 13:38:46 +00:00
cli feat(scheduler): make recurring cron/loop job expiration configurable (#6173) 2026-07-03 06:34:37 +00:00
core feat(scheduler): make recurring cron/loop job expiration configurable (#6173) 2026-07-03 06:34:37 +00:00
cua-driver feat(cua-driver): sync vendored cua-driver 0.6.8 → 0.7.0 (#6212) 2026-07-03 06:27:00 +00:00
desktop fix(cli): switch TUI prefix ✦→◆ to fix glyph overflow on some terminals (#5974) 2026-06-30 22:44:34 +00:00
sdk-java fix(core): Align MCP OAuth guidance and docs (#5589) 2026-06-24 07:09:53 +08:00
sdk-python doc[sdk-python] Expand Python SDK usage documentation (#3995) 2026-05-12 15:27:00 +08:00
sdk-typescript fix(web-shell): defer session creation until first prompt (#6066) 2026-07-01 14:04:37 +00:00
vscode-ide-companion feat(scheduler): make recurring cron/loop job expiration configurable (#6173) 2026-07-03 06:34:37 +00:00
web-shell feat(web-shell): add daemon UI support for vision model selection (#6209) 2026-07-03 04:31:11 +00:00
web-templates chore(release): v0.19.5 (#6194) 2026-07-02 13:38:46 +00:00
webui fix(web-shell): cut mobile session-switch jank (memoized timeline signature, replay-first dispatch) (#6183) 2026-07-02 21:33:34 +00:00
zed-extension chore(deps): upgrade ink 6.2.3 → 7.0.2 + bump Node engine to 22 (#3860) 2026-05-11 17:29:50 +08:00