Repository navigation
Description
PRD: portable durable scheduling — remaining work
Status: Partially implemented
Owner: Solid Objects maintainers
Reminders now cover most of the original scope in both JS adapters. This description has been rewritten to the parts that are not done, so nobody re-implements what shipped. The shipped portion is recorded at the bottom.
Remaining requirements
-
SCHED-005 (partial): A
skipmissed-run policy shall exist, dropping missed occurrences and waiting for the next scheduled time.latest(run once for a missed window) andall(catch up on every missed occurrence) already exist. Decided (Lucas, 29 Nov 2026): keep the public nameslatestandall, and addskip. Do not rename. Document thatlatestis the original PRD'srun_onceandalliscatch_up. Addingskipalso changes the SQLmissed_policycheck constraint and the Durable Objects storedmissedvalue. -
SCHED-007 (partial): Inspection shall return status, next run, last run, attempt, and failure information without mutating actor state. Status and next run already exist on the actor-facing
ScheduledReminder. Decided (Lucas, 29 Nov 2026): add the three remaining fields toScheduledReminderon both JS adapters.reminder()andreminders()stay a read.lastRunAtMilliseconds, ornullif the reminder has never been enqueued. This is the time the runtime last enqueued the reminder as a mailbox message, not when that operation finished. Neither adapter stores it today. SQL needs a column. The Durable ObjectsReminderrecord needs a field.occurrence, the number of times this reminder has been enqueued. Document it as the original PRD's "attempt". Do not expose Durable Objectsgenerationon the actor API; it is a UUID that changes on schedule and on resume, not a count. Do not put the mailbox retry count onScheduledReminder; retries stay on the message. SQL already storesoccurrence, and operator-facingReminderRecordalready exposes it. Durable Objects stores no count today and needs one. JSdocs/api.mdcurrently saysScheduledReminderomits an occurrence count because SQL tracks one and Durable Objects does not. That sentence changes once both adapters store and return it.errorName, ornull, the error that paused the reminder, matching operator-facingReminderRecord. SQL writeserrorwhen firing fails because the operation is unknown. Durable Objects pauses the reminder when the mailbox message is exhausted or too large, and stores no error. Both adapters must writeerrorNamewhen they pause a reminder. Mailbox retries and dead letters stay on the message.- On replace: keep
lastRunAtMillisecondsandoccurrence, and clearerrorName. SQL already keepsoccurrenceand clearserroron replace. Durable Objects currently overwrites the whole record, so it must keep those two.
Remaining acceptance criteria
- One conformance suite across adapters covering create, replace, cancel, recurring execution, the missed-run policies
latest,all, andskip, actor-facinglastRunAtMilliseconds,occurrence, anderrorName(a replace keeps the first two and clearserrorName), restart recovery, that a fired reminder still runs whenauthorizeMessagereturns false while an external enqueue of the same operation still goes throughauthorizeMessage, and duplicate delivery. Today SQL and Durable Objects scheduling are tested separately.test/support/portable-runtime-contract.tsexercises no scheduling at all.- Both
latestandallexist in code on both adapters. The Durable Objects recovery test coverslatestonly. No Durable Objects test found coversallcatching up every missed occurrence. - SQL tests recover a reminder claimed by a stale process, and reject an unknown reminder operation before persistence. No test found covers that a fired reminder still runs when
authorizeMessagereturns false, that an external enqueue of the same operation still goes throughauthorizeMessage, or that a fired reminder is not delivered twice. Both adapters enqueue the fired reminder with an idempotency key, which is what would suppress a duplicate. - This is the highest-value item left on this issue.
- Both
- Document the timing contract. Decided (Lucas, 29 Nov 2026): document what the code does today. Do not invent a time zone or clock-skew guarantee. JS
schedule({ at })storesat.getTime()as epoch milliseconds and compares that with the runtime's now. Retry and retention of a fired reminder follow the mailbox message it enqueued. Time zone and clock skew are not a documented guarantee in the JS or Ruby docs. This issue does not add a Ruby docs change.
Not planned
reschedule(handle, { runAt })as a distinct method. SCHED-002 is satisfied: scheduling an existing name replaces its next occurrence atomically, and the repository reports the replacement with its previous run time. A second spelling of that would add surface without adding capability. Reopen if the ergonomics prove otherwise.- A return value from
unschedule/unscheduleAllthat reports whether a schedule was removed (SCHED-003). Cancellation stays an intent that returns nothing, matching OrleansUnregisterReminderand Durable ObjectsdeleteAlarm. Whether an alarm is present is answered byreminder/reminders, which already include this turn's staged intents. Reopen if a caller cannot get that answer from the read.
Already implemented, for reference
- SCHED-001
schedule({ at:, every:, missed:, key: })returns a durable handle in both JS adapters. - SCHED-002 A name identifies at most one active schedule per actor, and rescheduling replaces the next occurrence atomically.
- SCHED-004 One-shot and recurring schedules, cancellable by operation, by key, or by handle.
- SCHED-006 A fired reminder enqueues an internal mailbox message, so it inherits mailbox ordering, retry, dead letters, and deduplication. Decided (Lucas, 29 Nov 2026): the fire does not call
authorizeMessage. Internal delivery skips it, as JSdocs/api.mdalready says. An external enqueue of the same operation still goes throughauthorizeMessage. The 5 Sep PRD said schedule execution shall use normal mailbox authorization; that check at fire time is not what shipped. The idempotency key isreminder:<id>:<occurrence>on SQL andreminder:<generation>:<at>on Durable Objects. Callers should not assume those keys have the same shape. - SCHED-008 Restart recovery on both JS adapters. The SQL scheduler claims due reminders from the reminders table, including a reminder whose claim owner is gone. Durable Objects does not re-arm an alarm in the host constructor.
alarm()runs a pump, and the storage layer sets or deletes the alarm from due work after a pass. If that pump fails, the host sets an alarm at most 30 seconds out. - Docs. JS
docs/api.md, merged in PR #97, saysunschedule()returns nothing because it stages an intent rather than applying one, and thatreminder/remindersanswer whether an alarm is present, including this turn's staged cancels and schedules. Cancellation still returns nothing (see Not planned). Rubydocs/reminders.mdalready said both reads include the current turn's staged changes and does not repeat the old rationale. - The same actor scheduling API runs over SQL polling, PostgreSQL and Redis wake-up, and Durable Object alarms. No caller names the mechanism.
Activity