GeezerVison is showing github.com — feat(fleet): mirror placement sessions to the queue backend (placement_sessions) — #13146 slice 1 by dezren39 · Pull Request #13169 · developing-today/code
Conversation
dezren39
commented
Nov 23, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Slice 1 of #13146: placement session records gain their designed
home in the queue backend, while placement itself stays exactly as
decentralized as today.
Backend (turso_queue)
placement_sessions table added to the SCHEMA set (created by
ensure_schema on broker start): the full client record JSON in
record, with handle/state/surface/submitted_by/run_id extracted
as columns for list/filter queries.
- New verbs, dispatched and authenticated like every other queue
verb: /placement-put (upsert by handle), /placement-get,
/placement-list (newest first, bounded), /placement-sync
(insert-or-ignore batch — the migration path; it can never
overwrite a row the backend already holds).
Client transport
broker_roundtrip_bounded: the queue client's routes with a
caller-set budget on every leg, HTTP errors returned as Err
(the unbounded legs die with exit 3), no session-broker
auto-spawn, and a malformed broker URL degrading to Err.
Placement
- The local JSON store stays the commit and the only input to
placement decisions (build_ctx, the Blacksmith reconcile read
local state exactly as before).
- Records mirror best-effort: put on commit and on refresh;
status/result/followup reads take the newer of the local and
backend copies (by updated_at); session list unions both
stores; an insert-or-ignore sync sweep after dispatch and on
list migrates pre-existing local stores with no operator step.
FLEET_PLACE_REMOTE=off disables the mirror (operator + test
escape hatch).
Runbook (pkgs/fleet/doc/agents/remote-build-and-test.md):
the session-store paragraph now describes the mirror + fallback,
and the broadcast string gains the binary-acquisition block —
bootstrap pin, plus the release-asset route for machines without
the Muse bootstrap (tag read from the FLEET_URL/FLEET_SHA256
pin block in scripts/muse/bootstrap.sh; verify against the
.sha256 asset; verify the install with fleet queue dispatch --help and fleet queue surfaces).
Verification
Live cross-seat verification (acceptance criterion 1 on #13146)
follows the normal binary rollout: the broker picks up the verbs
and seats pick up the client from main, as with every fleet
change. #13146 stays open for that record; the later slices named
there (Blacksmith minute ledger if spend grows; hard cap
enforcement) are out of scope here.

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…t_sessions) — #13146 slice 1
- turso_queue: placement_sessions table in SCHEMA plus
/placement-put|get|list|sync verbs (sync is insert-or-ignore:
the migration path for pre-existing local stores)
- client transport: broker_roundtrip_bounded — same routes as the
queue client, caller-budget timeouts, errors returned, never
dies, never spawns the session broker
- placement: the local JSON store stays the commit and the only
decision input; records mirror best-effort (put on commit and
refresh, get/list merged by updated_at, an opportunistic sync
sweep migrates pre-existing local stores); FLEET_PLACE_REMOTE=off
disables the mirror
- runbook: session-store paragraph updated for the mirror; the
broadcast string gains the binary-acquisition block (bootstrap
pin plus the release-asset route for non-Muse machines)
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 23 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
76fa29bd-60cd-4361-9e36-5e052e0859ec
Commits
-
Reviewing files that changed from the base of the PR and between 9c54940 and eca57d1.
Files selected for processing: 8
-
pkgs/fleet/crates/fleet-queue/src/client/transport.rs
pkgs/fleet/crates/fleet-queue/src/placement.rs
pkgs/fleet/crates/fleet-queue/src/placement/remote.rs
pkgs/fleet/crates/fleet-queue/src/turso_queue.rs
pkgs/fleet/crates/fleet-queue/src/turso_queue/core.rs
pkgs/fleet/crates/fleet-queue/src/turso_queue/placement_sessions.rs
pkgs/fleet/crates/fleet-queue/src/turso_queue/stacks_outbox.rs
pkgs/fleet/doc/agents/remote-build-and-test.md
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-11-23T09:53:07.576026Z |
eca57d1 |
PR opened |
ℹ️ 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" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eca57d1b5e
ℹ️ 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".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+1648
to
+1649
|
|
let mirrored = remote.get(handle).ok().flatten();
|
|
|
remote::pick_session(local, mirrored)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve mirrored followup records during actual dispatch
When a handle exists only in the backend because it was dispatched from another seat, a dry-run followup succeeds through this lookup, but adding --dispatch selects the earlier local-only branch. That branch calls refresh_session before importing the mirrored record and fails with “no session with handle”. Resolve and seed the mirrored record before the dispatch/dry-run split so cross-seat followups work without requiring a separate session status call first.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+20
to
+23
|
|
ON CONFLICT(handle) DO UPDATE SET \
|
|
|
record = excluded.record, state = excluded.state, \
|
|
|
surface = excluded.surface, submitted_by = excluded.submitted_by, \
|
|
|
run_id = excluded.run_id, updated_at = excluded.updated_at";
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reject stale records in the placement-session upsert
When two seats refresh the same running session concurrently, one can publish a newer completed record while the other's delayed GitHub request fails. GithubActionsAdapter::run_state preserves the input state on failure, and run_session still puts that unchanged older record. This unconditional upsert then replaces the completed backend record with the older running state and timestamp, defeating the newer-record selection used by readers. Guard conflict updates against timestamps older than the stored record.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+188
to
+190
|
|
recs.sort_by(|a, b| created_at(b).cmp(created_at(a)));
|
|
|
recs.truncate(SYNC_BATCH);
|
|
|
let _ = remote.sync(&recs);
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Advance migration sweeps beyond the newest 100 sessions
For an existing local store containing more than 100 sessions, every sweep selects exactly the same newest 100 records. Once those are inserted, subsequent insert-or-ignore calls keep resending them, so older records never reach the backend and their handles remain unavailable from other seats. Track migration progress or rotate through bounded batches so repeated successful sweeps eventually cover the whole store.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+518
to
+523
|
|
let mut s = UnixStream::connect(socket).map_err(|e| {
|
|
|
format!(
|
|
|
"cannot connect to queue-broker at unix://{}: {e}",
|
|
|
socket.display()
|
|
|
)
|
|
|
})?;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bound Unix-socket connection attempts before blocking
When the configured broker's Unix-socket accept backlog is full, UnixStream::connect blocks until the server accepts a connection; the read/write timeouts installed afterward cannot interrupt it. The session-proxy leg uses the same blocking connection pattern. A stalled broker can therefore hang a dispatch indefinitely during its synchronous mirror call instead of falling back after the five-second budget. Use a deadline-aware nonblocking connection for both Unix-socket legs and ensure route probing is bounded too.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 23, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
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.
|