Repository navigation
Open
Labels
epic/fleet-orchestrationReprioritization program epic (2026-11-12)Reprioritization program epic (2026-11-12)priority/highImportant and time-sensitiveImportant and time-sensitivestatus/triagedTriaged and routed (see agent note)Triaged and routed (see agent note)status:in-review
Description
Coalesce queue claim flow + add a real file-transfer verb (fewer round trips, WS-C census)
Part of epic #5412. Census evidence: WS-C comment on #5701 (2026-11-04). Every sandbox↔laptop round trip costs ~200–600 ms warm, so round-trip COUNT is the lever until/unless the multiplexed-tunnel work lands.
Round-trip census today (code + logs)
| Operation | Transport round trips | Wall (measured) |
|---|---|---|
Single trivial exec (laptop-agent.py exec -- true) |
1 (unix to session proxy + 1 pooled-tunnel HTTP request) | wall 346–719 ms; trip p50 369 ms |
fleet queue claim (one claim) |
1 (call("/claim") → one broker_roundtrip → one unix_roundtrip; repo-queue crate crates/repo-queue/src/main.rs cmd_claim/call) |
~1 trip ≈ 0.3–0.6 s warm |
| Claimant launch flow (claim + lane + bind) | 3 separate CLI invocations = 3 round trips (cmd_lane, cmd_bind are separate call()s) |
~1–2 s warm, ×3 failure surfaces |
Detached job to completion (run + poll loop) |
1 + N polls (poll sleeps 3 s client-side and re-requests per iteration, laptop-agent.py poll) |
grows with job length |
| Small file fetch from laptop | NO file verb exists: fetch = 1 exec round trip with base64 -w0 in a shell string (measured 301 ms wall for /etc/hostname), 1 MiB/stream cap, +33% base64 size, no resume/offsets |
1 trip + encoding overhead |
Also measured: fleet queue health took 2.1 s and 5.8 s in two live probes (vs 0.30 s in the #5701 stage-2 window) — it visibly resolves secrets ("resolved via bitwarden") plus queries, i.e. multiple internal round trips; health should be 1 lightweight trip.
Proposal
- Batch endpoint for the claim flow: queue-broker
POST /claim-flow{queue, worker, lane, session, launched_by} performing claim+lane+bind server-side (laptop-local, Supabase calls stay on the laptop) and returning the bound row. Clientfleet queue claim --bind ...uses it when session info is present; the 3 separate verbs remain for compatibility. 3 trips → 1. - Generic batch already half-exists: the daemon
/execacceptscmds: [...](exec-batch measured: 10 trivial commands in ONE trip, 483 ms wall total vs ~400 ms EACH singly). Publish this pattern to queue/secrets clients: a/batchon the session-proxy protocol that carries several service requests (mixed ports) in one frame and fans out at the broker. Client libraries coalesce independent calls made in one invocation. - File-transfer verb: daemon
GET /file?path=&off=&len=returning raw bytes (Content-Type application/octet-stream, byte-range via query — the jobs poll already proves the offset pattern) + clientlaptop-agent.py fetch PATH OUT. No base64, chunked by offset, resume = re-request from last offset. Binary framing arrives free if the multiplexed-tunnel work (sibling issue) lands; the verb is useful on today's HTTP path too. - Poll backoff:
pollinterval 3 s fixed → exponential 1 s → 10 s cap with server-side long-poll option (?wait_s=Nholds the request until state change or N s), cutting poll trips for long jobs by ~10×.
Acceptance
- Claim+lane+bind in 1 round trip (verify in trips/broker logs: exactly 1 trip id per flow).
laptop-agent.py fetchof a 5 MiB file: byte-identical (md5), no base64, trips = ceil(size/chunk) with chunk ≥ 1 MiB.- Long-job poll trips reduced ≥5× at equal completion-detection latency ≤10 s.
Metadata
Metadata
Assignees
Labels
epic/fleet-orchestrationReprioritization program epic (2026-11-12)Reprioritization program epic (2026-11-12)priority/highImportant and time-sensitiveImportant and time-sensitivestatus/triagedTriaged and routed (see agent note)Triaged and routed (see agent note)status:in-review
Activity
developing-today commentedon Nov 5, 2026
CODE-1444
dezren39 commentedon Nov 5, 2026
Triage outcome — task 10166 (2026-11-05, lane code-p)
Verdict: CONFIRMED structurally on current mains — proposal routed as two repo-scoped follow-ups (one set, tracked here). No Drew decision needed; epic #5412 is OPEN.
Fresh verification (2026-11-05): issue #5757 OPEN, labels task/triage + queue/queued only — no hard-stop labels, one tracking comment only. No duplicate: searches for claim-flow / file-transfer verb return nothing filed.
Claim-flow (code,
pkgs/fleet/crates/fleet-queue/, main04f78696ab): the client dispatchesclaim,lane, andbindas three separate commands (client.rs:1328-1330), each its owncall()— claim posts to/claim(client.rs:882) — and the broker exposes three separate routes (queue_broker.rs:/claim:382,/lane:393,/bind:402). There is no/claim-flowroute. This shift is live evidence: every task worked paid claim + lane as separate round trips. Broker/healthis a full handler (:517), consistent with the census's heavyweight-health observation (this shift's health calls also printed the bitwarden resolution line).File verb + poll (nix,
pkgs/laptop-agent/src/laptop_agent.py, current main): the daemon's GET routes are only/health,/jobs,/jobs/<id>(:420-445) — no/fileroute exists; POST offers/exec,/jobs,/jobs/<id>/kill. The client poll loop sleeps a fixed 3 s (~/tools/laptop-agent.py:281), matching the census, with nowait_slong-poll parameter on either side.Routing (cross-repo set; this issue stays the tracker):
POST /claim-flowon the queue-broker performing claim+lane+bind server-side +fleet queue claim --bindclient support; the three separate verbs remain. Acceptance = the issue's own: exactly 1 trip id per claim flow in broker logs. This is the fleet's hottest path — every queue task in every lane pays it.GET /file?path=&off=&len=(raw bytes, offset-chunked) + clientfetch(byte-identical, no base64), and poll backoff (exponential 1 s → 10 s cap) with a server-side?wait_s=Nlong-poll on the job route. Acceptance = the issue's own md5/≥5× poll-trip criteria./batch) — the daemon/execcmds:[...]batch already exists and no client need beyond the claim flow is demonstrated; revisit only if a second concrete multi-call flow appears. The lightweight-health point folds into follow-up A's broker work as a stretch item, not a separate task.agent-note:v1
{"kind": "triage", "task": 10166, "issue": 5757, "state": "done", "outcome": "confirmed_routed_two_repo_set", "evidence": "client.rs:1328-1330 three separate verbs, broker routes /claim /lane /bind separate, no /claim-flow; nix laptop_agent.py GET routes have no /file; client poll fixed sleep(3) at laptop-agent.py:281"}
dezren39 commentedon Nov 5, 2026
agent-note:v1
{"kind":"work","task":10494,"issue":5757,"state":"in_progress","outcome":"claimed","evidence":"Open issue verified; no hard-stop labels or overlapping nix implementation. Open PR #1531 is a separate persisted-meta startup fix.","branch":"queue/10494-5757-laptop-agent-file-poll","worktree":"/home/user/git/fleet/10494-5757-laptop-agent-file-poll"}
240 remaining items
dezren39 commentedon Nov 14, 2026
Packet-defect disposition under Drew's 2026-11-13 unblock-all order: task 10494 was cancelled (packet defect verified unchanged — see the task record) and replaced by fresh triage task 16471, now queued. Worker
main-unblock-all-2026-11-13.dezren39 commentedon Nov 14, 2026
Agent note — task 16471 triage: the /file verb slice of #5757 is real, unimplemented, and cleanly scoped (lane code-a, 2026-11-14)
Fresh triage from current state (the prior task 10494 packet was scoped to the wrong repo; this supersedes it):
Current state (verified today): the laptop-agent client (
~/tools/laptop-agent.py) offers health, exec, exec-batch, run, poll, kill, jobs — nofetch. The daemon (~/tools/laptop-agent-daemon.py) routes GET /health, /jobs and POST /exec, /cancel, /jobs — no/file. File fetch today is still the base64-in-exec workaround the issue's census measured. So proposal item 3 stands unimplemented; items 1/2/4 (claim-flow batching, /batch fan-out, poll backoff) are separate slices and are not covered by this triage.The slice, as scoped for a follow-on small_fix:
GET /file?path=&off=&len=returning raw bytes (application/octet-stream), byte-range via query params, offset pattern as already proven by the jobs poll.laptop-agent.py fetch PATH OUT— no base64, chunked by offset with chunks ≥ 1 MiB, resume = re-request from the last received offset.Implementation cautions for whoever takes the follow-on: the laptop-agent files under
~/tools/are the live sandbox↔laptop path (not repo files) and show same-day sibling work (.bak-20261114-tripv2backups — the multiplexed-tunnel sibling effort); the change must land on both ends (sandbox client + laptop daemon) and be verified end-to-end against the md5 acceptance before the old base64 habit is declared replaced. Security shape stays as today: agent token header only, never in argv; the daemon should refuse paths outside its existing exec trust model rather than growing a new one silently.Triage completes as
triaged; the follow-on implementation is a fresh small_fix dispatch against this scope.dezren39 commentedon Nov 14, 2026
Agent note — task 17166 triage confirmed (lane any-a): task 16471's triage of the /file slice stands, minutes old
This re-packet duplicates the triage lane code-a completed as task 16471 at 2026-11-14T18:49Z (note directly above): the /file verb slice of #5757 is real, unimplemented, and cleanly scoped — daemon
GET /file?path=&off=&len=(raw bytes, offset ranges) + clientlaptop-agent.py fetch PATH OUT(chunked ≥1 MiB, resume by offset), acceptance = 5 MiB fetch byte-identical by md5 with trips = ceil(size/chunk). Its cautions stand: both ends are the LIVE sandbox↔laptop path under ~/tools (not repo files), sibling multiplexed-tunnel work is in flight today, and the token stays header-only.No re-triage is warranted minutes later, and the follow-on implementation should be a fresh small_fix dispatch per that scope — deliberately not started from this duplicate in the last hour of a shift, on infrastructure every lane is actively using. Task 17166 completes as triaged on task 16471's evidence. Items 1/2/4 of #5757 (claim-flow batching, /batch fan-out, poll backoff) remain separate slices, untouched by either triage.
dezren39 commentedon Nov 17, 2026
🤖 Agent note · triaged
/tools/laptop-agent.py) has no fetch verb, and the daemon's GET routes are only /health and /jobs (/tools/laptop-agent-daemon.py) — file fetch is still the base64-in-exec workaround the census measured. Items 1/2/4 (claim-flow batching, /batch fan-out, poll backoff) remain separate slices, untouched.dezren39 commentedon Nov 17, 2026
agent-note:v1
state: done
task: 19928
lane: any-m
worker: repo-worker-code
Task 19928 — file-verb slice of issue #5757 — implemented and verified live:
fetch [--chunk BYTES] PATH OUTsubcommand — chunked at 1 MiB, resume by offset (an existing OUT is continued from its size, never restarted), round-trip count reported. Raw bytes bypass the JSON broker protocol and ride the direct Cloudflare/Tailscale transports, with the SSH chunk fallback when every agent transport is down.Issue #5757 stays OPEN — this was only the file-verb slice; items 1/2/4 of the parent issue are out of this packet's scope.
fleet(#5757): exponential poll backoff 1s doubling capped at 10s
dezren39 commentedon Nov 23, 2026
Progress (lane oc-code-08): poll-backoff slice PR #12948 — poll() slept fixed 3s; now poll_interval() doubles 1/2/4/8s capped at 10s. Evidence: cargo test -p fleet-laptop-agent --lib 21 passed/0 failed (2 new tests; test failed pre-fix with 3s vs 1s). Next slice in the same form: after the next PR, poll trips for a 60s job drop further via server-side long-poll ?wait_s, and laptop-agent.py:1469 gets the same backoff.