Skip to content

feat(cron): schedule a one-shot from the dashboard - #9960

Closed
kvzz42 wants to merge 1 commit into
kirodotdev:mainfrom
kvzz42:feat/schedule-once-ui
Closed

kvzz42 wants to merge 1 commit into
kirodotdev:mainfrom
kvzz42:feat/schedule-once-ui

Conversation

@kvzz42

@kvzz42 kvzz42 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Scheduling a one-shot from the dashboard, end to end: the read/edit halves of the
one-shot contract, then the two UI surfaces on top of them.

Why it matters

at / delay / at_time landed on the create routes only, which left a
one-shot as the single schedule kind a client could create and then neither render
nor edit. Three gaps, one per layer:

  • GET /api/crons serialized cron_expr only for kind == "cron" and
    every_secs only for kind == "every", with no at_ts at all — a one-shot's
    fire time existed on that payload only inside the human-readable schedule
    string;
  • PATCH /api/crons/{id} accepted only cron and every;
  • _update_job_locked had no at_ts branch, so a handler passing one through
    would have been silently dropped.

The user-visible consequence was the bug #9836 describes: the Schedule form
matched neither the interval nor the weekly shape, fell through to cron mode
with an empty expression
, and its own buildBody then refused to save it — so an
MCP-created one-shot could not be edited from the dashboard at all.

What changed (motivation → approach → change)

Backend

  • at_ts and delete_after_run on the list payload, each set only for the
    kind that owns it. delete_after_run is reported rather than inferred, since it
    is an independent field.
  • PATCH accepts at / delay / at_time through the same
    _resolve_one_shot_at parser and precedence the create route uses, so a fire
    time means one thing on both surfaces.
  • The store applies it. at_ts is mutually exclusive with cron_expr /
    every_secs (a schedule has exactly one kind; accepting both would drop one
    depending on assignment order) and bounded by _MAX_AT_TS, for the reason the
    create path bounds it: a value past what datetime.fromtimestamp can render is
    stored fine by a caller that skips the schema and then raises while the job list
    is serialized, failing GET /api/crons for every job until that record is
    deleted by id. Re-timing never touches delete_after_run.

UI

Schedule form — a fourth schedMode arm, once, decided by at_ts being a
finite number rather than by having matched nothing else. It shows a
datetime-local control and no timezone select, because an at fire time is
an absolute instant and there is no zone to choose. An empty or past time is
refused in the form, naming the field the user is looking at.

Composer shortcut — a Send later… row in the composer's plus menu opens a
time picker that schedules the current draft, creating an ordinary one-shot with
session_key naming this chat. A shortcut, not a second scheduling surface: the
Schedule page stays where the job is listed, edited and cancelled.

It is a menu row rather than a caret on Send (Slack's shape) because the idle action
row already carries mic + Optimize + Send, and max-two-buttons-per-row
(website/AUTOSDE.yaml, blocking: true) caps a row at two peers and names
widening and wrapping as non-fixes. The plus menu is a separate visual group, so the
row costs that row nothing and relocates nothing already in it.

Scheduled-message banner — a role="status" strip above the composer naming the
soonest pending one-shot for this chat, linking to the Schedule page, in the spirit
of Slack's "1 scheduled message". Without it a pending message is invisible between
scheduling and firing, since the menu row is not a persistent affordance. It is what
pays for the discoverability the menu row costs. scheduledMessages is supplied by
the HOST page rather than fetched by ChatInput: that component is rendered by
several surfaces and by many tests, and a per-mount GET /api/crons would add a
request to all of them.

Ordering note: create-time session_key is #9815. Unknown body keys are
ignored on POST /api/crons, so before that merges the caret still schedules
correctly and the job delivers to its own tab — it degrades rather than failing.
This PR does not depend on #9815 to be correct, only to be complete.

Screenshots / video

Plus menu Picker Banner Schedule form, once
menu picker banner once

Captured by website/scripts/capture-schedule-once.mjs against the real built SPA
with fixture-stubbed /api/**. The Schedule frame is driven from a fixture job
carrying at_ts
rather than by filling the create form, because the defect this
closes is on the read path — photographing the seeded job is what shows the arm
doing its job.

Tests

  • test/test_cron_oneshot_read_and_retime.py (14) — the payload reports the fire
    time, PATCH re-times by absolute and relative spellings, an unparseable time is
    refused rather than stored, and the store refuses a recurring spelling alongside
    at_ts, a non-numeric value, and an unrenderable one (inf, nan, negative,
    past the cap).
  • website/src/test/JobForm.once.test.ts (11) — a one-shot reads into once
    instead of an empty cron, the fire time round-trips through the local-zone
    rendering, a recurring job is untouched, and the body carries at with no
    timezone and no recurring spelling.
  • website/src/test/ScheduleSendButton.test.ts (8) — the picker is read as local
    wall clock, a past or current-minute time is refused, and the default opens on a
    time that is already valid.

Backend: 2289 passed / 3 skipped across the cron and schedule suites. Frontend:
2009 passed (one pre-existing WebPreviewPanel failure that reproduces on clean
main). npm run i18n:check passes all 19 checks with I18N_BASE_REF=origin/main;
tsc -b, flake8, mypy, docs-lint.sh and the comment-history gate are clean.

Manual verification

Captured against the real built SPA (npm run build + the harness below), not a
component mock: the Schedule frame opens a fixture job carrying at_ts and shows
Run once with 06/01/2026, 09:30 AM populated, which is the read path the bug
was on. The composer frames drive the actual caret and picker.

Related Issues

Closes #9836. Completed (not required) by #9815, which adds create-time
session_key.

@kvzz42
kvzz42 requested review from a team and cixuuz September 10, 2026 19:40
@github-actions github-actions Bot added the fork Pull request from a fork (external contributor) label Sep 10, 2026
@dwu96

dwu96 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated.

Missing sections:

  • ## Problem / Motivation
  • ## Why it matters
  • ## What changed

Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle.

@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Sep 10, 2026
@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — 🟡 CONCERNS

Premise-level review of 7a5348a07f8877e01a7298796d83e0d3a1767cc9 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

delete_after_run ships on the list payload with zero readers, and the Send-later row + banner rest on Slack symmetry and an unlinkable "maintainers asked for" claim.

Not justified as shipped

  • 2 — zero consumers. Grepped delete_after_run in website/src: 0 matches on base; in the diff only the types/index.ts declaration, a capture fixture, and a presence-assert test — none are consumers.
  • 5 — undeclared. The description says only "Re-timing never touches delete_after_run"; _clear_one_shot_deletion (cron.py), which disarms it on kind conversion, is mentioned nowhere in it, and the spec section this PR adds omits it too. The behavior itself has a nameable harm and tests.
  • 7 — undeclared. buildBody now skips at when the time control is unchanged on edit (prevents 59-second drift) — a quiet changed step the description never states.
  • 8, 9 — inherited (symmetry). Grounded in "the shape Slack uses" / "in the spirit of Slack's '1 scheduled message'"; the same capability ships in this PR via the Schedule form's once arm, and nobody is named who needed it in the composer. The banner additionally costs every ChatPage/ChatPane mount a GET /api/crons query forever, whether or not the user ever schedules.
  • 10 — rides along, undeclared. bn/ko rewordings of the pre-existing send_options label are unrelated to this feature.

What this change ships

Inventory (10 items) — 5 justified

Intent: let a user render, edit, and create a one-shot scheduled message from the dashboard — a FIX of the read/edit gap (#9836, linked) carrying declared UI ADDITIONS on top.

  1. A one-shot's fire time (at_ts) now appears on the job-list payload — justified
  2. delete_after_run now appears on the job-list payload — zero consumers
  3. PATCH /api/crons/{id} now re-times a one-shot via at/delay/at_time — justified (reuses _resolve_one_shot_at)
  4. The store validates and applies at_ts (one schedule kind, capped at 2100) — justified
  5. Converting a one-shot to recurring now silently disarms delete-after-run — undeclared
  6. Schedule form gains a "Run once" mode with a local date-time picker and no timezone select — justified
  7. An edit that leaves the time control untouched no longer re-sends the fire time — undeclared
  8. Composer plus menu gains a "Send later…" row with a time picker — inherited (Slack symmetry)
  9. A status strip above the composer advertises pending scheduled messages, adding one API query per chat surface — inherited (Slack symmetry)
  10. bn/ko translations of the existing "Send options" label reworded — rides along, undeclared

Committed PNGs under temp-screenshots/ and the capture script follow the documented evidence convention (.github/PULL_REQUEST_TEMPLATE.md:47, 466 sibling capture-*.mjs scripts) — not counted as items.

Watch

  • The composer shortcut and banner's only checkable provenance is the spec sentence "the split the maintainers asked for" — that claim exists nowhere on base (grepped docs/, 0 matches) and the description links no request. Clears when: the maintainer request or issue asking for a composer entry point is linked.
  • Item 2's field is speculative surface on a public API. Clears when: a real reader lands (e.g. the Schedule form surfacing "deletes after run") or the field is dropped.

Subtractions

[FIRST-PRINCIPLES-REVIEWED] 7a5348a

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — 🟡 CONCERNS

Design-level review of 7a5348a07f8877e01a7298796d83e0d3a1767cc9 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

The shortcut's write and the banner's read use different session_key spellings, reconciled only by an assumption about unmerged #9815.

Watch

  • The composer sends session_key: activeSlot (raw slot), while both banner filters match `dashboard:${activeSlot}` and the capture fixture hand-writes the prefixed form — the backend's canonical spelling everywhere (artifacts.py, members.py). Whether the raw slot gets namespaced is decided by feat(cron): let a created job target a chat session #9815, which isn't merged, and no test in this PR ties the create payload to the filter predicate. If feat(cron): let a created job target a chat session #9815 stores what it receives, the banner never shows for the shortcut's own jobs — the exact "payment for the menu row's discoverability" the design hinges on — and it fails silently.
    Clears when: the composer sends the same spelling the filter matches (or #9815's normalization is demonstrated), pinned by one test covering create-payload → filter.
  • _clear_one_shot_deletion changes update_job semantics for every caller (MCP, CLI, dashboard): a kind conversion now silently flips a persisted flag. It's sound (both create paths derive delete_after_run=bool(at_ts)), but the spec section this PR adds says only "Re-timing never touches delete_after_run" and the PR description omits the disarm entirely — a future store caller reading the spec won't know conversions mutate the flag.
    Clears when: the disarm-on-conversion rule is stated in the learn-cron-dashboard spec section this PR adds.

Suggestions

  • ChatPage and ChatPane duplicate the same ~20-line query + scheduledMessages filter verbatim; a shared useScheduledMessages(activeSlot) hook keeps the two filter predicates from drifting (the seam above is exactly the bug that drift produces).

[DESIGN-REVIEWED] 7a5348a

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5, fork) — 🟡 CONCERNS

UX-level review of 7a5348a07f8877e01a7298796d83e0d3a1767cc9 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

I have everything I need. Reconciling: the diff adds four user-visible surfaces (plus-menu "Send later…" row, time-picker popover with "Schedule" confirm, scheduled-message banner with "View schedule" link, and the Schedule form's "Run once" arm) — all four appear only in screenshots the fork PR adds, which are not materialized in this lane, and no blind read ran. I verified the base-tree patterns: every sibling path to the Schedule page uses client-side navigate('/schedule') (often behind the NavigationLeaveGuard), while the new banner uses a raw <a href>; and the JobForm arm shows a named error for a past time while the popover only disables its button.

UX-Verdict: CONCERNS

Sound flow and copy, but every new control is unseen in this lane, and the banner link full-reloads an SPA every sibling navigates client-side.

Watch

  • Banner link <a href="/schedule"> (ChatInput.tsx) — every sibling uses navigate('/schedule') (CrewWakeSection, NotificationDetailPanel via leave(...)), so this click triggers a full SPA reload: flash, lost panel state, NavigationLeaveGuard bypassed, and up to a debounce window of freshly typed draft dropped. Hit on every banner click, moderate impact, every time. Fix: client-side navigate.
  • Banner time renders via new Date(...).toLocaleString() with no locale — a user running the UI in one of the other 11 languages sees the fire time in the browser's default format (plus seconds noise), on every banner render. Fix: route through the src/i18n/format.ts seam.
  • Same invalid-time condition, two behaviors: JobForm says "Pick a time in the future"; ScheduleLaterPopover only greys "Schedule" with no message, leaving the user staring at a disabled button after scrolling the date back. Fix: show the same one-line hint when fireTime === null and the field is non-empty.

Evidence gaps

  • "Send later…" plus-menu row — shown only in PR-added 01-plus-menu-send-later.png, not materialized here; no blind read ran on it.
  • Time-picker popover and its "Schedule" confirm — 02-picker.png, same gap.
  • Scheduled-message banner and "View schedule" link — 03-scheduled-banner.png, same gap.
  • Schedule form "Run once" arm (datetime control, no timezone select) — 04-schedule-once-arm.png, same gap.
  • Schedule-failure ErrorNotice state — in no screenshot at all.
  • Pushing the branch to this repository would let the blind-read lane see all five.

Suggestions

  • Disabled "Send later…" row's title restates its label; make it explain the gate ("Type a message to schedule") so an empty-composer user knows why it's grey.
  • Prefill JobForm's once datetime with the next quarter-hour (as defaultFireLocal does) instead of empty when switching an existing job to "Run once".

[UX-REVIEWED] 7a5348a

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — 🔴 changes requested (blocking)

Reviewed 7a5348a07f8877e01a7298796d83e0d3a1767cc9 via the fork AI-review pipeline; updated in place on each push.

1 of 3 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

BLOCKING -- src/kiro_crew/cron.py:2880 -- Recurring one-run jobs lose their deletion flag
_clear_one_shot_deletion(job)
Recurring delete_after_run=True job -> dashboard resaves its recurring schedule -> flag clears, so it runs indefinitely.
Anchor: residual/crash-data-loss-corruption
Fix: clear only when the original schedule kind was at.

BLOCKING -- website/src/pages/ChatPage.tsx:1068 -- Cron-list failures are silent in both chat hosts
const scheduledCrons = useQuery({ ... }) / const { data: cronsData, ... } = useQuery({ ... })
Failed /api/crons -> query error is never rendered -> scheduled-message state silently disappears.
Anchor: errors-use-error-notice
Fix: render both query errors through ErrorNotice with the composer-draft hand-off decision.

BLOCKING -- src/kiro_crew/dashboard/handlers/cron.py:802 -- Feature map omits the new one-shot dashboard flow (origin: validation)
if any(k in body for k in ("at", "delay", "at_time")):
New PATCH contract and composer scheduling flow -> feature map still describes recurring jobs and omits PATCH/composer ownership.
Anchor: feature-map-correctness
Fix: update the Schedule feature-map row with one-shots, composer entry point, components, and PATCH endpoint.

[BLOCK-MERGE] 7a5348a
[GPT-REVIEWED] 7a5348a

Adjudication (Opus 4.8) — is blocking on each finding proportionate?

Verified: F2's anchor errors-use-error-notice and F3's anchor feature-map-correctness are both blocking: true AUTOSDE rules (website/AUTOSDE.yaml:527, AUTOSDE.yaml:13); the changed files fall within each rule's file-patterns. F1's precondition — a recurring job carrying delete_after_run=True — is producible through add_job (cron.py:2168–2172 accepts cron_expr/every_secs and delete_after_run independently), and _clear_one_shot_deletion clears the flag on any non-at new kind (cron.py:116), including a recurring→recurring retime, with no recovery path.

F2 — harm rung LOW on its own (silent read-failure hides the reminder banner; the scheduled cron still fires and refetch self-corrects), but the anchor is a blocking:true AUTOSDE rule requiring read/list/load failures to render through ErrorNotice; the rule's flag outranks weighing.

F3 — the feature map (docs/feature-map/README.md) was not touched by this PR despite structural dashboard changes; anchored to blocking:true feature-map-correctness, authoritative.

F1 (fenced) — unbounded residual (silent loss of deletion intent → job recurs indefinitely); conditions are reachable via the create paths and an ordinary recurring-schedule edit, so no rarity argument completes.

[ADJUDICATION] 7a5348a07f8877e01a7298796d83e0d3a1767cc9 total=2 uphold=2 downgrade=0
UPHOLD F2 website/src/pages/ChatPage.tsx:1068 reason=autosde-blocking-rule
UPHOLD F3 src/kiro_crew/dashboard/handlers/cron.py:802 reason=autosde-blocking-rule
[GPT-ADJUDICATED] 7a5348a07f8877e01a7298796d83e0d3a1767cc9
[ADJUDICATION-FENCED] 7a5348a07f8877e01a7298796d83e0d3a1767cc9 fenced=1 flagged=0
UPHOLD-FENCED F1 src/kiro_crew/cron.py:2880 -- A recurring delete_after_run job is producible via add_job and an ordinary recurring-schedule edit silently clears the flag, so the deletion intent is lost with no recovery.
[GPT-ADJUDICATED-FENCED] 7a5348a07f8877e01a7298796d83e0d3a1767cc9

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review (fork) — ✅ no blocking findings

Reviewed 7a5348a07f8877e01a7298796d83e0d3a1767cc9 via the fork AI-review pipeline; updated in place on each push.

Review details

The composer "Send later" shortcut is inert: the scheduled-message banner never shows and the run is never mirrored back to the chat.

FINDING — website/src/components/ChatInput.tsx:670 — the composer creates the job with bare session_key: activeSlot || '' (e.g. chat-1), but api_crons_create (cron.py:558–575) never reads session_key from the body, so the stored job has session_key=""; meanwhile the banner filter is j.session_key === \dashboard:${activeSlot}`(ChatPane.tsx) — so a composer-scheduled one-shot'ssession_keyis neither persisted nordashboard:-prefixed, the banner never appears, and delivery (slack/gateway.py:3640 removeprefix("dashboard:")) never routes the result back to this chat, landing it in a cron-tab instead → Fix: sendsession_key: activeSlot ? `dashboard:${activeSlot}` : ''from the composer AND makeapi_crons_createaccept and persistsession_key` (untouched file, so the remedy is out-of-diff — reported advisory).

[OPUS-REVIEWED] 7a5348a

@kvzz42
kvzz42 force-pushed the feat/schedule-once-ui branch from 8fddbcd to 3ffbd4c Compare September 10, 2026 21:04
@kvzz42

kvzz42 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Bundle Size Gate is failing for a reason that predates this PR, and I do not
think it is mine to fix here — evidence rather than assertion:

  • the gate reports assets/all-CK8YSdhq.js: 10.78 MB exceeds its 10.72 MB budget by 65.7 KB (chunk 'all');
  • building this branch and clean origin/main with the same
    vite build --mode analyze produces byte-identical output for that chunk —
    same 10.78 MB, same 65.7 KB overage, and the same content hash
    all-CK8YSdhq.js. An identical content hash is the part that settles it: this
    branch adds nothing to the all chunk;
  • this PR's code lands in a different chunk. schedule-send-confirm (a testid only
    this change introduces) is present in dist/assets/App-Dktx2SuY.js, not in
    all-*.

Why it surfaced on this PR rather than earlier: the job is path-filtered to
website/**, so it reports skipped on PRs that touch no frontend files — #9902
and #9900 both skip it. This is the first website-touching PR since the chunk grew
past the budget again, so it is the first to actually run the check.

The established remedy looks like a maintainer action rather than a contributor
one: the most recent change to website/scripts/check-bundle-size.mjs on main is
3de52729c fix(build): raise all-chunk budget after #9810/#9812 (#9953) — a
dedicated build-fix PR raising the budget after merged work grew the chunk. Raising
it inside this feature PR would fold that maintenance into an unrelated change and
move a ratchet upward for growth this branch did not cause, which is the opposite
of how the error-code and comment-history baselines in this repo are treated.

Happy to raise the budget here with a comment attributing the growth to main if
that is preferred — just say so and I will push it. Otherwise this check should go
green on its own once the next budget bump lands on main.

The other failure in that round, Frontend Lint & Type Check, was mine and is
fixed: jsx-a11y/control-has-associated-label wanted the label on the control
itself rather than through the htmlFor/id pairing, so the time input now also
carries an aria-label. npm run lint is clean.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 10, 2026
@kvzz42
kvzz42 force-pushed the feat/schedule-once-ui branch from 3ffbd4c to 796b934 Compare September 11, 2026 00:06
@kvzz42

kvzz42 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author
  • Fixed — span=718d7aa17224 the split control put a third peer button in the composer row

Prompt optimizer enabled -> optimizer plus send and schedule actions render together -> three peer buttons occupy one composer row.
Fix: Use one shared overflow trigger for Optimize and Send later, leaving Send as the only peer button.

Legitimate, and I initially wanted to argue it — a split button is one visual
control, and BusySendButton already ships that exact anatomy in the same corner.
That argument does not survive checking: BusySendButton renders only in the busy
branch (isRunning && (onStop || (canSteer && onSteer))), where Optimize is absent,
so no state in the codebase puts a split send button next to Optimize. The
precedent establishes the shape is accepted, not that the caret is free under the
cap — which is the question this change actually raises.

Taken a different route than the one suggested, for a smaller blast radius: Send
later is now a row in the composer's plus menu
, not a caret and not a new overflow
trigger. The rule caps per visual group, and the plus button sits in the left group
opposite mic/Optimize/Send, so the row adds nothing to the capped row AND relocates
nothing already in it. Folding Optimize into a shared overflow would have moved a
control with its own Cmd+Shift+Enter shortcut that users already reach.

The honest cost is discoverability — a caret advertises itself, a menu row has to be
found — so the change now also carries a scheduled-message banner above the
composer (role="status", links to the Schedule page) naming the soonest pending
one-shot. That is what pays for the affordance being one level in, and it closes a
real gap the caret version also had: between scheduling and firing, a pending message
was invisible in the chat it belonged to.

@kvzz42

kvzz42 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author
  • Fixed — span=10f93377d1b3 the schedule path bypassed ErrorNotice and could erase a newer draft

Rejected createCron -> mutation onError -> transient Redux notice is the only failure surface.
Slow createCron -> user edits the composer while it is pending -> success clears the replacement draft.

Both correct, and both now follow this file's own precedents rather than inventing a
surface.

Failures render through ErrorNotice beside the draft (testId="schedule-error",
dismissible), copying the optimizeError block a few lines above it — including its
"No hand-off" comment, which is accurate here for the same reason: the draft is
deliberately left in the composer so the user can retry or send it now. A transient
toast was the wrong surface for something that reads as a sent message never
arriving.

The draft clear is now conditional on the live draft still being the text that
was submitted (if (value.trim() === vars.text) onChange('')). The mutation carries
the submitted text in its variables, so the comparison is against what this request
actually scheduled rather than against a snapshot — a create slow enough for the user
to start the next message no longer deletes work it never saw.

@kvzz42

kvzz42 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author
  • Fixed — span=e9d61697a3bf converting a one-shot kept its deletion flag, and an unrelated edit moved its fire time

Delete-after-run one-shot -> user selects a recurring mode -> PATCH changes only the schedule -> the recurring job is deleted after its first execution.
One-shot with nonzero seconds -> user edits its name -> minute-only value is resubmitted -> execution moves earlier by up to 59 seconds.

Both real, both data loss, and both mine. The Opus lane independently found the first
one at the store level, which is where I fixed it.

The deletion flag. Every dashboard and composer one-shot is created with
delete_after_run=True, so converting one to a recurring schedule with the flag still
set produced a job that ran once and deleted itself — a schedule the user configured
and never saw again, with the disappearance looking like the job had simply vanished.
Fixed at the persistence owner (_clear_one_shot_deletion in cron.py) rather than in
the form, because the form is not the only caller and a UI-side fix would leave MCP and
the CLI exposed. Scoped to a KIND CHANGE: a same-kind retime leaves the flag alone,
since a one-shot moved an hour later is still a one-shot. It also cannot fight an
explicit caller, because update_job accepts no delete_after_run kwarg at all — I
checked rather than assuming, and corrected a docstring that had claimed otherwise.

The truncated instant. toLocalInputValue drops seconds because the input's step
is a minute, and buildBody sent at unconditionally — so a name-only edit
re-submitted a truncated time and walked the run earlier on every save. The form now
carries the originally rendered value and sends at only when the time control itself
changed (or on create, where there is no stored instant to preserve). I had documented
dropping seconds as deliberate for the control and simply failed to think through the
round trip.

Tests pin all of it: interval and cron conversions disarm the flag, a same-kind retime
keeps it, a recurring job without it is untouched, and on the form side a name-only
edit sends no at while a moved control does.

@kvzz42

kvzz42 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author
  • Fixed — span=7a592d96635f the recurring branches never cleared delete_after_run

converting a delete_after_run one-shot (every dashboard/composer-shortcut one-shot is created with delete_after_run=True) to a recurring schedule reassigns job.schedule via the elif "every_secs"/"cron_expr" branches, which never clear delete_after_run

This is the same defect the GPT lane reached from the form, and your framing put it in
the right layer: the branches that reassign job.schedule are what must maintain the
invariant, not the caller that happens to reach them. Fixed there
(_clear_one_shot_deletion), so MCP, the CLI and the apps SDK are covered by the same
check rather than each write path re-implementing it — the pattern this method already
follows for timezone and skip-date validity.

Your parenthetical is the part that made the severity obvious: because every
dashboard and composer one-shot carries the flag, this was not an edge case reachable
by a hand-built job but the default outcome of editing one through the UI this PR adds.

Two related notes from the same sweep, both now pinned by tests: a same-kind retime
must NOT clear the flag (a one-shot moved later is still a one-shot), and the
advisory gate mismatch you raised on ChatInput.tsx:535 is gone with the caret — the
plus-menu row carries the same !value.trim() condition as scheduleComposer, so an
attachment-only draft can no longer enable an affordance that would refuse itself.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 11, 2026
Close the read and edit halves of one-shot scheduling, then build the two UI
surfaces on top.

`at`/`delay`/`at_time` were create-only, so a one-shot was the one schedule kind
a client could create and then neither render nor edit: GET /api/crons carried no
machine-readable fire time, PATCH accepted no one-shot spelling, and the store
had no at_ts branch to apply if it had. The Schedule form consequently opened
such a job in cron mode with an empty expression and refused to save it.

- GET /api/crons reports at_ts and delete_after_run
- PATCH /api/crons/{id} accepts at/delay/at_time via the create route's parser
- _update_job_locked applies at_ts, mutually exclusive with the recurring
  spellings and bounded so an unrenderable value cannot break the job list
- JobForm gains a fourth `once` arm, decided by at_ts and showing no timezone
  select (an instant has no zone to choose)
- the composer's send button gains a caret that schedules the draft into THIS
  chat, as a shortcut over the same create route
@kvzz42
kvzz42 force-pushed the feat/schedule-once-ui branch from 796b934 to 7a5348a Compare September 11, 2026 00:42
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 11, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 11, 2026
@kvzz42

kvzz42 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing this implementation in favor of the replacement one-shot AutoNudge design. The replacement keeps scheduled messages mutually exclusive with goals and monitors, delivers into the original session as an exact user turn, and removes the automation automatically after completion. I will link the replacement PR here once it is open.

@kvzz42 kvzz42 closed this Sep 16, 2026
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Sep 16, 2026
@kvzz42

kvzz42 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Replacement opened: #11397

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Schedule a one-shot cron from the UI (Schedule tab once mode + composer shortcut)

2 participants