🤖 feat: add scheduled prompt queue#3422
Conversation
|
@codex review Please review the scheduled prompt queue implementation. In particular, please look at the active-workspace dispatcher behavior, localStorage lifecycle handling, and the choice not to copy scheduled sends on workspace fork. |
|
To use Codex here, create a Codex account and connect to github. |
8302189 to
5dd4327
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5dd4327309
ℹ️ 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".
5dd4327 to
4e54e11
Compare
|
@codex review Addressed your dispatcher lifetime feedback by moving the active-workspace scheduled prompt dispatcher out of ChatPane and into an App-level active workspace host, while disabling it for transcript-only, incompatible, and queued agent-task workspaces. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e54e1183b
ℹ️ 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".
c6fa89e to
eab35fb
Compare
|
@codex review Addressed the provider side-effect feedback by letting the App-level scheduled prompt dispatcher mount AgentProvider/ThinkingProvider with global listeners disabled. This preserves the shared send-option path while preventing duplicate agent/thinking shortcut handling; added tests for disabled agent/thinking keybind listeners. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eab35fbeb2
ℹ️ 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".
eab35fb to
f6de8f7
Compare
|
@codex review Rebased this PR onto latest |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ 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". |
f6de8f7 to
30d7932
Compare
|
@codex review Addressed the scheduled dispatcher feedback: due scheduled prompts are now dispatched sequentially, |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30d7932cb2
ℹ️ 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".
30d7932 to
686dc26
Compare
|
@codex review Addressed the live Chat Instructions feedback: the App-level scheduled prompt dispatcher now reads the hydrated additional-system-context snapshot for the active workspace and includes it in scheduled send options, matching the normal ChatInput send path. Re-ran focused tests and |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 686dc2681d
ℹ️ 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".
686dc26 to
29a3388
Compare
|
@codex review Addressed the latest scheduler edge cases: clamped long-delay timers now reschedule after the clamp expires, and |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29a3388193
ℹ️ 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".
29a3388 to
7a1bb83
Compare
|
@codex review Addressed the queued prompt snapshot feedback: before dispatching each prompt from a due batch, the dispatcher now re-reads the current scheduled prompt state and only sends entries that still exist and are still due/scheduled. Added a dispatcher test for removing a queued due prompt while an earlier prompt is still sending, and re-ran focused tests plus |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a1bb83ccc
ℹ️ 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".
ce64b11 to
c3458c7
Compare
|
@codex review Rebased onto latest Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3458c7197
ℹ️ 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".
c3458c7 to
d1b29bb
Compare
|
@codex review Addressed the manual Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1b29bb935
ℹ️ 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".
d1b29bb to
b10ebbe
Compare
|
@codex review Addressed the normalized-prompts memoization feedback. Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b10ebbefe2
ℹ️ 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".
Adds a right sidebar Schedule tab for workspace-scoped scheduled prompts, including local lifecycle state, run-now/delete controls, and an active-workspace dispatcher that submits due prompts with the current send options.\n\nLinks coder#3417.\n\n---\n\n_Generated with `mux` • Model: `GPT-5` • Thinking: `unknown` • Cost: ``_\n\n<!-- mux-attribution: model=GPT-5 thinking=unknown costs=unknown -->
b10ebbe to
7f6b1d8
Compare
|
@codex review Addressed the remaining Schedule tab memoization feedback. Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f6b1d8eb3
ℹ️ 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".
| inFlightIdsRef.current.add(prompt.id); | ||
| setStoredPrompts((current) => | ||
| markScheduledPromptSending(normalizeScheduledPrompts(current), prompt.id) | ||
| ); |
There was a problem hiding this comment.
Guard scheduled dispatch with a shared lock
When the same workspace is open in more than one renderer window/tab, this check-and-set is only protected by inFlightIdsRef, which is local to one component instance. Both dispatchers can read the prompt as still scheduled before either observes the other's localStorage update, then both mark it sending and call sendMessage, so one scheduled prompt can be sent twice. Use a storage/backend-level claim that is atomic across renderers before sending.
Useful? React with 👍 / 👎.
| if (!result?.success) { | ||
| const error = result?.error ? getErrorMessage(result.error) : "API not connected"; | ||
| setStoredPrompts((current) => | ||
| markScheduledPromptFailed(normalizeScheduledPrompts(current), prompt.id, error) |
There was a problem hiding this comment.
Surface structured send errors
For scheduled sends that fail with normal SendMessageError variants such as api_key_not_found, oauth_not_connected, model_not_available, or unknown with raw, result.error does not have a top-level message, so this stores the generic "Failed to send scheduled prompt" instead of the actionable provider/model/runtime error that normal sends show. In those scenarios the Schedule tab leaves the user without enough information to fix the failed prompt; format the structured send error before marking it failed.
Useful? React with 👍 / 👎.
Summary
Adds a workspace-scoped scheduled prompt queue in the right sidebar. Users can schedule a text prompt for a future local time, choose whether it should dispatch after the current step or after the current turn, run it immediately, delete it, and see sent/failed/sending status directly in the Schedule tab.
Background
Part of #3417. This covers the explicit scheduling workflow for quota-reset or overnight continuation scenarios. Automatic rate-limit reset detection is left as a follow-up because that likely needs backend/provider-specific signal plumbing rather than a purely local UI queue.
Implementation
Scheduleright-sidebar tab with prompt text,datetime-localscheduling, dispatch-mode selection, run-now/delete controls, and lifecycle badges.ChatPaneso due prompts are sent through the existingworkspace.sendMessageAPI using the current send options, without mutating the visible composer draft.Validation
npx bun@1.3.5 test src/browser/features/ScheduledPrompts/scheduledPrompts.test.ts src/common/constants/storage.test.tsnpx bun@1.3.5 run node_modules/@typescript/native-preview/bin/tsgo.js --noEmit -p tsconfig.main.jsonnpx bun@1.3.5 run node_modules/@typescript/native-preview/bin/tsgo.js --noEmitgit diff --checkRisks
The dispatcher is renderer-local and runs while the workspace UI is mounted; it is not yet a background daemon that can wake a closed app. Scheduled prompts are text-only in this first pass, so attachment scheduling and command parsing can be layered on later if maintainers want them. Automatic rate-limit reset detection is intentionally out of scope for this PR.
Pains
A targeted ESLint invocation for the changed files hung locally for more than two minutes with no output, matching the same local lint behavior observed on the companion PR, so it was terminated and the other validation checks above were used.
Generated with
mux• Model:GPT-5• Thinking:unknown• Cost: ``