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 messages land after a resume that ran before them by voltcrash · Pull Request #17773 · pingdotgg/t3code

fix(server): queued messages land after a resume that ran before them #17773

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 3 commits into pingdotgg:main from voltcrash:t3/queued-message-order
Oct 18, 2026

Uh oh!

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

Merged

fix(server): queued messages land after a resume that ran before them #17773

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
47c9d94
fix(server): queued messages land after a resume that ran before them
voltcrash Oct 10, 2026
1ff0353
fix(server): count wakes that ran ahead when ordering a queued run
voltcrash Oct 10, 2026
cd75456
Merge branch 'main' into t3/queued-message-order
voltcrash Oct 16, 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): count wakes that ran ahead when ordering a queued run
A background notification or delegated completion starts its run with a
notification item, not a user message, so the started-run check missed it
and a queued run that started after such a wake kept its older ordinal.
Look up the prompt items of newer runs, including notifications, before
starting a queued run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
  • Loading branch information

Uh oh!

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

@voltcrash @claude
voltcrash and claude committed Oct 10, 2026
commit 1ff0353e06e2808a76cd801342ec702fc35d9cb4

Some comments aren't visible on the classic Files Changed page.

There are no files selected for viewing

24 changes: 12 additions & 12 deletions 24 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 @@ -1330,18 +1330,18 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
// Run ordinals order the transcript, checkpoints, and the latest run. A
// run that started while this one waited (a resume of a held queue, a
// reorder, a delivery that jumps the queue) has a newer ordinal, so this
// run moves after it. A message cancelled from the queue never started.
const startedRunIds = new Set(
projection.turnItems.flatMap((item) =>
item.type === "user_message" && item.runId !== null ? [item.runId] : [],
),
);
const ordinal = projection.runs.some(
(run) =>
run.status !== "queued" && run.ordinal > queuedRun.ordinal && startedRunIds.has(run.id),
)
? nextRunOrdinal(projection)
: queuedRun.ordinal;
// run moves after it. A started run has its prompt in the transcript (a
// wake's prompt is a notification); a message cancelled from the queue has none.
const newerRunIds = projection.runs
.filter((run) => run.status !== "queued" && run.ordinal > queuedRun.ordinal)
.map((run) => run.id);
const startedAhead =
newerRunIds.length > 0 &&
(yield* projectionStore.getThreadRecords(threadId, ["turnItems"], {
turnItemTypes: ["user_message", "notification"],
turnItemRunIds: newerRunIds,
})).turnItems.length > 0;
const ordinal = startedAhead ? nextRunOrdinal(projection) : queuedRun.ordinal;
const rootNodeId = queuedRun.rootNodeId;
const attemptId = queuedRun.activeAttemptId;
const providerThreadId = queuedRun.providerThreadId;
Expand Down
10 changes: 10 additions & 0 deletions 10 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 @@ -3988,6 +3988,16 @@ it.layer(layerTest)("OrchestrationV2LayerLive lifecycle", (it) => {
yield* settle("queued", queuedStartedAt);
assert.equal(yield* Queue.take(startedRunIds), (yield* runFor("late-wake")).id);
assert.equal(millis((yield* runFor("late-wake")).workStartedAt), millis(queuedStartedAt));

// Runs sort in the order they started, including after a wake that ran ahead.
const ordinals = yield* Effect.forEach(
["prompt", "early-wake", "queued", "late-wake"],
(key) => Effect.map(runFor(key), (run) => run.ordinal),
);
assert.deepEqual(
ordinals,
ordinals.toSorted((left, right) => left - right),
);
}),
);

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.