Repository navigation
fleet step 4 (#5432): the dispatch thin client over pm-stack - #5551
Conversation
…eue over pm-stack New crates/fleet-dispatch: verbs over pm-dispatch's live HTTP API only (D6 — pm-stack untouched): status = GET /health, launch = POST /v1/sessions, enqueue = POST /v1/tasks. The bearer token resolves BY NAME through fleet-secrets (pm-dispatch.api-token, filed in the vault by this step — the token previously had no by-name home); it enters one Authorization header per request and is never printed or stored. Transports follow fleet-queue's two-shape pattern: direct http:// (FLEET_DISPATCH_URL / [dispatch] url, or the laptop seat's loopback probe) and, for the sandbox, a CONNECT tunnel on the proxy egress via fleet-proxy's tunnel module — the framed session-broker request shape forwards only X-Agent-Token, which pm-dispatch does not accept, so the client opens its own tunnel on the same egress. Exit codes: 0 ok, 2 usage, 3 transport/credentials, 4 service HTTP error, 69 capability stub (unchanged machinery). fleet-config gains the [dispatch] table (url/token_name/port); the registry names the enqueue verb the live API carries. Smoke gains a hermetic dispatch section (stub pm-dispatch + stub bws): 62 passed, 0 failed; workspace tests 51/51.
Codex Review SummaryThis 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. |
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a21e13f08
ℹ️ 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".
| .next() | ||
| .ok_or_else(|| { | ||
| transport_err(format!("cannot resolve dispatch address {authority}")) | ||
| })?; |
There was a problem hiding this comment.
Try all resolved addresses before failing a direct connection
When FLEET_DISPATCH_URL or [dispatch] url uses http://localhost:4879 on a host resolving localhost to ::1 before 127.0.0.1, this selects only the IPv6 address and exits with a transport error even though pm-dispatch is reachable over IPv4. The service defaults to binding 127.0.0.1 (pm-stack/dispatch/src/config.ts:81), so this affects an otherwise valid configuration. Iterate over the resolved addresses until one connects rather than discarding every address after the first.
Useful? React with 👍 / 👎.
Step 4 of the fleet epic (#5412), closing #5432: the dispatch thin client (D6 — client verbs only; pm-stack is not rewritten, rehomed, or re-platformed; the pm-stack diff attributable to this step is zero).
What lands
New crate
crates/fleet-dispatch— verbs over pm-dispatch's live HTTP API, discovered frompm-stack/dispatch/src/server.ts(the service has exactly three routes):fleet dispatch statusGET /healthfleet dispatch launchPOST /v1/sessionsfleet dispatch enqueuePOST /v1/tasksTASK_KINDS), issue-number attach, dedupe-keyPlatform rules hold: the domain is registered like every other (full build carries it;
fleet-serve/fleet-connectstub it at 69 — the smoke suite asserts all of it); the bearer token resolves by name through fleet-secrets (pm-dispatch.api-token,[dispatch] token_nameoverrides) and enters exactly oneAuthorizationheader per request — never printed, logged, or stored.fleet-configgains the[dispatch]table (url,token_name,port).Transports (fleet-queue's two-shape pattern): direct
http://fromFLEET_DISPATCH_URL/[dispatch] url, or the laptop seat's zero-config loopback probe; otherwise a CONNECT tunnel on the proxy egress via fleet-proxy's tunnel module. The framed session-broker request shape cannot carry this service's auth — it forwards onlyX-Agent-Token, which pm-dispatch does not accept — so the client opens its own tunnel on the same egress and speaks HTTP over it. Exit codes: 0 ok · 2 usage · 3 transport/credentials · 4 service HTTP error.Live-API deltas vs the design note (recorded on #5432)
~/.local/state/pm-dispatch/does not exist — pm-dispatch keeps no client-readable state; per-task status rides the queue domain, not this one.POST /v1/tasks), so the verb set is status/launch/enqueue.DISPATCH_API_TOKENhad no by-name vault home (it lived only in the laptop's~/secrets/dispatch.env), so fleet-secrets could not resolve it. Filed in Bitwarden aspm-dispatch.api-tokenby this step (value verified byte-identical to the service's by hash; never printed) — a vault filing, not a pm-stack change.pre_existing: true+ warning), not an error — verified live.Verification
cargo test --workspace: 51 passed, 0 failed (fleet-dispatch +6, fleet-config +2 new).cargo fmt --checkclean; clippy clean (run with the rustup toolchain first in PATH — the laptop's mixed cargo/clippy provenance otherwise trips E0514 on pre-existing crates too).bws: status, launch, enqueue, HTTP-error→4, bad-kind→2, unresolved-token→3).d94b8954…) from the shipped builds, detailed on fleet step 4: dispatch thin client domain over pm-stack #5432: laptop status/enqueue/duplicate/launch (session replied with the proof marker; proof tasks 9645/9647/9648 all terminal, proof issue fleet step 4 thin-client proof (launch) #5548 closed), sandbox status + enqueue through the tunnel transport.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit