R452 · Agent principles and patterns › Long-running agents and durable execution

Your scheduler is not a clock: three schedulers, two of them local, and the offsets they add on purpose

Read the original

schedulingcrondurable-executionharnesspermissionsprompt-cachinglocal-vs-cloud

A coding-agent product now ships three separate schedulers, and its documentation compares them in one table. Two run on your own machine. The interesting part is not the feature matrix — it is that both local schedulers deliberately fire at a different time than the schedule you wrote, for good reasons, in different ways, and a prompt written as if the schedule were a clock will misfire.

The three, and what actually separates them

CloudDesktop (local)In-session (local)
Needs your machine onNoYesYes
Needs an open sessionNoNoYes
Survives restartsYesYesOnly on resume, with exceptions
Local file accessNo — fresh cloneYesYes
MCP serversConfigured per taskConfig files and connectorsInherited from the session
PermissionsAuto mode by defaultConfigurable per taskInherited from the session
Minimum interval1 hour1 minute when the model sets it; 1 hour in the forms1 minute

The product's own advice is a clean three-way split: cloud for work that must run without your machine, Desktop when the task needs local files and tools, in-session for quick polling during a session.

Two details in that table deserve more weight than they get. First, the in-session scheduler requires an open session, which makes it a polling loop with a cron syntax rather than a scheduler. Second, the Desktop forms cap you at hourly while asking the model to set the schedule does not — the model can go to one minute and can schedule a single run at a future time. The constraint is in the form, not the engine.

A third, easy to miss: by default local scheduled tasks run against whatever state the working directory is in, including uncommitted changes. There is an isolated-worktree option, but it is off unless you turn it on, and only for Git repositories. A nightly task in a directory where you left a half-finished refactor runs against the half-finished refactor.

Both local schedulers shift your run time on purpose

Desktop adds a small delay of a few minutes after the scheduled time to stagger API traffic. It is deterministic — the same task always starts at the same offset — which is the right design, because it makes the behaviour reproducible rather than merely random.

In-session is more aggressive and more interesting. A recurring task starts each run late by up to half the gap to the next run, capped at 30 minutes:

ScheduleWhen each run actually starts
Every 5 minutes (*/5 * * * *)4 min 45 s after the previous run — early, not late
Every 10 minutes0–5 minutes late
Every 30 minutes0–15 minutes late
Hourly or less often0–30 minutes late

So a task you wrote as 0 9 * * * runs somewhere in the 9:00–9:30 window — at the same offset each day for evenly spaced schedules, but at a different offset per fire for unevenly spaced ones such as :00 and :15.

The five-minute exception is the most instructive line in the documentation. A task written */5 is not delayed; it runs 15 seconds early. The stated reason is that a run exactly five minutes after the previous one would land just after a five-minute prompt cache had expired, so each run starts slightly sooner to stay inside the cache window. That is a scheduler whose timing is tuned to a caching TTL — worth knowing, because it means the interval you pick interacts with billing, not just with freshness.

One-shot tasks go the other way: one scheduled for :00 or :30 runs up to 90 seconds early, while one scheduled for any other minute is not shifted at all. The documented workaround is to schedule off the hour — 3 9 * * * rather than 0 9 * * * — when the timing matters.

Missed runs: one scheduler catches up, the other does not

This is the sharpest behavioural difference, and the one most likely to produce a wrong result rather than a late one.

Desktop checks on app start or machine wake whether each task missed any runs in the last seven days. If so it starts exactly one catch-up run, for the most recently missed time, and discards everything older. A daily task that missed six days runs once.

The documentation then states the consequence plainly, and it is the kind of warning most products leave out: a task scheduled for 9am might run at 11pm if the computer was asleep all day. Its recommended mitigation is not a setting — it is to write the guardrail into the prompt itself, along the lines of "only review today's commits; if it's after 5pm, skip the review and post a summary of what was missed."

That is the right advice and it generalises past this product. If a scheduled prompt's correctness depends on when it runs, the prompt has to check the time itself. The scheduler is not going to tell it, and a catch-up run looks identical to an on-time one from inside.

In-session has no catch-up at all. If a task comes due while the agent is mid-response it fires once when the agent goes idle, not once per missed interval. Scheduled prompts fire between turns, never mid-turn.

Desktop also skips runs for reasons worth auditing: the computer was asleep, the previous run was still in progress, or other scheduled tasks were already running. All three appear in the task's history with the reason on hover — so "it ran" and "it was due" are separately observable, which is more than most schedulers offer.

Lifetimes, and a version-dependent trap

In-session recurring tasks expire 30 days after creation: the task fires one final time, then deletes itself, which bounds how long a forgotten loop can run. Reasonable.

The trap: before a specific version the limit was seven days, and tasks created on those versions keep the seven-day limit. So two tasks that look identical, created on two machines, can have lifetimes differing by a factor of four, with nothing in the task itself recording which. If you depend on a long-lived in-session task, either recreate it before expiry or use one of the durable schedulers.

Operational details worth knowing before you rely on any of this

Review checklist

  1. Pick on durability, not on syntax. Needs the machine off → cloud. Needs local files → Desktop. Polling inside a session you are watching → in-session. The cron syntax being similar across them is not a reason to treat them as interchangeable.

  2. Assume the fire time is a window, not a point. Up to 30 minutes late for hourly-or-slower in-session tasks; a deterministic few minutes for Desktop.

  3. Make time-sensitive prompts check the clock themselves, and say what to do on a late run. A catch-up run is indistinguishable from an on-time one from inside the prompt.

  4. Decide what a missed window means before you choose a scheduler: exactly one catch-up (Desktop) versus none (in-session) is a correctness difference, not a convenience one.

  5. Turn on worktree isolation for any local task whose result would be wrong if run against uncommitted changes.

  6. Run once manually and clear every permission prompt, then set the task's permission mode deliberately rather than relying on per-session approvals.

  7. Check the expiry semantics for your version if you rely on a long-lived in-session task.

  8. Schedule off the hour — :03 rather than :00 — when a one-shot's timing matters, to avoid the early-fire shift.

  9. Read the skipped-run history, not just the success history. Asleep, overlapping and concurrency-limited skips all look like nothing happening.

The generalisable point

Every one of these offsets exists for a defensible reason: staggering API load, staying inside a cache window, bounding forgotten loops. A scheduler built for a shared backend optimises for the fleet, and the price is paid in the precision of any single task's fire time. Documentation that states the offsets, their direction, and their cap is doing you a favour — the alternative is discovering them from a task that ran at 11pm and reviewed yesterday's commits as though they were today's.

Connections

See R452 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.