fix(desktop): restore captured session policy command writer

Post-policy CI found the shared launcher calls the pure captured-policy helper removed with the obsolete live-app wrapper. Restore only the command writer; keep captured preflight authority and no live state reads. Cover both policies overriding inherited environment.

Signed-off-by: Logan Johnson <loganj@squareup.com>
This commit is contained in:
Logan Johnson
2026-09-07 15:16:49 -04:00
parent 007035a09f
commit 1c4428cb82

View File

@@ -67,6 +67,14 @@ pub(crate) fn acp_session_policy(state: &AppState) -> AcpSessionPolicy {
)
}
/// Apply the captured launch policy after inherited and user environment.
pub(crate) fn apply_acp_session_policy_env(
command: &mut std::process::Command,
policy: AcpSessionPolicy,
) {
command.env(ACP_SESSION_POLICY_ENV_VAR, policy.as_str());
}
pub(crate) fn insert_acp_session_policy_env(
policy_env: &mut BTreeMap<String, String>,
policy: AcpSessionPolicy,
@@ -118,4 +126,14 @@ mod tests {
assert_eq!(command_policy(&command), Some("thread"));
}
#[test]
fn captured_local_policy_overrides_user_env_without_reading_live_state() {
for policy in [AcpSessionPolicy::Channel, AcpSessionPolicy::Thread] {
let mut command = std::process::Command::new("true");
command.env(ACP_SESSION_POLICY_ENV_VAR, "ambient");
apply_acp_session_policy_env(&mut command, policy);
assert_eq!(command_policy(&command), Some(policy.as_str()));
}
}
}