Repository navigation
fix(broker): wrap client_v2's Hello/HelloReply in the Frame envelope - #904
Merged
Merged
Conversation
The v2 client's hello_round_trip sent the bare Hello bytes and expected a bare HelloReply directly -- but serve_launching_backends's real accept loop (connection.rs's handle_hello_connection_with_peer_policy / write_response_frame, what the shared broker HelloRouter runs) wraps every request and reply in the Frame protobuf envelope. That framing is load-bearing, not incidental: control_socket.rs multiplexes Hello and admin/control-channel frames on the same socket by inspecting Frame.payload_protocol, which a bare Hello can never carry. client_v2::connect is the only real client of that server path, and nothing exercised it against a live serve_launching_backends server -- every existing test either hand-rolls bare Hello/HelloReply bytes directly (broker_v2_acceptance_test.rs, tests/broker/hello_router.rs's in-memory handle_request calls) or spawns the standalone running-process-broker-v2 scaffold binary, which implements its own, separate, bare-framing Hello handler (handle_hello_bytes) -- not this path at all. So the mismatch shipped invisibly. Caught downstream on soldr's Linux Docker harness (forge-ci/soldr#2364): soldr broker serve runs serve_launching_backends, and a real client_v2::connect Hello against it failed to decode HelloReply with `UnexpectedWireType { actual: Varint, expected: LengthDelimited }` on the `result` oneof -- Frame's own low-numbered fields (envelope_version etc.) misread as HelloReply's fields once the reply came back Frame-wrapped and the client tried to decode it bare. Verified on that same harness after this fix: the same Hello now decodes correctly (a clean Refused reply for an unregistered service, where it previously decode-errored). A standalone unit test proving this in running-process's own suite hit an unrelated, pre-existing environmental gap in this crate (the same user_sid_hash()/machine-id issue already documented as tolerated in current_user_hash_resolves) on both Windows and this container, so that test is deferred rather than shipped half-working; the soldr harness verification is the evidence for this fix. Existing broker_v2_acceptance_test.rs / broker_v2_scaffold_accepts_connection.rs / tests/broker suites (365 tests) still pass -- none of them exercise client_v2::connect against serve_launching_backends, so none of them could have caught this, and none of them are affected by fixing it.
…connect() The Frame-wrap fix to client_v2::connect (this PR) left the test-only stub brokers speaking the old bare Hello/HelloReply bytes, so concurrent_connects_against_multi_accept_broker (and by the same bug, every other stub in this module) now fails CI: the client sends/expects Frame-wrapped messages but the stubs don't. Caught by PR #904's own coverage run, not locally, since a Windows run of this module alone was green before the mismatch surfaced under nextest's parallel fail-fast on Linux. Adds read_hello_frame / write_hello_reply_frame test helpers and switches all four stub brokers (stub, stall, refusing, multi-accept, missing-result) to use them.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Aug 9, 2026
chore(vendor): bump running-process to include client_v2 Frame-wrap (soldr#2364)
forge-ci/soldr#2382
Merged
zackees
added a commit
to forge-ci/soldr
that referenced
this pull request
Aug 9, 2026
…e-wrap (soldr#2364) (#2382) Bumps the vendored running-process submodule from d45c90d to 355317f, which lands zackees/running-process#904: client_v2::connect now wraps its Hello / HelloReply in the Frame envelope that serve_launching_backends actually sends/expects. This is the fix for the UnexpectedWireType decode error soldr hit when routing a real compile through the broker (Phase 2 of soldr#2361), plus the follow-up that Frame-wraps that module's in-process stub brokers so the whole broker::client_v2 test suite stays green. soldr consumes running-process via the [patch] path override on _vender/running-process; `soldr cargo check -p soldr-daemon -p soldr-cli` passes with the bump (the change is internal to client_v2, so soldr's broker-discovery call sites are source-compatible). Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
zackees
added a commit
that referenced
this pull request
Aug 9, 2026
…soldr#2364) (#907) Adds serve_launching_backends_negotiates_with_a_v2_servicedef: a cold Hello against a real serve_launching_backends broker whose service is installed as a .servicedef.v2 file (the soldr/v2-consumer default) now negotiates a backend instead of returning Refused { "service definition was not found" }. This is the integration-level acceptance proof for Phase 2 of soldr#2361: it exercises the full fixed path -- client-side Frame-wrapped Hello (#904) through the CombinedServiceDefinitionLoader's v2-first lookup (#905) to a Negotiated reply -- against the real accept loop, not a stub. Existing v1-servicedef serve tests continue to pass via the loader's v1 fallback. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
zackees
added a commit
to forge-ci/soldr
that referenced
this pull request
Aug 10, 2026
…2388) (#2405) * ci(lint): guard against a protocol_v3/client_v3 broker module (#2360, #2363) (#2370) Phase 1 of the broker-fronted daemon design (#2361/#2363) keeps the running-process broker wire at protocol_v2/client_v2, broken in place -- the minimum-version floor (ServiceDefinition.min_version, already enforced by running-process's Hello handler; see hello_handler.rs::validate_version_policy) is what forces integrators to upgrade, not a coexisting new wire major. Add a static grep-based CI check (same shape as loc_ratchet / verify_release_profile_policy) that fails if a protocol_v3 or client_v3 module ever appears in crates/ or the vendored _vender/running-process submodule, so the ban is enforced rather than just documented. This directly satisfies the "No v3" testing invariant named in #2363. No behavior change to soldr or running-process themselves -- Phase 1's actual token/session/singleton work is a separate, larger change; this is a narrow, immediately-landable guardrail slice of it. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]> * chore(vendor): bump running-process submodule to 1da8fa5 (soldr#2363 Phase 1) (#2372) Picks up zackees/running-process#898/#899/#900: the composite broker/daemon session-token authority wired into HelloHandler, the singleton-per-user-session concurrent-starter race test (plus the real stale-unix-socket bug it caught and fixed), and the wire-protocol floor now checked before service lookup/spawn. running-process is consumed via the workspace [patch] path override (_vender/running-process/crates/running-process), so this is a local-only submodule pointer bump -- no external registry publish involved. Cargo.toml version/rev fields updated in lockstep for hygiene (they are shadowed by [patch] but should still reflect the real pin). soldr-cli and soldr-daemon build clean against the bumped submodule; version_lockstep and the full soldr-daemon test suite (203 tests) pass. No behavior change yet -- the new capability lands dormant, matching #2363's stated scope. soldr#2364 (Phase 2) is what will actually configure with_session_token_authority. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]> * chore(vendor): bump running-process submodule to d5d2b2a (soldr#2364 Phase 2 prep) (#2373) Picks up zackees/running-process#901: extracts the v2 broker's bind/singleton/stale-socket-cleanup logic into a public library module (broker::server::singleton_bind), the primitive a future soldr-side broker role needs. No behavior change to running-process's own scaffold binary (dogfooded in #901 itself); running-process's own version is unchanged (4.10.1), so only the soldr-daemon Cargo.toml pinned rev field moves in lockstep with the submodule pointer. soldr-cli and soldr-daemon build clean against the bumped submodule; version_lockstep and the full soldr-daemon test suite (203 tests) pass, clippy clean. No soldr behavior change yet -- nothing in soldr calls singleton_bind yet. Next Phase 2 step is the argv[0] broker-dispatch design question (soldr#2364). Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]> * feat(broker): add dormant `soldr broker serve` (soldr#2361 Phase 2) (#2374) * feat(broker): add dormant `soldr broker serve` (soldr#2361 Phase 2) First real Phase 2 implementation slice, per the design comment on #2364: soldr had zero broker-server infrastructure before this. Adds Commands::Broker { command: BrokerSubcommand } with one verb, Serve, resolved as a plain subcommand rather than an argv[0] shim identity -- nothing external ever needs to find a broker process by a conventional binary name, only soldr's own front door will spawn it (future work), so a subcommand is simpler than installing a hardlinked shim. `soldr broker serve [--program NAME]` resolves the v2 bind name via running-process's user_sid_hash/v2_program_pipe/singleton_bind (the same primitives running-process-broker-v2 uses, now public library calls after running-process#899/#901) and then hands off to running_process::broker::server::serve_launching_backends -- the crate's own production accept loop, Hello validation, version-floor check, and CommandBackendLauncher wiring, all reused rather than reimplemented. With no soldr-daemon .servicedef.v2 installed yet (a separate `soldr daemon install-servicedef` step), every Hello is correctly refused as ServiceUnknown rather than the broker guessing; daemon-launch behavior activates once that servicedef exists. An already-bound refusal exits EX_TEMPFAIL(75) with an explanatory message, mirroring running-process-broker-v2's own convention. Fixed a real bug caught by manual smoke-testing before it shipped: the refusal path never called exit_guard::mark_spoke(), so soldr's own "exiting with no diagnostic" guard (#2024) wrongly flagged an already-explained, expected refusal as an unexplained internal fault. Moves the `running-process` dependency from soldr-cli's [dev-dependencies] to [dependencies] -- it's now used in production code, not just tests. New integration test cli_broker_single_instance.rs spawns two real `soldr broker serve` processes against the same --program namespace and asserts exactly one binds, the loser exits 75 with an "already bound" explanation, and critically that the explained refusal does NOT also trip the generic #2024 annotation (the mark_spoke() bug this test would have caught). Ran the full local gate before pushing (fmt --all, clippy --workspace, soldr-cli --lib [1202 tests], version_lockstep, the new broker test, soldr-daemon --lib [203 tests]) -- all green, per the process lesson from running-process#901's earlier round-trips. Dormant: nothing in soldr's front door spawns this yet. That wiring, plus soldr-daemon's own servicedef auto-install and composite-token minting, are separate follow-up slices on soldr#2364. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(lint): split broker dispatch and builtin-verb lists out of ratcheted files CI's Lint job caught a real violation: both soldr_main.rs and cli_args.rs are already over the repo's 1,500-line loc_ratchet ceiling, and the previous commit grew both (soldr_main.rs 1578->1664, cli_args.rs 1500->1532). A file already over the ceiling may only shrink, never grow (.github/scripts/loc_ratchet.py). - Moved run_broker_command/run_broker_serve/ broker_serve_error_is_already_bound out of soldr_main.rs into a new crates/soldr-cli/src/broker_cmd.rs, matching the existing daemon_entry.rs / cache.rs per-surface module pattern. Collapsed the Commands::Daemon and Commands::Broker match arms to single-expression form as a small adjacent cleanup, since block form was no longer needed for either. - Moved BrokerSubcommand into broker_cmd.rs too, since clap's derive works fine across the module boundary as long as the type is in scope where Commands::Broker references it. - Extracted CARGO_BUILTIN_VERBS / SOLDR_BUILTIN_VERBS / is_cargo_builtin_verb into a new crates/soldr-cli/src/builtin_verbs.rs, re-exported from cli_args.rs -- this pair of self-contained lists was the actual bulk of cli_args.rs's growth room, unrelated in substance to the Commands enum itself. soldr_main.rs: 1664 -> 1577 lines (3 lines under the 1578 baseline). cli_args.rs: 1532 -> 1385 lines (well under the 1500 baseline). `python3 .github/scripts/loc_ratchet.py --base-ref origin/broker-enhanced` now reports zero violations. Ran the full local gate before pushing: fmt --all --check, clippy --workspace, soldr-cli --lib (1202 tests), version_lockstep, cli_broker_single_instance, soldr-daemon --lib (203 tests). All green. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]> * feat(broker): auto-install soldr-daemon's servicedef on `broker serve` (#2375) soldr#2361 Phase 2 follow-up to #2374, which explicitly called this out as a separate remaining step: `soldr broker serve` previously required a human to run `soldr daemon install-servicedef` first, or every Hello negotiation was correctly but uselessly refused as ServiceUnknown. Now `run_broker_serve` calls `daemon::service_definition::install_default_service_definition()` before binding, so a freshly-started broker is immediately useful. Best-effort, not fatal: a failure (e.g. no sibling soldr-daemon shim next to this soldr binary in a partial dev build) logs a warning and the broker still serves, falling back to the same refuse-everything behavior as before this change -- a broken servicedef install must never take down the broker. Manually verified both paths against the real binary: with a soldr-daemon shim present, the servicedef installs and prints its path; the singleton-refusal and general Hello-serving behavior are unaffected (the underlying serve_launching_backends call is unchanged). Ran the full local gate before pushing: fmt --all --check, clippy --workspace, soldr-cli --lib (1202 tests), version_lockstep, cli_broker_single_instance, soldr-daemon --lib (203 tests), and loc_ratchet.py (0 violations -- broker_cmd.rs is 147 lines, nowhere near the ceiling). All green. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]> * feat(broker): opt-in front-door spawn of `soldr broker serve` (soldr#2361 Phase 2) (#2376) * feat(broker): opt-in front-door spawn of `soldr broker serve` soldr#2361 Phase 2: the front door's single allowlisted spawn exception. Adds `broker_spawn::maybe_spawn_broker_front_door`, called from `run_main` strictly after the RUSTC_WRAPPER re-entry branch has already returned, so a wrapper re-entry (cargo calling back into soldr once per compile unit) can never reach it -- recreating that path would reproduce the spawn-storm this whole redesign exists to kill (soldr#2360). `front_door_broker_spawn_eligible` is a pure, directly-unit-tested predicate for this invariant, independent of the call-site placement. Dormant/opt-in via `SOLDR_USE_BROKER=1`, default OFF -- nothing downstream consumes the broker yet (composite session-token minting at daemon spawn time is still separate follow-up work per #2364), so today this only proves the plumbing: does a broker come up when asked. Per advisor guidance, deleting the working direct-spawn path before the broker path is proven end-to-end (a real compile routed through a broker-launched daemon, which needs the Linux Docker harness per this repo's Agent Development Environment Rule -- not yet built) would trade a working default for a non-functional one. Opt-in keeps this reversible and keeps default `broker-enhanced` behavior unchanged. Spawns via `running_process::spawn_daemon_with_stdio_and_env_policy` (the same detach machinery soldr-daemon's own client-spawns-daemon path uses) rather than a bare `Command::spawn()`. Caught by hand while smoke-testing against the real binary, not by any written test: a bare spawn stays attached to the caller's Windows job object / console, so a harness that waits for the whole descendant tree to exit hangs on the long-lived broker even though the direct child (the `soldr` invocation) already returned. Switching to the detached-spawn helper fixed it; verified end-to-end against the real binary afterward: `SOLDR_USE_BROKER=1 SOLDR_BROKER_PROGRAM=x soldr status` returns immediately, the broker stays alive detached and logs its bind line, and a second `soldr broker serve --program x` correctly refuses with exit 75. Ran the full local gate before pushing: fmt --all --check, clippy --workspace -D warnings, soldr-cli --lib (1207 tests), cli_broker_single_instance, version_lockstep, soldr-daemon --lib (203 tests), and loc_ratchet.py (0 violations -- soldr_main.rs's one new call-site line is offset by a 4-to-3-line reflow of its own module doc comment, since the file was already at the 1500-line ratchet ceiling and may not grow). Co-Authored-By: Claude Fable 5 <[email protected]> * fix(broker): wrap broker_spawn tests with timed_test! macro CI's timed_test_lint integration test (run via `--tests`, not caught by a bare `--lib` run) failed on the previous commit: bare #[test] declarations must use the crate's timed_test! watchdog macro. Missed this locally by only running `soldr cargo test -p soldr-cli --lib` before pushing #2376 -- the repo's own guidance (docs/CONTRIBUTING_TESTS.md territory) is that `--lib` skips this integration-level lint. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]> * chore(vendor): bump running-process submodule to db97ef9 (soldr#2364) (#2377) Pulls in zackees/running-process#902: HelloRouter mints + registers a launched daemon's session-token half at spawn time, and adds the new GetSessionToken control-channel RPC a client will eventually call to learn it. See soldr#2364 for the design context (why this rides on the v2 control channel rather than the frozen v1 Hello envelope). Keeps crates/soldr-cli/Cargo.toml and crates/soldr-daemon/Cargo.toml's rev field in lockstep with the submodule pointer, per this repo's established convention. No Cargo.lock change -- running-process resolves via the [patch] path-override to _vender/running-process, so the git/rev fields are documentation, not what actually gets built. Ran the full local gate before pushing: fmt --all --check, clippy --workspace -D warnings, soldr-cli --lib (1207 passed), cli_broker_single_instance, version_lockstep, timed_test_lint, soldr-daemon --lib (203 passed). All green. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]> * chore(vendor): bump running-process submodule to d45c90d (soldr#2364) (#2378) Pulls in zackees/running-process#903: the spawn-budget storm guard now rotates the broker's session token exactly once per storm, per soldr#2364's "threshold trip -> broker rotates its own token -> all clients exit 1" scope item. Keeps crates/soldr-cli/Cargo.toml and crates/soldr-daemon/Cargo.toml's rev field in lockstep with the submodule pointer. No Cargo.lock change -- running-process resolves via the [patch] path-override. Ran the full local gate before pushing: fmt --all --check, clippy --workspace -D warnings, soldr-cli --lib (1207 passed), cli_broker_single_instance, version_lockstep, timed_test_lint, soldr-daemon --lib (203 passed). All green. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]> * fix(broker): match front-door broker --program to what discovery dials (#2379) soldr#2364: `client_v2::connect(program, version_hint)` derives the pipe name via `v2_program_pipe(program, ...)` and sends `program` as the Hello `service_name` in one call -- the v2 API conflates broker bind-namespace and Hello routing into a single string. The front door was spawning `soldr broker serve --program soldr` while `broker_discovery:: discover_via_broker` dials `client_v2::connect("soldr-daemon", ...)`, so every discovery Hello missed the front-door-spawned broker entirely and fell through to the legacy direct-spawn path -- silently, with the broker left running but never consulted. Caught empirically on the Linux Docker harness (soldr#2361 Phase 2's own acceptance test): a cold-start `soldr cargo build` under SOLDR_USE_BROKER=1 spawned a broker, but `daemon-spawn.log` (the legacy path's own log) showed it, not the broker, launched the daemon that served the build. Fixes the default on both ends to soldr-daemon's own service name, plus regression tests locking the three (front-door spawn default, `soldr broker serve`'s clap default, and the constant they both point at) so they can't drift apart silently again. Co-authored-by: Zach Vorhies <[email protected]> * feat(broker): consult broker discovery before legacy spawn in compile_dispatch (soldr#2364) (#2380) * feat(broker): consult broker discovery before legacy spawn on cold connect (soldr#2364) Root-caused on the Linux Docker harness: `compile_dispatch.rs`'s `dispatch_compile_with_sock_and_marker_detailed` -- the function every real compile goes through -- never called `lifecycle::is_live` / `broker_discovery::discover_via_broker` at all. It dialed `client::default_sock_path` directly and, on failure, went straight to the legacy `try_spawn_detached_until`. Confirmed by running a foreground `RUST_LOG=debug soldr broker serve` and a real cargo build against it: the broker's log showed only its own startup lines, no Hello ever arrived. grep confirms `is_live` had exactly two external callers (`soldr daemon start` and one internal daemon-side self-check) -- neither in the compile hot path. This meant PR #2379's namespace fix, while correct, could never actually route a real build through a front-door-spawned broker: nothing tried. Adds `broker_confirmed_daemon_live()`, consulted only under the existing `SOLDR_USE_BROKER=1` opt-in (via the new shared `broker_spawn::broker_enabled()`), right before the legacy spawn branch. On a confirmed live daemon (`DiscoveryRoute::BrokerNegotiated` + a successful local probe), the legacy spawn is skipped and the retry loop redials the deterministic socket, which the broker-launched daemon is already bound to -- matching Phase 2's direct-connect design (the broker negotiates; the client still dials the daemon's deterministic endpoint directly). Every other outcome (disabled, unreachable, refused, unconfirmed) returns false, leaving the existing legacy-spawn-on-failure behavior completely unchanged for the default (SOLDR_USE_BROKER unset) path. Bumps `soldr_daemon_pid_via_broker` from `pub(crate)` to `pub` (matching the `SOLDR_DAEMON_SERVICE_NAME` precedent from #2379) so soldr-cli can call it directly instead of duplicating discovery logic. Note: an earlier hypothesis in this investigation (that a too-short `client_v2::connect` Hello deadline was racing the broker's cold daemon launch) was ruled out before implementation -- the debug-log run showed no Hello was ever sent, which is a call-site gap, not a timeout race. * refactor: move broker_confirmed_daemon_live into its own module compile_dispatch.rs is already over the repo's 1,500-line loc_ratchet ceiling; a file already over the ceiling may shrink but never grow. Splits the new soldr#2364 gate function (and its tests) into broker_discovery_gate.rs instead. * refactor: shrink compile_dispatch.rs's spawn_err branch to a single call Moves the whole spawn-or-confirm-broker-daemon branch into broker_discovery_gate.rs (spawn_or_confirm_broker_daemon), not just the predicate, so compile_dispatch.rs nets smaller than before this soldr#2364 change instead of larger -- required by loc_ratchet since that file is already over the 1,500-line ceiling. --------- Co-authored-by: Zach Vorhies <[email protected]> * chore(vendor): bump _vender/running-process to include client_v2 Frame-wrap (soldr#2364) (#2382) Bumps the vendored running-process submodule from d45c90d to 355317f, which lands zackees/running-process#904: client_v2::connect now wraps its Hello / HelloReply in the Frame envelope that serve_launching_backends actually sends/expects. This is the fix for the UnexpectedWireType decode error soldr hit when routing a real compile through the broker (Phase 2 of soldr#2361), plus the follow-up that Frame-wraps that module's in-process stub brokers so the whole broker::client_v2 test suite stays green. soldr consumes running-process via the [patch] path override on _vender/running-process; `soldr cargo check -p soldr-daemon -p soldr-cli` passes with the bump (the change is internal to client_v2, so soldr's broker-discovery call sites are source-compatible). Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * chore(vendor): bump running-process to v2 servicedef loader (soldr#2364) (#2383) Bumps _vender/running-process from 355317f to 980c14e, landing the last two running-process pieces of Phase 2 (soldr#2361): - #905: CombinedServiceDefinitionLoader — the shared broker's serve path now reads soldr's `.servicedef.v2` files (v2-first, v1 fallback), so a real Hello resolves the service definition instead of returning Refused. - #906: rustdoc intra-doc link fix for that module. This is the vendored code needed for a SOLDR_USE_BROKER=1 cold compile to negotiate through the broker end-to-end. `soldr cargo check -p soldr-daemon -p soldr-cli` passes with the bump. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * fix(broker): honor SOLDR_BROKER_PROGRAM on all four namespace sites (soldr#2364) (#2385) The SOLDR_BROKER_PROGRAM override (documented "test-only, to disambiguate") was half-wired: it moved the front-door broker's bind namespace but NOT the program discovery dials nor the servicedef the broker serves. Because client_v2::connect sends the dial `program` as the Hello `service_name` in one shot, an override bound+dialed one name while the servicedef was installed under `soldr-daemon`, so every Hello under the override was refused — the override could never actually reach an overridden broker. Same drift class soldr#2379 fixed for the default. Centralizes a single `broker_program()` resolver in soldr-daemon (backend_handle_adoption) next to SOLDR_DAEMON_SERVICE_NAME, and routes all namespace-deriving sites through it: - discover_via_broker dials broker_program() (was the fixed const) - soldr_daemon_service_definition installs the servicedef under broker_program() - broker_spawn's front-door spawn drops its duplicate const+fn and uses the shared resolver (eliminating the cross-crate drift the doc warned about) Default behavior is unchanged (broker_program() → "soldr-daemon" everywhere), so zero production impact. Under an override all four sites agree, which makes the override actually functional and gives broker integration tests an isolated, parallel-safe program namespace (the enabler for the Phase 2 cold-start "broker launches one daemon" acceptance test). Testing: broker_spawn (7), service_definition (3), broker_discovery (11) lib tests pass; clippy -p soldr-daemon -p soldr-cli clean; fmt clean. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * chore(vendor): bump running-process to post-SessionExit.metadata main (soldr#2388 Step 2) (#2389) * chore(vendor): bump _vender/running-process to post-SessionExit.metadata main (soldr#2388 Step 2) Single submodule bump to running-process main @ 111ff61, which includes the final SESSION frame schema — `SessionExit.metadata` opaque map (#935), the relay-survival test + README fence (#936), and the green linux-x86 rustdoc lane (#937). This is the one bump for the Batch B SESSION work; soldr pins a commit with the final wire so it never pins twice (soldr#2365 Q3 ordering). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * chore(vendor): refresh Cargo.lock for the running-process bump (soldr#2388 Step 2) --------- Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * chore: gitignore the repo-local CARGO_HOME cache (.cargo/{registry,git,caches}) (#2390) perf_local.py and the Docker harnesses point CARGO_HOME at ./.cargo, leaving the downloaded registry/git checkouts + package caches as untracked files a stray 'git add -A' can sweep into a commit (24k+ files). Ignore the caches; keep the tracked .cargo/config.toml. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * refactor(daemon): make dispatch_compile_streaming generic over an output sink (soldr#2388 Step 5) (#2391) Extracts the compile-output streaming into a `CompileOutputSink` (`emit_stdout_chunk` / `emit_stderr_chunk` / `emit_done(exit_code, cached, cache_outcome, compile_id)`), so one embedded-zccache execution serves both wires: - `LegacyDaemonSink` writes `Response::CompileStdoutChunk` / `CompileStderrChunk` / `CompileDone` — byte-identical to the pre-refactor wire (locked by `tests/phase5_contract.rs`); `compile_id` stays off the legacy wire (always empty there). - the SESSION `0x5350` sink (soldr#2365 Step 6) will encode `SessionFrame`s via running-process `session_codec`, carrying `cache_outcome`/`compile_id` on `SessionExit.metadata`. Per the fable5 ruling on #2365 (answer A): soldr owns execution via embedded zccache; the sink is transport-only. Telemetry + disconnect error-attribution stay in the caller. The sink lives in a new `daemon::compile_sink` module so `server.rs` (already over the 1,500-line ratchet) shrinks rather than grows. NOTE: Docker validation (phase5_contract.rs + soldr-daemon build) pending — the local Docker engine is down for VHDX compression. Not merged until phase5_contract is confirmed green. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * fix(daemon): remove dead AsyncWriteExt import from compile_sink (soldr#2388 Step 5 fix-forward) (#2392) The merged Step 5 (#2391) left a leftover `use AsyncWriteExt as _KeepAsyncWriteExt;` after the top import was narrowed to `AsyncWrite`, so soldr-daemon failed to compile (E0432 unresolved import) — broker-enhanced was red. Delete the dead line. Validated on host (Docker down for VHDX compression): `soldr cargo check -p soldr-daemon --tests` compiles; `soldr cargo test -p soldr-cli --test phase5_contract` → 7/7 passed (the locked legacy wire is byte-identical). Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * refactor(daemon): extract shared argv→CompileRequest parser (soldr#2388 Step 6) (#2393) fable5's Q2 ruling: SessionStart carries raw rustc argv+env+cwd and the argv→CompileRequest conversion lives daemon-side in ONE shared function so the RUSTC_WRAPPER client and the daemon's SESSION codec-bridge can never disagree on parsing. - New `soldr_daemon::daemon::compile_request::build_compile_request_from(argv, cwd, env)` — parameterized over cwd/env (the daemon builds from a SessionStart's carried env, not its own process env). Env is filtered by `is_compile_env_var` exactly as the legacy wrapper path (Q2 condition 1 — surface not widened; the filter is idempotent). Lives in soldr-daemon because `CompileRequest` does and soldr-cli depends on soldr-daemon (soldr-cache is below CompileRequest, so it cannot host it). - `is_compile_env_var` + the argv/lifecycle helpers move here; `soldr-cli`'s `build_compile_request` becomes a thin `std::env` reader delegating to it, and re-exports `is_compile_env_var` so callers + tests/phase5_contract.rs keep their path. - Also formats server.rs:2037 (a fmt-only fix-forward for Step 5 #2391, which merged while Docker was down). Validated on Windows via local soldr: builds clean; `phase5_contract` 7/7 (incl. is_compile_env_var via the re-export); fmt --check clean; clippy -p soldr-daemon -D warnings clean. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * feat(daemon): SESSION output sink + shared stream_compile_output (soldr#2388 Step 6) (#2394) The output half of the SESSION codec-bridge vertical (fable5 answer-A: soldr owns execution via embedded zccache; only the output is re-framed per wire). - Extract `stream_compile_output<Sink: CompileOutputSink>` from `dispatch_compile_streaming` so one embedded-zccache execution streams through either wire's sink, with identical chunking, disconnect error-attribution, and per-compile telemetry. Legacy path (`LegacyDaemonSink`) is byte-identical — `tests/phase5_contract.rs` stays green. - `daemon::session_sink::SessionCompileSink` — the SESSION `0x5350` sink: renders stdout/stderr as `SessionFrame`s via running-process `session_codec`, and the terminal `Exit` carries `cache_outcome`/`compile_id` on `SessionExit.metadata` (running-process#934) so the SESSION path keeps the legacy `CompileDone` observability. Unit test round-trips all three frame kinds through the codec. Validated on Windows (local soldr): soldr-daemon builds; SessionCompileSink unit test passes; `phase5_contract` 7/7 (legacy wire unchanged); fmt --check clean; clippy -p soldr-daemon -D warnings clean. Remaining Step 6 (next): the codec-bridge serve fn (read SessionStart → build_compile_request_from → run compile → stream_compile_output with the SESSION sink) + the broker_owned_bind 0x5350 endpoint + the real-compile e2e integration test. Held back because it needs a real embedded-zccache State (not mockable), a heavier integration effort than fits one validated turn. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * feat(daemon): SESSION compile codec-bridge + real-rustc e2e (soldr#2388 Step 6c) (#2395) Completes the Step 6 vertical: a real SESSION compile now runs client → serve_session_compile → embedded zccache → SessionFrames. - `daemon::session_serve::serve_session_compile` — the codec-bridge: reads the opening `SessionStart` (raw rustc argv+env+cwd) via `session_codec`, converts it with the shared `build_compile_request_from`, runs it through the SAME embedded zccache execution the legacy `Request::Compile` uses, and streams the captured output back as `SessionFrame`s via `stream_compile_output` + the `SessionCompileSink`. No spawned child at the session layer (fable5 answer-A); a compile-service error is a `SessionFrame::Stderr` diagnostic + distinct infra `Exit` (111), never a silent close. - Decouple `stream_compile_output` from `&State` (takes `&SoldrPaths`) and expose it + `next_compile_id` as `pub(crate)`, so the SESSION path reuses the exact legacy output plumbing without constructing a full daemon `State`. - e2e test `session_compile_e2e_real_rustc_through_the_bridge`: a **real rustc compile** of a trivial lib, driven over a duplex, asserting exit 0 and `cache_outcome`/`compile_id` on `SessionExit.metadata`. Validated on Windows (local soldr): soldr-daemon builds; the e2e test passes (real compile); `phase5_contract` 7/7 (legacy wire unchanged by the paths refactor); session_sink unit test passes; fmt + clippy -D warnings clean. Remaining Step 6: the broker_owned_bind 0x5350 endpoint that serves this bridge in the daemon's accept loop (production wiring) — the bridge + its execution are now proven end-to-end. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * feat(daemon): SESSION 0x5350 endpoint accept loop (soldr#2388 Step 6d) (#2397) Serve SESSION 0x5350 on a separate broker-facing backend endpoint per #2386 Option A (audit correction soldr#2365 comment 5233624686). handle_connection (the legacy loop) is untouched — its Payload{0x5350} -> drain_then_close stays as the defensive default. - soldr_session_endpoint_mux: a NEW BackendEndpointMux serving &[0x5350] with no legacy wire (the shared soldr_backend_endpoint_mux, served=&[], is left alone so handle_connection does not regress). - serve_session_connection: drives the full mux over a growing buffer — answers BackendHandle liveness probes (ProbeAnswered) AND, on a 0x5350 frame, takes over as a streaming SESSION compile. Handoff is replay-not-drain: the undrained buffer + live stream are wrapped in ReplayReader and handed to the proven serve_session_compile (Step 6c), which re-reads the SessionStart via session_codec. Mirrors running-process session_takeover_from_buffered, minus its child-spawn (soldr owns execution via the embedded zccache service — fable5 answer-A ruling). - serve_session_endpoint + bind_session_listener + resolve_session_listener: the accept loop over a tokio local-socket listener, wired into run_async alongside the legacy loop. Opt-in via SOLDR_SESSION_ENDPOINT_PATH until Phase 2 makes the broker the daemon's spawner and hands over the listener (Step 8 will prepend the broker_owned_bind::recover_from_env adopt path); unset -> None -> no endpoint, so today's direct compile path is unchanged. Tests (all pass on Windows): a real rustc compile through the mux handler (Payload -> replay -> serve_session_compile -> embedded zccache -> SessionFrames, exit 0 + cache_outcome/compile_id metadata); a BackendHandle probe answered on the same handler (Option A coexistence); and the accept loop binding a real local-socket, dialed and probed over the actual transport. Adds interprocess (tokio feature) to soldr-daemon for the relay-compatible listener. phase5_contract 7/7 (legacy wire byte-identical). Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * feat: SESSION 0x5350 live end-to-end — client → broker relay → daemon (soldr#2388 Step 7) (#2398) * feat(daemon): daemon serves deterministic SESSION endpoint by default (soldr#2388 Step 7) daemon_session_endpoint_path(paths) — the deterministic SESSION socket the daemon binds and the broker's SESSION relay dials as Negotiated.backend_pipe (#2386 Option A mechanism ii, bind-by-advertised-name; portable, Windows-safe). resolve_session_listener now default-binds it (env override still honored). serve_session_endpoint / bind_session_listener / soldr_session_endpoint_mux / SessionMux / SessionListener made pub for the cross-crate e2e anchor. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * feat(cli): SESSION 0x5350 client + broker companion relay (soldr#2388 Step 7) Makes the SESSION path live end-to-end: client -> broker relay -> daemon endpoint, per the advisor's ruling on #2386 Option A topology (c) — two sockets. - session_transport.rs: the broker companion SESSION relay (spawn_session_relay runs the proven async serve_broker_session_socket on its own tokio-runtime thread, negotiating every Hello to the daemon's deterministic SESSION endpoint via a fixed-backend responder) + the sans-io SESSION client (run_session_compile dials the companion socket, sends the standard v2 Hello, reads Negotiated, then drives SessionStart/stdout/stderr/exit over session_codec — avoiding the daemon-gated run_session_client). - broker_cmd.rs: run_broker_serve spawns the companion relay alongside the untouched sync control serve (serve_launching_backends). Non-fatal on failure. - daemon::session_endpoint made `pub` so soldr-cli derives the same daemon_session_endpoint_path (bind-by-advertised-name, #2386 Option A mechanism ii — portable; Windows has no fd handover) and the e2e can drive the serve entry points. - soldr-cli deps: running-process += client-async (the async relay primitives; no rusqlite), + interprocess (tokio) for the async dial. Anchor test tests/session_relay_e2e.rs: a SessionStart -> exit-code round-trip proxied client -> broker relay -> endpoint over real local sockets (a deterministic mock endpoint stands in for the daemon; the real codec-bridge endpoint driving real rustc is proven by Step 6d). phase5_contract 7/7. Advances #2388. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * feat(cli): route the compile hot path through SESSION under SOLDR_USE_SESSION (soldr#2388 Step 7b) (#2399) Wires run_session_compile into compile_dispatch as an opt-in SESSION hot path, with a fallback-safety boundary so the default (flag-unset) path is never regressed and an opted-in failure can never double-print. - SessionError { output_started }: tags a SESSION failure as pre-output (connect / Hello / negotiate / SessionStart send — nothing printed, safe to retry on legacy) vs mid-stream (output already streamed to local stdio — a legacy retry would double-print, so it is a hard error). run_session_compile* now return it. - session_enabled(): opt-in via SOLDR_USE_SESSION, default off. SESSION rides on the broker, so it is only meaningful with SOLDR_USE_BROKER. - compile_dispatch::dispatch_compile_detailed: a gated SESSION branch that ensures the broker+daemon (reusing spawn_or_confirm_broker_daemon), runs the compile over SESSION (client -> broker relay -> daemon), and falls back to the legacy path ONLY on a pre-output failure. Output streams straight to process stdio, which is what the RUSTC_WRAPPER hot path passes. Tests: pre_output_error_is_safe_to_fall_back + session_enabled_follows_env; the Step-7 mock relay e2e still passes; phase5_contract 7/7; clippy -D warnings clean (both crates); fmt clean. Follow-up validation: real-rustc-through-relay e2e + a Windows multi-process smoke test (spawn a real `soldr broker serve` + real daemon) — the production spawn path the codebase notes needs a real broker+daemon harness. Advances #2388. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * test(cli): real-rustc SESSION anchor — cached compile client->broker->daemon (soldr#2388 Step 8) (#2400) Proves soldr's value prop over SESSION: a REAL rustc compile flows client -> in-process broker relay -> real daemon SESSION endpoint + real embedded zccache -> real rustc, and the cache engages — first run is a MISS (cache_outcome=2), an identical second run is a HIT (cache_outcome=1). This stitches the three separately-proven pieces into the production data path (everything but process-spawning): the transport (Step 7 mock relay e2e), the daemon codec-bridge endpoint with real rustc (Step 6d), and the client. Also surfaces the cache outcome from the client (SessionCompileOutcome { exit_code, cache_outcome }, read off the Exit frame metadata) so the anchor can assert miss->hit and the hot path keeps observability parity. run_session_compile / _with keep their exit-code signatures (compile_dispatch + mock e2e unchanged); run_session_compile_with_detailed returns the full outcome. rustc is resolved as the sibling of cargo's CARGO env var — host-agnostic and dep-free (no rustup on the test PATH here, no heavy zccache test-support dev-dep). Validated on Windows: real anchor miss->hit pass; session_transport units 2/2; Step-7 mock e2e still 1/1; phase5_contract 7/7; timed_test_lint pass; clippy -D warnings clean (both crates); fmt clean. Advances #2388. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * fix(session): make multi-process SESSION actually serve compiles (soldr#2388) (#2402) Found + fixed a real bug: with SOLDR_USE_SESSION on, a real client -> broker -> daemon compile silently fell back to legacy because the client's dial of the broker's companion SESSION socket failed with os error 2. Root cause: the broker bound the relay via running-process's serve_broker_session_socket (its own socket-name conversion) while the client dials via soldr's local_session_name — the two produced different pipe names. Fix (no workaround): bind the relay with soldr's OWN bind_session_listener, the exact conversion the client's dial uses, so bind and dial are provably identical. The relay now also emits a real "SESSION relay bound at <path>" signal only after the socket exists, and the SESSION hot path retries PRE-OUTPUT failures within the spawn budget so it never loses to a broker/daemon startup race. - compile_dispatch::try_session_dispatch: pre-output retry loop + SOLDR_SESSION_DEBUG "SESSION compile served (cache_outcome=..)" observability (uses the cache_outcome the client already surfaces). - tests/session_multiprocess_smoke.rs: spawns a REAL `soldr broker serve`, runs soldr in RUSTC_WRAPPER mode with SOLDR_USE_BROKER/SESSION, waits for the relay BOUND signal, and asserts SESSION carried the compile (not a legacy fallback). Robust cleanup recursively terminates the test's daemon.pid; no leak. Verified on Windows: multi-process smoke passes; real-rustc anchor + mock relay e2e + session_transport units + phase5_contract (7/7) all green. Advances #2388. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * fix(session): loc-ratchet shrink + two_brokers race (soldr#2388 follow-up) (#2404) Fixes the two CI failures #2402 introduced on broker-enhanced: 1. Lint / line-ceiling ratchet: compile_dispatch.rs is over the 1500 ceiling and the SESSION hot path grew it (2017 lines). Moved all SESSION policy — the opt-in gate, broker/daemon ensure, pre-output retry, and mid-stream-vs- fallback boundary — out of compile_dispatch into session_transport::session_hot_path (returning SessionHotPathOutcome). Deleted try_session_dispatch; compile_dispatch shrank to 1953 (< baseline, ratchet passes). session_transport stays well under the ceiling. 2. two_brokers_against_one_program_never_coexist (flaky since Step 7): run_broker_serve prints its "binding at" readiness line BEFORE serve_launching_backends binds the control socket, and the Step-7 SESSION-relay block (SoldrPaths::new + daemon_session_endpoint_path + spawn) sat in that window on the MAIN thread, widening the singleton race so a second broker could bind first. Fix: move ALL relay setup onto a background thread so the main thread goes straight from "binding at" to the control bind (restoring the pre-Step-7 timing). WIP: needs post-restart validation (soldr cargo check + the multi-process smoke + two_brokers + loc_ratchet). Committed to preserve across a machine restart. Advances #2388. Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Zach Vorhies <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes a real client/server wire-framing mismatch in the v2 broker's Hello negotiation, found while wiring soldr's compile hot path through the broker (forge-ci/soldr#2364).
The bug
client_v2::hello_round_tripsent the bareHelloprotobuf bytes and expected a bareHelloReplydirectly. But the real accept loop for a shared broker (serve_launching_backends/HelloRouter, which is whatsoldr broker serveand any realclient_v2::connectconsumer actually runs against) wraps every request and reply in theFrameenvelope -- seeconnection.rs'sFrame::decode/write_response_frame.That framing isn't incidental:
control_socket.rsmultiplexes Hello and admin/control-channel frames on the same socket by inspectingFrame.payload_protocol, which a bareHellocan never carry. So Frame-wrapping is load-bearing for the real server, and the client had simply never been updated to match.Why nothing caught this
client_v2::connectis the only real client ofserve_launching_backends, but nothing in this crate's own test suite ever dialed it against that server:broker_v2_acceptance_test.rsandtests/broker/hello_router.rs's in-memory tests hand-roll bareHello/HelloReplybytes directly, bypassingclient_v2::connectentirely.tests/broker/*tests spawn the standalonerunning-process-broker-v2binary, which implements its own, completely separate, bare-framing Hello handler (handle_hello_bytesinsrc/bin/running-process-broker-v2.rs) -- notHelloRouter/connection.rsat all.So the mismatch shipped invisibly until a real consumer (soldr) actually dialed the real server.
How it was caught and verified
Root-caused on soldr's Linux Docker harness: a real
client_v2::connectHello against a livesoldr broker serve(which runsserve_launching_backends) failed to decodeHelloReplywith:Frame.envelope_version(field 1,uint32/Varint) misread asHelloReply.result's oneof discriminant (field 1, message-typed/LengthDelimited) -- exactly what decoding aFrame-wrapped reply as a bareHelloReplyproduces.After this fix, the same Hello against the same broker decodes correctly -- verified as a clean
Refusedreply (for an unregistered service) where it previously decode-errored.Testing
cargo fmt --all -- --check,cargo clippy -p running-process --features client -- -D warnings: clean.broker_v2_acceptance_test.rs(6 tests) +broker_v2_scaffold_accepts_connection.rs(6 tests): pass unchanged -- neither exercisesclient_v2::connectagainstserve_launching_backends, so neither could have caught this and neither is affected by fixing it.tests/brokersuite (365 tests): 364 pass; 1 (connection::serve_local_socket_connections_refuses_malformed_hello_flood) is flaky under parallel-test contention on this machine -- confirmed by running it in isolation both with and without this change (passes both times), and confirmed pre-existing by stashing the fix and re-running (same flake). Not caused by or related to this change.client_v2::connect-vs-serve_launching_backendsintegration test to lock this in, but it hit a pre-existing, unrelated environmental gap in this crate (the sameuser_sid_hash()/machine-id issue already documented as a tolerated skip incurrent_user_hash_resolves) on both Windows and a Linux container -- the test server thread never reaches its bind call. Deferring that test rather than shipping something that doesn't reliably pass; the soldr harness verification above is the evidence for this fix. Happy to take a pointer to the right seam for that if there's a known workaround.Downstream
Once merged, soldr's
_vender/running-processsubmodule pin needs bumping in a lockstep PR (established pattern: forge-ci/soldr#2377, #2378, #2379).