GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): queued scheduled deliveries follow the thread's current model by Ali-Al1 · Pull Request #34149 · pingdotgg/t3code

fix(server): queued scheduled deliveries follow the thread's current model #34149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
juliusmarminge merged 13 commits into pingdotgg:main from Ali-Al1:feat/scheduled-tasks-follow-thread-model
Nov 13, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

fix(server): queued scheduled deliveries follow the thread's current model #34149

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
c376bd8
fix(server): queued scheduled deliveries follow the thread's current …
Ali-Al1 Nov 6, 2026
37f50ef
fix(server): promoted scheduled deliveries steer on the thread's curr…
Ali-Al1 Nov 6, 2026
e9e08a1
fix(server): scheduled deliveries use the current provider for fresh …
Ali-Al1 Nov 6, 2026
bdec2c8
fix(server): check a queued scheduled /goal against the provider it s…
Ali-Al1 Nov 6, 2026
fa9e56a
fix(server): a pinned scheduled delivery starts on its pin
Ali-Al1 Nov 11, 2026
ec8926b
test(server): a fresh scheduled delivery never reuses a reservation a…
Ali-Al1 Nov 11, 2026
93375aa
Merge upstream/main into feat/scheduled-tasks-follow-thread-model
Ali-Al1 Nov 12, 2026
deb86cd
test(scheduled-tasks): switch provider instance through Stop, as upst…
Ali-Al1 Nov 12, 2026
05459b1
Merge remote-tracking branch 'origin/main' into feat/scheduled-tasks-…
juliusmarminge Nov 13, 2026
0ddeaf6
test(server): trim scheduled-delivery selection tests to distinct reg…
juliusmarminge Nov 13, 2026
936f924
test(server): type-safe thread id in scheduled selection test
juliusmarminge Nov 13, 2026
3692032
fix(server): scheduled deliveries queued before upgrade keep their se…
juliusmarminge Nov 13, 2026
7134113
Merge origin/main into feat/scheduled-tasks-follow-thread-model
juliusmarminge Nov 13, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
fix(server): a pinned scheduled delivery starts on its pin
CodeRabbit's Linked Issues check on this PR found that
followsCurrentConversation returned true for every message with a
scheduledTaskId, so a delivery that named its own model resolved the
thread's current selection when its queued run started instead of the
selection it pinned.

Persist the dispatch's explicit modelSelection on the conversation
message and keep scheduled deliveries that named a model out of the
current-conversation path. Pinned tasks, and fresh-thread launches
which seed with the task's model, keep today's behaviour: the queued
run starts on its pin. Selectionless bound deliveries still follow the
thread's current pick; delegated completions and monitor
notifications are untouched.

Adds the regression test the check asked for: a pinned scheduled
delivery queued behind an active run, the thread moved while it
waits, and the run starting on its pinned selection.
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@Ali-Al1
Ali-Al1 committed Nov 11, 2026
commit fa9e56af2d5283334fc55bb0f86a88a42c38cef1

There are no files selected for viewing

11 changes: 10 additions & 1 deletion 11 apps/server/src/orchestration-v2/Orchestrator.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -834,14 +834,21 @@ function nextQueuedRun(

// Delegated completions, monitor notifications and scheduled deliveries never choose a model,
// so a queued one runs on the thread's current pick rather than the one frozen at queue time.
// A scheduled delivery that named its own model is the exception: its pin wins over the thread.
function followsCurrentConversation(
message:
| Pick<
OrchestrationV2ConversationMessage,
"createdBy" | "creationSource" | "notification" | "delegatedCompletion" | "scheduledTaskId"
| "createdBy"
| "creationSource"
| "notification"
| "delegatedCompletion"
| "scheduledTaskId"
| "modelSelection"
>
| undefined,
): boolean {
if (message?.scheduledTaskId !== undefined && message.modelSelection !== undefined) return false;
return (
message?.delegatedCompletion !== undefined ||
message?.scheduledTaskId !== undefined ||
Expand Down Expand Up @@ -6598,6 +6605,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
: { scheduledTaskId: command.scheduledTaskId }),
...(command.senderThreadId === undefined ? {} : { senderThreadId: command.senderThreadId }),
...(command.idleCompaction === undefined ? {} : { idleCompaction: command.idleCompaction }),
...(command.modelSelection === undefined ? {} : { modelSelection: command.modelSelection }),
id: command.messageId,
threadId: command.threadId,
runId,
Expand Down Expand Up @@ -6985,6 +6993,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
: { scheduledTaskId: command.scheduledTaskId }),
...(command.senderThreadId === undefined ? {} : { senderThreadId: command.senderThreadId }),
...(command.idleCompaction === undefined ? {} : { idleCompaction: command.idleCompaction }),
...(command.modelSelection === undefined ? {} : { modelSelection: command.modelSelection }),
id: command.messageId,
threadId: command.threadId,
runId,
Expand Down
97 changes: 97 additions & 0 deletions 97 apps/server/src/orchestration-v2/runtimeLayer.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -6493,6 +6493,103 @@ it.layer(layerTest)("OrchestrationV2LayerLive lifecycle", (it) => {
}),
);

it.effect(
"starts a queued scheduled delivery that pinned a model on its pin after the thread moved",
() =>
Effect.gen(function* () {
const orchestrator = yield* Orchestrator.OrchestratorV2;
const eventSink = yield* EventSink.EventSinkV2;
const threadId = ThreadId.make("runtime-layer-queued-scheduled-pinned-selection");
const scheduledMessageId = MessageId.make(`${threadId}:scheduled`);
const pinnedSelection = { instanceId: modelSelection.instanceId, model: "gpt-5.5" };
yield* orchestrator.dispatch({
type: "thread.create",
commandId: CommandId.make(`${threadId}:create`),
threadId,
projectId: ProjectId.make(`${threadId}:project`),
createdBy: "user",
creationSource: "web",
title: "Pinned scheduled selection",
modelSelection,
runtimeMode: "full-access",
interactionMode: "default",
branch: null,
worktreePath: process.cwd(),
});
yield* orchestrator.dispatch({
type: "message.dispatch",
commandId: CommandId.make(`${threadId}:active`),
threadId,
messageId: MessageId.make(`${threadId}:active`),
text: "Busy",
attachments: [],
modelSelection,
dispatchMode: { type: "start_immediately" },
createdBy: "user",
creationSource: "web",
});
const active = (yield* orchestrator.getThreadProjection(threadId)).runs[0]!;
// A task that pins a model names it on the delivery, as a fresh-thread launch seeds it.
yield* orchestrator.dispatch({
type: "message.dispatch",
commandId: CommandId.make(`${threadId}:scheduled`),
threadId,
messageId: scheduledMessageId,
scheduledTaskId: ScheduledTaskId.make(`${threadId}:task`),
modelSelection: pinnedSelection,
text: "Pinned scheduled prompt",
attachments: [],
dispatchMode: { type: "queue_after_active" },
createdBy: "user",
creationSource: "web",
});
const queued = (yield* orchestrator.getThreadProjection(threadId)).runs.find(
(run) => run.userMessageId === scheduledMessageId,
)!;
assert.equal(queued.status, "queued");
assert.deepEqual(queued.modelSelection, pinnedSelection);
// The user moves the thread off the pinned model while the delivery waits.
const movedSelection = { instanceId: alternateInstanceId, model: "gpt-5.5" };
yield* orchestrator.dispatch({
type: "thread.model-selection.set",
commandId: CommandId.make(`${threadId}:select-moved`),
threadId,
modelSelection: movedSelection,
});
const waiting = yield* orchestrator.getThreadProjection(threadId);
const now = yield* DateTime.now;
yield* eventSink.write({
events: [
{
id: EventId.make(`${threadId}:completed`),
type: "run.updated",
threadId,
runId: active.id,
occurredAt: now,
payload: {
...waiting.runs.find((run) => run.id === active.id)!,
status: "completed",
completedAt: now,
},
},
],
});
yield* orchestrator.resumeQueuedRuns;
const after = yield* orchestrator.getThreadProjection(threadId);
const delivered = after.runs.find((run) => run.userMessageId === scheduledMessageId)!;
assert.equal(delivered.status, "starting");
// The pin wins: the run starts on the selection the delivery named, not the thread's later pick.
assert.deepEqual(delivered.modelSelection, pinnedSelection);
assert.equal(
after.attempts.find((attempt) => attempt.id === delivered.activeAttemptId)
?.providerInstanceId,
pinnedSelection.instanceId,
);
// Pinned tasks keep today's behaviour: the thread follows the run's selection back.
assert.deepEqual(after.thread.modelSelection, pinnedSelection);
}),
);

it.effect(
"starts a fresh scheduled delivery on a new provider thread after a provider switch",
() =>
Expand Down
2 changes: 2 additions & 0 deletions 2 packages/contracts/src/orchestrationV2.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,8 @@ export const OrchestrationV2ConversationMessage = Schema.Struct({
notification: Schema.optional(OrchestrationV2Notification),
...OrchestrationV2CreationFields,
scheduledTaskId: Schema.optional(ScheduledTaskId),
/** The selection the delivery named when it arrived; a scheduled delivery that named one keeps it. */
modelSelection: Schema.optional(ModelSelection),
senderThreadId: Schema.optional(ThreadId),
idleCompaction: Schema.optional(OrchestrationV2IdleCompaction),
/**
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.