Repository navigation
fix(fleet-proxy): broker singleton lock + broker.pid ownership (#9611) - #10056
Conversation
Acceptance 1, fleet-proxy leg: fleet proxy serve now takes the same cross-implementation singleton the Python broker holds — an exclusive flock on broker.lock beside the socket, for the whole process lifetime — before probing or binding broker.sock. If another implementation holds it, serve converges (exit 0 with a log line) instead of racing the stale-socket probe (episode 1: Errno 98 churn) or silently taking the socket over (episode 2 tail). After a successful bind it writes broker.pid with its own pid, so broker.pid names the socket owner whichever implementation owns it (previously only the Python broker wrote it). Unit test: flock exclusivity across open descriptions. cargo test -p fleet-proxy --lib: 90/90 pass.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou'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 14 seconds. View limit details
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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Drill item D5 for issue #8580 (task 16834): this PR comment was posted while the github-ci Worker webhook for developing-today/code is deactivated (kill-the-Worker drill). After reactivation + backfill sweep, the mirror's PR row for this PR must show the increased comments count. |
{
"agent-note": "v1",
"task_id": 17367,
"queue": "repo-health-code-pilot",
"worker": "repo-worker-code",
"lane": "any-n",
"transition": "picked_up",
"at": "2026-11-15T16:22:40Z",
"summary": "Claimed by openchamber-scheduled-lane (repo-worker-code/any-n). Revalidated PR: OPEN, MERGEABLE, mergeStateStatus=CLEAN, checks NEUTRAL (CodeRabbit), no pending/failing, not draft, no CHANGES_REQUESTED. Proceeding to merge if state remains unchanged at merge time.",
"origin": "openchamber-scheduled-lane"
} |
{
"agent-note": "v1",
"task_id": 17367,
"queue": "repo-health-code-pilot",
"worker": "repo-worker-code",
"lane": "any-n",
"transition": "done",
"at": "2026-11-15T16:23:05Z",
"summary": "Rechecked immediately before merge: OPEN, MERGEABLE, CLEAN, checks NEUTRAL (CodeRabbit), no pending/failing. Merged PR #10056 via merge commit. Task completed fixed_merged.",
"origin": "openchamber-scheduled-lane"
} |
For #9611 (task 16540) — acceptance 1, the fleet-proxy leg of the broker singleton.
Problem (from #9611): two broker implementations auto-start against the same
broker.sock. The Python broker (~/tools/laptop-agent-broker.py) already holds an exclusiveflockonbroker.lockfor its lifetime and writesbroker.pidonly when it owns the socket — butfleet proxy serveplayed by neither rule: it probe-connects, unlinks "stale" sockets, and binds, without participating in the lock, and it never writesbroker.pid. Two starters can both pass the stale probe and race to bind (episode 1:Errno 98churn), and a fleet-proxy takeover leavesbroker.pidnaming a dead Python process (episode 2 tail).Change (
pkgs/fleet/crates/fleet-proxy/src/serve.rs, +81):acquire_singleton_lock(): opensbroker.lockbeside the socket and takesflock(LOCK_EX | LOCK_NB), mirroring the Python broker exactly (same file, same semantics — the lock releases automatically when the holder dies, so a crashed broker never wedges the path).run_innertakes the lock before the probe/bind sequence and holds it for the process lifetime. If another implementation holds it, serve logs and exits 0 — convergence on the existing owner instead of competition.broker.pidwith its own pid, sobroker.pidnames the socket owner whichever implementation owns it.singleton_lock_is_exclusive_across_open_descriptions(flock is per open-file-description: second acquisition fails while held, succeeds after drop).Verification:
cargo test -p fleet-proxy --lib— 90/90 pass, including the new test (run on the laptop through the fleet build lock).The Python-broker legs of #9611 (acceptance 2 bounded tunnel establishment + pooled-only retry, alongside the already-landed 1/3/4) land in the home-tools tree and are verified live separately; the evidence note on #9611 ties the pieces together. This PR does not close #9611 — the coordinated broker restart verification is recorded on the issue.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.