Skip to content

feat(broker): adopt running-process v1 broker session for the daemon wire#327

Merged
zackees merged 1 commit into
mainfrom
feat/v1-broker-adoption
Jun 13, 2026
Merged

feat(broker): adopt running-process v1 broker session for the daemon wire#327
zackees merged 1 commit into
mainfrom
feat/v1-broker-adoption

Conversation

@zackees

@zackees zackees commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

Migrates the clud daemon's broker frame lane onto the frozen v1 running-process adoption API and bumps running-process 4.2.0 → 4.3.0. Implements zackees/running-process#436.

  • WireMode { JsonLegacy, ProstV1 } selector at the daemon boundary. RUNNING_PROCESS_DISABLE=1 forces json-legacy + the direct TCP endpoint; every other launch uses prost-v1. Both arms decode into the same internal DaemonRequest/DaemonResponse model via the existing wire_prost adapters.
  • BrokerSession::adopt replaces the raw connect_to_backend/FrameClient path. Hello sends service_name="clud", protocol 1..=1, client_lib_name="running-process", and wanted_version = the clud daemon version. clud payloads still ride the 0x7C4C frame lane; on any miss the call degrades to the authoritative legacy JSON-over-TCP wire.
  • Typed RefusalKind classification (VersionUnsupported/VersionBlocked/ServiceUnknown/RateLimited/ShuttingDown/Other) logs the cause of a broker refusal before falling back, instead of silently swallowing it.
  • ServiceDefinitionBuilder builds the SHARED_BROKER definition declaring min_version 2.0.0 and a consumer=clud label; CacheManifestBuilder publishes the runtime/lock/config/log roots at daemon bringup.
  • Diagnostics: clud daemon running-process [--json] now surfaces wire_mode, min_version, and adopts_broker_session.

The RUNNING_PROCESS_FAKE_BACKEND seam moved behind running-process's off-by-default test-seams feature in 4.3.0 (upstream #433 R4). The seam test enables it via a dev-dependency only — Cargo unifies that into cargo test but not into cargo build --bin clud, so the production binary stays seam-free per the upstream rule.

Test plan

  • cargo test -p clud --lib daemon::rp_broker — 10/10 pass (against published 4.3.0), incl. new wire_mode_select_maps_the_disable_hatch, publish_cache_manifest_records_clud_roots_and_round_trips, strengthened servicedef test (min_version 2.0.0 + consumer label), and the now-fixed fake_backend_seam_overrides_cached_endpoint.
  • cargo test -p clud --lib daemon:: — 120/120 pass (incl. all wire_prost JSON/prost parity tests).
  • bash lint — clean (cargo fmt --check, clippy -D warnings, ruff).
  • Production cargo build --bin clud verified seam-free (cargo tree -e normal shows no test-seams edge).
  • Full CI matrix (Windows/Linux/macOS x86+ARM) — to be confirmed on this PR.

Note: one unrelated timing-flaky test (process_tree::kill_tree_terminates_real_descendant_on_windows) tripped its threshold under serial full-suite load on a cold cache; it passes in isolation and is unrelated to these changes.

Refs zackees/running-process#436

🤖 Generated with Claude Code

…wire

Bump running-process to 4.3.0 and migrate the clud daemon's broker frame
lane onto the frozen v1 adoption API (zackees/running-process#436).

- Add a WireMode { JsonLegacy, ProstV1 } selector at the daemon boundary.
  RUNNING_PROCESS_DISABLE=1 forces json-legacy + the direct TCP endpoint;
  every other launch uses prost-v1. Both arms decode into the same
  internal DaemonRequest/DaemonResponse model via wire_prost.
- Replace the raw connect_to_backend/FrameClient path with
  BrokerSession::adopt: Hello sends service_name="clud", protocol 1..=1,
  client_lib_name="running-process", and wanted_version = the clud daemon
  version; clud payloads still ride the 0x7C4C frame lane.
- Classify adoption failures through the typed RefusalKind enum
  (VersionUnsupported/VersionBlocked/ServiceUnknown/RateLimited/
  ShuttingDown/Other) before degrading to the authoritative TCP wire.
- Build the SHARED_BROKER ServiceDefinition through
  ServiceDefinitionBuilder, declaring min_version 2.0.0 and a consumer
  label, and publish a CacheManifest (runtime/lock/config/log roots) via
  CacheManifestBuilder at daemon bringup.
- Surface wire_mode, min_version, and adopts_broker_session in the
  `daemon running-process` diagnostics (JSON + human output).

The RUNNING_PROCESS_FAKE_BACKEND seam moved behind running-process's
off-by-default test-seams feature in 4.3.0 (upstream #433 R4), so the
seam test enables it via a dev-dependency only. Cargo unifies that into
the cargo test build but not into `cargo build --bin clud`, keeping the
production binary seam-free per the upstream rule.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@zackees zackees merged commit 7485d11 into main Jun 13, 2026
12 of 13 checks passed
@zackees zackees deleted the feat/v1-broker-adoption branch June 13, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant