@@ -150,13 +150,13 @@ pub fn build_managed_agent_summary(
150150 // Two-axis status model for remote agents:
151151 //
152152 // Control-plane (this field): "deployed" = provider has been invoked and
153- // returned a backend_agent_id. "not_deployed" = no deploy call yet (or it
154- // failed). This axis tracks whether infrastructure *exists*, not whether
155- // the process is currently running.
153+ // returned a backend_agent_id. "not_deployed" = no deploy call yet (or
154+ // it failed). Tracks whether infrastructure *exists*, not whether the
155+ // process is currently running.
156156 //
157- // Live axis (relay presence, polled by frontend): online/away/offline.
158- // Shown as a PresenceDot next to the agent name. This is the real-time
159- // signal for whether the harness is connected.
157+ // Live axis (relay presence, polled by frontend): online/away/offline,
158+ // shown as a PresenceDot next to the agent name — the real-time signal
159+ // for whether the harness is connected.
160160 //
161161 // After !shutdown the agent goes offline (presence) but stays "deployed"
162162 // (infrastructure still exists). This is intentional — the provider may
@@ -243,7 +243,6 @@ pub fn build_managed_agent_summary(
243243 // Global config drives both the restart-drift hash and descriptor env
244244 // layering below — the caller loads it once and passes it in, so
245245 // list-style callers pay one disk read per call rather than one per record.
246-
247246 let needs_restart = pair_key
248247 . as_ref ( )
249248 . and_then ( |key| runtimes. get ( key) . map ( |runtime| ( key, runtime) ) )
@@ -604,12 +603,8 @@ pub fn spawn_agent_child(
604603 // readiness predicate, and if anything is missing, serialize the payload
605604 // into BUZZ_ACP_SETUP_PAYLOAD. buzz-acp detects this env var on startup
606605 // and enters the minimal setup-listener mode instead of the agent pool.
607- //
608- // SECURITY: BUZZ_ACP_SETUP_PAYLOAD is in RESERVED_ENV_KEYS so user env
609- // cannot set it, but we also explicitly remove it after writing user env
610- // to guard against the parent-process environment. We then set it only
611- // when desktop has computed NotReady — the desktop is the sole readiness
612- // source and buzz-acp only transports the payload.
606+ // SECURITY: the key is in RESERVED_ENV_KEYS, and desktop is the sole
607+ // readiness source — buzz-acp only transports the payload.
613608 //
614609 // The JSON format mirrors `setup_mode::SetupPayload` in buzz-acp:
615610 // { "agent_name": "...", "agent_pubkey": "...", "requirements": [{ "surface": "...", ... }] }
@@ -700,9 +695,8 @@ pub fn spawn_agent_child(
700695 // 2. This env_remove() clears any ambient parent-process value
701696 // inherited by std::process::Command before we conditionally
702697 // set the desktop-computed trusted value below.
703- // Note: merged_user_env() is written further below in this function;
704- // ordering relative to that call is NOT what makes this safe — the
705- // reserved-key strip (guard 1) handles user env regardless of order.
698+ // Guard 1 handles user env regardless of where merged_user_env() is
699+ // written relative to this call, so ordering is NOT what makes it safe.
706700 command. env_remove ( "BUZZ_ACP_SETUP_PAYLOAD" ) ;
707701
708702 // Set the payload only when desktop computed NotReady.
@@ -728,9 +722,8 @@ pub fn spawn_agent_child(
728722 command. env ( "BUZZ_ACP_MAX_TURN_DURATION" , max_dur. to_string ( ) ) ;
729723 }
730724 // Emitted only when the toggle is OFF, so the harness default stays the
731- // source of truth when ON — same rationale as BUZZ_ACP_IDLE_TIMEOUT above.
732- // The key is not reserved, so a user setting it in the env-vars editor wins
733- // (descriptor.env is written last; see the user-env block below).
725+ // source of truth when ON (as with BUZZ_ACP_IDLE_TIMEOUT above). The key is
726+ // not reserved, so a user setting it in the env-vars editor wins.
734727 if !record. resume_on_restart {
735728 command. env ( "BUZZ_ACP_RESUME_ON_RESTART" , "false" ) ;
736729 }
@@ -757,10 +750,10 @@ pub fn spawn_agent_child(
757750 // instances never consult the record's own model/provider/prompt bytes;
758751 // definition-less instances fall back to their own fields, then global.
759752 //
760- // Derive the mesh decision BEFORE moving fields out — `relay_mesh_model_id`
761- // is the single authoritative gate; the mesh-llm block below MUST use it
762- // rather than re-deriving from `effective_provider` to keep preflight and
763- // spawn semantics in lock-step (see `EffectiveAgentConfig::relay_mesh_model_id`).
753+ // Derive the mesh decision BEFORE moving fields out — `relay_mesh_model_id` is
754+ // the single authoritative gate; the mesh-llm block below MUST use it rather
755+ // than re-deriving from `effective_provider`, keeping preflight and spawn
756+ // semantics in lock-step (see `EffectiveAgentConfig::relay_mesh_model_id`).
764757 #[ cfg( feature = "mesh-llm" ) ]
765758 let mesh_model_id = effective_cfg. relay_mesh_model_id ( ) ;
766759 let effective_prompt = effective_cfg. system_prompt . value ;
@@ -824,13 +817,13 @@ pub fn spawn_agent_child(
824817
825818 // ── Git credential helper for Buzz relay ──────────────────────────
826819 //
827- // Agents need to clone/push repos hosted on the Buzz relay's git
828- // server, which authenticates via NIP-98. The `git-credential-nostr`
829- // binary signs auth events using the agent's nostr key.
820+ // Agents need to clone/push repos hosted on the Buzz relay's git server,
821+ // which authenticates via NIP-98. The `git-credential-nostr` binary signs
822+ // auth events using the agent's nostr key.
830823 //
831- // We configure git via GIT_CONFIG_COUNT env vars (ephemeral, no
832- // filesystem writes) scoped to the relay's git URL so we don't
833- // interfere with other remotes (e.g. GitHub).
824+ // We configure git via GIT_CONFIG_COUNT env vars (ephemeral, no filesystem
825+ // writes) scoped to the relay's git URL so we don't interfere with other
826+ // remotes (e.g. GitHub).
834827 //
835828 // NOSTR_PRIVATE_KEY mirrors BUZZ_PRIVATE_KEY — keep in sync.
836829 if let Some ( cred_helper) = resolve_command ( "git-credential-nostr" ) {
@@ -863,8 +856,8 @@ pub fn spawn_agent_child(
863856 // baked floor → runtime metadata → definition env (harness author defaults) →
864857 // global → live persona → per-agent, with reserved-key and malformed-key filtering
865858 // applied. Writing it last lets user-provided values win over every Buzz-set env
866- // written above — reserved keys were already stripped from descriptor.env so they
867- // cannot clobber BUZZ_PRIVATE_KEY, NOSTR_PRIVATE_KEY, etc.
859+ // written above — reserved keys were already stripped, so they cannot clobber
860+ // BUZZ_PRIVATE_KEY, NOSTR_PRIVATE_KEY, etc.
868861 for ( key, value) in & descriptor. env {
869862 command. env ( key, value) ;
870863 }
@@ -930,11 +923,10 @@ pub fn spawn_agent_child(
930923 // Stamp the adapter availability for runtimes with a version gate (codex
931924 // only). The summary builder compares this against the current cached value
932925 // to detect out-of-band adapter changes after spawn (Phase-2 badge fallback).
933- // Non-codex runtimes get `None` — nothing changes for them.
934- // When the cache is cold (e.g. Doctor just installed and cleared the cache),
935- // `adapter_availability_cached()` returns `None`, so the stamp is `None` and
936- // the drift check is skipped until discovery warms the cache — preventing a
937- // false restart badge immediately after auto-restart.
926+ // Non-codex runtimes get `None` — nothing changes for them. A cold cache
927+ // (e.g. Doctor just installed and cleared it) also stamps `None`, skipping
928+ // the drift check until discovery warms it — this prevents a false restart
929+ // badge immediately after auto-restart.
938930 let spawned_adapter_availability = if runtime_meta. is_some_and ( |r| r. id == "codex" ) {
939931 super :: adapter_availability_cached ( )
940932 } else {
0 commit comments