From b830d236f5913487f373941718ce6ce8eb9f5a89 Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Mon, 2 Nov 2026 19:34:45 -0600 Subject: [PATCH] docs(id): design recurring cross-world schedules (#1355) --- ..._design_recurring_cross_world_schedules.md | 23 +++++++++++++++++++ doc/README.md | 1 + 2 files changed, 24 insertions(+) create mode 100644 doc/2026-11-03T01-31-11Z_design_recurring_cross_world_schedules/2026-11-03T01-31-11Z_design_recurring_cross_world_schedules.md diff --git a/doc/2026-11-03T01-31-11Z_design_recurring_cross_world_schedules/2026-11-03T01-31-11Z_design_recurring_cross_world_schedules.md b/doc/2026-11-03T01-31-11Z_design_recurring_cross_world_schedules/2026-11-03T01-31-11Z_design_recurring_cross_world_schedules.md new file mode 100644 index 0000000000..35d1ce8ca9 --- /dev/null +++ b/doc/2026-11-03T01-31-11Z_design_recurring_cross_world_schedules/2026-11-03T01-31-11Z_design_recurring_cross_world_schedules.md @@ -0,0 +1,23 @@ +# Recurring and cross-world scheduled events + +**Status:** Initial design for issue [#1355](https://github.com/developing-today/code/issues/1355), 2026-11-03. + +## Intent + +Keep one-shot schedules compatible while adding finite recurring schedules and delivery to another world only with explicit consent. `time.tick` remains a separate, unchanged mechanism. + +## Durable recurrence and bounds + +A schedule remains one pending record keyed by its existing ID. The record carries its next due time, an optional fixed interval, and a finite remaining-fire count; cross-world records also carry the destination world. Recurrence is fixed-rate: after firing at planned time `t`, the next due time is `t + interval`, never `now + interval`. This prevents late delivery and restart time from drifting the schedule. A fire's `System` event and its journaled fire transition record each occurrence; replay advances from those entries and never consults the wall clock. A finite count is required so a recurring schedule cannot live forever without a bound. + +Each active schedule consumes one `MAX_PENDING_SCHEDULES` slot, regardless of how many fires remain. Re-arming changes that record in place and does not reserve a second slot; the slot is released only when the final occurrence fires or the schedule is cancelled. Admission/replay must enforce the cap, and checkpoint writing/restoration must serialize and validate the same complete set of active records. Replacing an ID validates the replacement first, then journals cancellation and the new set, preserving the existing atomic-refusal behavior. + +Cancellation by ID cancels the whole series. Actor serialization orders a cancel against a due fire: already-journaled deliveries remain, while a cancellation that wins prevents all later occurrences. One-shot behavior is the same state machine with no interval and one remaining fire. + +## Cross-world grant shape + +The F12.14 design in `.opencode/plans/phase-12-platform-flexibility.md` calls for a portal capability granted by both worlds' admins. That implementation is not present yet: current `update_caps` grants are local capability names, and `cross_world_write` is a host file-policy gate, not portal consent. Reuse the F12.14 shape by requiring reciprocal, journaled permission for the named source/destination pair; do not treat `cross_world_write` as a substitute or create a schedule-only authorization model. A scheduled delivery carries only the bounded schedule ID and late flag, not arbitrary payload. The target must durably accept a delivery keyed by source world, schedule ID, and occurrence before the source consumes that occurrence, so a retry after restart is idempotent. Missing, revoked, isolated, or unavailable target/grant means refusal and the source occurrence stays pending. + +## Verification + +Extend the existing schedule bounds/refusal, cancellation, restart/replay, and checkpoint tests. Add bounded recurrence tests that verify the exact fire count and interval anchoring, replay without wall-clock drift, cap behavior through re-arming and compaction, and cross-world refusal/delivery with and without reciprocal grants. diff --git a/doc/README.md b/doc/README.md index 1bb949f2f1..569134bc49 100755 --- a/doc/README.md +++ b/doc/README.md @@ -42,6 +42,7 @@ Folders are named `__`. The kinds in use are `feature` - [T3 Code V2 integration](2026-10-26T21-18-21Z_feature_t3code-v2-integration/main.md) - [PM stack forecasting: velocity, quota walls, and stall risk](2026-11-01T21-07-00Z_design_pm-stack_forecasting/2026-11-01T21-07-00Z_design_pm-stack_forecasting.md) - [Authenticated peer announcements and bounded discovery](2026-11-02T08-13-35Z_design_peer-announcement-authentication/2026-11-02T08-13-35Z_design_peer-announcement-authentication.md) +- [Recurring and cross-world scheduled events](2026-11-03T01-31-11Z_design_recurring_cross_world_schedules/2026-11-03T01-31-11Z_design_recurring_cross_world_schedules.md) Two names break the pattern. They stay as they are because other documents link to them: `2026-03-23T00:00:00Z_feature_file_list_ui/` has colons in its name, and `2026-10-14T10-18-19Z_design_p7_2_cloudflare_workers.md` is a file, not a folder.