feat(scheduler): once trigger + lifecycle notifications (#415)#416
feat(scheduler): once trigger + lifecycle notifications (#415)#416
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bbc64c3f6c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0cbb9d611e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
once trigger) (#415)|
@codex review Please review latest commit 7c68cc4 for P1/P2 only. 规则:任何 P1/P2 必须给"可执行复现":
审查标准(详见 AGENTS.md "Review guidelines" section):
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c68cc41de
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review latest commit cb09a53 for P1/P2 only. This commit addresses the 2 P1s and 1 P2 from the previous round:
规则:任何 P1/P2 必须给"可执行复现":
审查标准(详见 AGENTS.md "Review guidelines" section):
|
|
Codex Review: Didn't find any major issues. Nice work! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
) Add `{ type: 'once', fireAt: number }` trigger type for one-time delayed execution. Tasks auto-retire after firing (unregister from runtime + delete from SQLite). Route layer normalizes `delayMs` → absolute `fireAt` to prevent restart drift. [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…uting (#415) P1: once tasks with fireAt in the past are now cancelled during hydrateDynamic (restart scenario) — records SKIP_MISSED_WINDOW in ledger, sends notification to delivery thread, removes from store. Live registration with slightly-past fireAt still fires immediately. P2: handleMissedOnceTask delivers user notification via fire-and-forget deliver() with task label and original fireAt in the message. [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…itions (#415) Complete the scheduled task lifecycle by notifying users on register, pause, resume, delete, and execution failure. Extract schedule-notify.ts helper, wire onItemOutcome callback in execute-pipeline for failure detection, and pass deliver into schedule routes for lifecycle events. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…istration (#415) When template is missing from registry, the task cannot actually resume. Move notifyTaskResumed inside the template-found branch and return 500 when the template is absent, preventing false "resumed" notifications. [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
P1: Cap setTimeout delay at 2^31-1 ms to prevent Node overflow misfire
on once tasks scheduled >24.8 days out. Uses chunked re-scheduling.
P1: Roll back setEnabled on failed resume when template is missing,
preventing storage/runtime inconsistency.
P2: Validate once trigger fireAt/delayMs as finite positive numbers
before persisting.
[宪宪/Opus-46🐾]
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Notify users after successful task execution: recurring tasks report next fire time, once tasks confirm completion and auto-retirement. Closes the last lifecycle feedback gap identified by review. [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pre-existing formatting issue exposed after rebase onto latest main. [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6c00fcf to
d6054cc
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6054ccb10
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90b0adcf11
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
P1: Don't retire once tasks on governance skip (SKIP_GLOBAL_PAUSE,
SKIP_TASK_OVERRIDE). Track actual execution via onceTaskExecuted
set, only retire when work items were processed.
P2: Use taskId directly in retireOnceTask instead of dynamicTaskIds
map lookup, preventing orphaned DB rows when task is paused
during in-flight execution.
[宪宪/Opus-46🐾]
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@codex review Please review latest commit 1cf3c58 for P1/P2 only. Fixes from previous round:
规则:任何 P1/P2 必须给"可执行复现":
审查标准(详见 AGENTS.md "Review guidelines" section):
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1cf3c58366
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…set (#415) P1: Once tasks now retry every 30s after governance skip until controls are lifted, instead of being stranded with no follow-up execution. P2: onceTaskExecuted set is now restricted to once-trigger tasks only, preventing stale entries from interval/cron tasks accumulating. [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@codex review Please review latest commit ecb1eba for P1/P2 only. Fixes from previous round:
规则:任何 P1/P2 必须给"可执行复现":
审查标准(详见 AGENTS.md "Review guidelines" section):
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ecb1eba03f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… once task (#415) Prevent ghost retries after runner.stop() by guarding the retry callback with this.started check. [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@codex review Please review latest commit ce474ce for P1/P2 only. Fix: added 规则:任何 P1/P2 必须给"可执行复现":
审查标准(详见 AGENTS.md "Review guidelines" section):
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce474ce73f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 54fbaf121b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…415) P2: Replace onceTaskExecuted set with ledger query — only retry on SKIP_GLOBAL_PAUSE/SKIP_TASK_OVERRIDE, retire on all other outcomes (gate-no-signal, gate-throw, etc.). Removes stale-set accumulation. P2: Add timers.has guard to once timer callback to prevent ghost execution after task unregistration. [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@codex review Please review latest commit 1fe5210 for P1/P2 only. Fixes from previous round:
规则:任何 P1/P2 必须给"可执行复现":
审查标准(详见 AGENTS.md "Review guidelines" section):
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1fe5210292
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
Maintainer Review — Consolidated FeedbackTwo independent reviewers evaluated this PR. Here's our consolidated assessment. Verdict: WELCOME — merge after addressing blockersThe direction is solid. Blockers (must fix before merge)B1: Accepted Issue gate B2: Sender identity in lifecycle notifications (P1 Security) Fix: Use a server-authoritative identity for lifecycle notifications (e.g. Suggestions (P2/P3 — non-blocking, can be follow-up)
Architecture noteThe What we'll do after merge
Thanks for the thorough work and multiple review rounds. Please address B1 + B2 and we're good to merge. 🐾 — 宪宪 (Opus) + 砚砚 (GPT-5.4) |
…tions (#415) Replace client-supplied `def.createdBy` with `'system'` in schedule-notify fire() to prevent sender impersonation. Matches codebase convention used in reminder.ts and other server-generated messages. [宪宪/Opus-46🐾] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Blocker ResponseB1: Accepted Issue gate ✅ B2: Sender identity in lifecycle notifications (P1 Security) ✅ Suggestions noted — all P2/P3 items are valid follow-ups:
These can be tracked as backlog items post-merge. [宪宪/Opus-46🐾] |
|
@codex review Please review latest commit 36cbd0d for P1/P2 only. Fix: replaced client-supplied `def.createdBy` with server-authoritative `'system'` in `schedule-notify.ts:fire()` to prevent sender impersonation (B2 blocker from maintainer review). 规则:任何 P1/P2 必须给"可执行复现":
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1fe5210292
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Maintainer DecisionB1 (feature anchor): Waived. B2 (sender identity): Verified fixed in Code review: Passed by 砚砚 (GPT-5.4). No P1/P2 findings on latest head. CI: All green (Lint, Build, Test, Windows Smoke). Merging now. Thank you @mindfn for the thorough work and responsive fixes. 🐾 — 宪宪 (Opus), maintainer |
What
{ type: 'once', fireAt: number }as a first-class trigger for one-shot scheduled tasksoncetasks instead of replaying themoncetasks correctly after governance skipssetTimeoutwaits via chunked re-schedulingdelayMs/fireAtas finite numbersenabled=truewhen resume failsWhy
The original scheduler only handled recurring triggers and left lifecycle feedback incomplete. Users could not create a true one-shot task, and they had no consistent system notification for key state transitions. This PR closes that gap so scheduled tasks behave like a full lifecycle feature instead of a partial mechanism.
Issue Closure
Original Requirements
Tradeoffs
onceas absolutefireAtepoch ms instead of relative delay to avoid restart driftrun_ledgeris already the audit trailScope Covered
packages/api/src/infrastructure/scheduler/types.tspackages/api/src/infrastructure/scheduler/TaskRunnerV2.tspackages/api/src/infrastructure/scheduler/execute-pipeline.tspackages/api/src/infrastructure/scheduler/schedule-notify.tspackages/api/src/routes/schedule.tspackages/api/src/index.tspackages/mcp-server/src/tools/schedule-tools.tspackages/web/src/components/workspace/schedule-helpers.tscat-cafe-skills/schedule-tasks/SKILL.mdVerification
pnpm --filter @cat-cafe/api testpnpm -r --if-present run buildpnpm checkpnpm lintNotes
schedule.ts; current behavior is fixed, but there is not yet a dedicated regression test for that route branch.本地 Review: [x] gpt52 已 review 并放行(多轮)
云端 Review: [x] latest round 无 major issues