@team-agent/installer 0.5.126 → 0.5.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/README.md +11 -0
- package/crates/team-agent/src/cli/adapters.rs +3 -13
- package/crates/team-agent/src/cli/arguments.rs +4 -0
- package/crates/team-agent/src/cli/diagnose.rs +68 -91
- package/crates/team-agent/src/cli/emit.rs +61 -28
- package/crates/team-agent/src/cli/grok_slot.rs +88 -3
- package/crates/team-agent/src/cli/intent/runtime.rs +38 -9
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +147 -11
- package/crates/team-agent/src/cli/intent/tests.rs +10 -12
- package/crates/team-agent/src/cli/intent.rs +1 -1
- package/crates/team-agent/src/cli/mod.rs +38 -9
- package/crates/team-agent/src/cli/models.rs +789 -186
- package/crates/team-agent/src/cli/schedule.rs +175 -0
- package/crates/team-agent/src/cli/send/persist.rs +0 -36
- package/crates/team-agent/src/cli/send/presentation.rs +1 -1
- package/crates/team-agent/src/cli/send.rs +108 -110
- package/crates/team-agent/src/cli/spec.rs +6 -0
- package/crates/team-agent/src/cli/status_port/brief.rs +5 -67
- package/crates/team-agent/src/cli/tests/leader_watch.rs +12 -62
- package/crates/team-agent/src/cli/tests/mod.rs +3 -3
- package/crates/team-agent/src/cli/tests/named_address.rs +11 -10
- package/crates/team-agent/src/cli/tests/run_delegation.rs +12 -9
- package/crates/team-agent/src/cli/tests/status_send.rs +70 -273
- package/crates/team-agent/src/compiler/tests.rs +39 -27
- package/crates/team-agent/src/compiler.rs +206 -6
- package/crates/team-agent/src/contract_runtime/backend.rs +181 -11
- package/crates/team-agent/src/contract_runtime/commands.rs +338 -7
- package/crates/team-agent/src/contract_runtime/config.rs +30 -19
- package/crates/team-agent/src/contract_runtime/config_tests.rs +24 -4
- package/crates/team-agent/src/contract_runtime/discovery.rs +12 -1
- package/crates/team-agent/src/contract_runtime/fork.rs +3 -10
- package/crates/team-agent/src/contract_runtime/framework.rs +28 -14
- package/crates/team-agent/src/contract_runtime/mcp.rs +19 -24
- package/crates/team-agent/src/contract_runtime/prompt.rs +2 -2
- package/crates/team-agent/src/contract_runtime/registry.rs +93 -130
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +45 -5
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +8 -29
- package/crates/team-agent/src/coordinator/tests/energy.rs +4 -4
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +44 -2
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/coordinator/tests/spine.rs +1 -1
- package/crates/team-agent/src/coordinator/tests/takeover.rs +3 -3
- package/crates/team-agent/src/coordinator/tick.rs +1 -89
- package/crates/team-agent/src/db/message_store.rs +7 -65
- package/crates/team-agent/src/direct_delivery.rs +368 -0
- package/crates/team-agent/src/inbox_store.rs +169 -0
- package/crates/team-agent/src/leader/registry.rs +5 -0
- package/crates/team-agent/src/leader/start.rs +2 -1
- package/crates/team-agent/src/leader/tests/lease_api.rs +2 -2
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +1 -0
- package/crates/team-agent/src/lib.rs +2 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +33 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +206 -1
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +28 -2
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +36 -179
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +87 -6
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +13 -488
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +351 -81
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +3 -4
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +26 -2
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +41 -31
- package/crates/team-agent/src/lifecycle/launch.rs +27 -12
- package/crates/team-agent/src/lifecycle/profile_launch.rs +318 -64
- package/crates/team-agent/src/lifecycle/restart/agent.rs +1 -0
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +1798 -0
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +163 -0
- package/crates/team-agent/src/lifecycle/restart/common.rs +298 -133
- package/crates/team-agent/src/lifecycle/restart/remove.rs +129 -0
- package/crates/team-agent/src/lifecycle/restart/selection.rs +5 -5
- package/crates/team-agent/src/lifecycle/restart.rs +4 -0
- package/crates/team-agent/src/lifecycle/role_config.rs +79 -27
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +1 -1
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +8 -12
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +37 -240
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +325 -0
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +320 -8
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +329 -70
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +378 -4
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +25 -39
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +7 -11
- package/crates/team-agent/src/lifecycle/tests/core.rs +39 -36
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +22 -8
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +2 -1
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +15 -133
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +60 -20
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +30 -67
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +3 -31
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +194 -169
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +164 -282
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +15 -78
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +7 -7
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +6 -6
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +75 -69
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +2 -10
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +18 -6
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +70 -52
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +210 -0
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +157 -4
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +526 -10
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +1419 -0
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +68 -1
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +34 -12
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +94 -2
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +14 -15
- package/crates/team-agent/src/lifecycle/tests/restart.rs +12 -153
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +27 -5
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +59 -10
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +47 -6
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +3 -1374
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +27 -10
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +7 -7
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +67 -313
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +254 -2
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +1 -1
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +4 -4
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +74 -19
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +38 -39
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +51 -88
- package/crates/team-agent/src/lifecycle/tests.rs +3 -4
- package/crates/team-agent/src/lifecycle/types.rs +18 -5
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +43 -50
- package/crates/team-agent/src/mcp_server/readiness.rs +130 -149
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +86 -109
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +21 -31
- package/crates/team-agent/src/mcp_server/tests/send.rs +72 -107
- package/crates/team-agent/src/mcp_server/tests/tools.rs +10 -12
- package/crates/team-agent/src/mcp_server/tools.rs +70 -196
- package/crates/team-agent/src/messaging/delivery.rs +143 -253
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- package/crates/team-agent/src/messaging/helpers.rs +1 -19
- package/crates/team-agent/src/messaging/mod.rs +1 -0
- package/crates/team-agent/src/messaging/reminders.rs +316 -0
- package/crates/team-agent/src/messaging/scheduler.rs +7 -1
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +255 -150
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/messaging/tests/runtime.rs +9 -115
- package/crates/team-agent/src/messaging/tests/spine.rs +44 -24
- package/crates/team-agent/src/messaging/tests/wave2.rs +13 -20
- package/crates/team-agent/src/messaging/types.rs +1 -0
- package/crates/team-agent/src/provider/adapter.rs +208 -254
- package/crates/team-agent/src/provider/adapters/claude.rs +78 -0
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +131 -0
- package/crates/team-agent/src/provider/adapters/mod.rs +7 -7
- package/crates/team-agent/src/provider/adapters/pi.rs +106 -0
- package/crates/team-agent/src/provider/classify.rs +1 -66
- package/crates/team-agent/src/provider/model_catalog.rs +201 -13
- package/crates/team-agent/src/provider/session/capture.rs +111 -111
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +123 -0
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +10 -18
- package/crates/team-agent/src/provider/session/context_fork.rs +87 -74
- package/crates/team-agent/src/provider/session/mod.rs +2 -3
- package/crates/team-agent/src/provider/session_scan/claude.rs +523 -0
- package/crates/team-agent/src/provider/session_scan/common.rs +47 -47
- package/crates/team-agent/src/provider/session_scan/pi.rs +34 -1
- package/crates/team-agent/src/provider/session_scan.rs +13 -13
- package/crates/team-agent/src/provider/tests/adapter.rs +127 -121
- package/crates/team-agent/src/provider/tests/classify.rs +0 -53
- package/crates/team-agent/src/provider/tests/command_helpers.rs +11 -19
- package/crates/team-agent/src/provider/tests/idle.rs +13 -19
- package/crates/team-agent/src/provider/types.rs +0 -4
- package/crates/team-agent/src/provider/wire.rs +34 -20
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +1 -1
- package/crates/team-agent/src/state/persist.rs +6 -6
- package/crates/team-agent/src/state/projection.rs +1 -1
- package/crates/team-agent/src/state/repository/tests.rs +2 -2
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +144 -0
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -151
- package/crates/team-agent/src/tmux_backend.rs +9 -43
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +7 -8
- package/skills/team-agent/command-coverage.json +15 -1
- package/skills/team-agent/docs/reference/team-agent-operator.md +5 -3
- package/skills/team-agent/references/team-agent-operator.md +5 -3
- package/crates/team-agent/src/lifecycle/launch/grok_per_seat.rs +0 -260
- package/crates/team-agent/src/lifecycle/tests/codex_weak_window_attribution_red.rs +0 -683
- package/crates/team-agent/src/lifecycle/tests/grok_effort_argv_red.rs +0 -247
- package/crates/team-agent/src/lifecycle/tests/grok_mcp_overlay_red.rs +0 -507
- package/crates/team-agent/src/lifecycle/tests/grok_restart_resume_red.rs +0 -300
- package/crates/team-agent/src/provider/adapters/codex.rs +0 -101
- package/crates/team-agent/src/provider/adapters/grok.rs +0 -67
- package/crates/team-agent/src/provider/session/context_fork/codex.rs +0 -514
- package/crates/team-agent/src/provider/session_scan/codex.rs +0 -326
- package/crates/team-agent/src/provider/session_scan/grok.rs +0 -288
|
@@ -20,9 +20,7 @@
|
|
|
20
20
|
//! (The SQLite foreign-key table integrity + exact-nonce recall are the GREEN
|
|
21
21
|
//! half / subscription-E2E per §1.4 — not asserted offline here.)
|
|
22
22
|
//!
|
|
23
|
-
//! - **R7 permission-clamp GUARDRAIL (
|
|
24
|
-
//! seat fork through a backing shim; that runtime is gone, so they left with it.
|
|
25
|
-
//! Original charter: a
|
|
23
|
+
//! - **R7 permission-clamp GUARDRAIL (naturally-green, not a RED, per L1 r2)**: a
|
|
26
24
|
//! fork's effective approval policy must be derived from the LEADER
|
|
27
25
|
//! (`source=leader_process`, `worker_capability_above_leader=false`), never a
|
|
28
26
|
//! raw clone of a source-declared capability above the leader (MUST-16).
|
|
@@ -47,7 +45,7 @@
|
|
|
47
45
|
|
|
48
46
|
use std::collections::BTreeMap;
|
|
49
47
|
use std::path::{Path, PathBuf};
|
|
50
|
-
use std::process::Command;
|
|
48
|
+
use std::process::{Command, Output};
|
|
51
49
|
use std::sync::Mutex;
|
|
52
50
|
|
|
53
51
|
use serde_json::{json, Value};
|
|
@@ -69,9 +67,19 @@ use hermetic_guard::HermeticTestEnv;
|
|
|
69
67
|
const TEAM_NAME: &str = "cf-batch4";
|
|
70
68
|
const SOURCE: &str = "cp_worker";
|
|
71
69
|
const NEW: &str = "cp_fork";
|
|
70
|
+
const R7_CHILD: &str = "TEAM_AGENT_TEST_CF_R7_CHILD";
|
|
71
|
+
const R7B_CHILD: &str = "TEAM_AGENT_TEST_CF_R7B_CHILD";
|
|
72
72
|
const R8_CHILD: &str = "TEAM_AGENT_TEST_CF_R8_CHILD";
|
|
73
73
|
const ISOLATION_GUARD_CHILD: &str = "TEAM_AGENT_TEST_CF_ISOLATION_GUARD_CHILD";
|
|
74
74
|
const PARENT_PID_ENV: &str = "TEAM_AGENT_TEST_CF_PARENT_PID";
|
|
75
|
+
const R7_TEST: &str = concat!(
|
|
76
|
+
"lifecycle::tests::clone_fork_copilot_perms_red::",
|
|
77
|
+
"r7_fork_effective_permissions_are_clamped_to_leader_guardrail"
|
|
78
|
+
);
|
|
79
|
+
const R7B_TEST: &str = concat!(
|
|
80
|
+
"lifecycle::tests::clone_fork_copilot_perms_red::",
|
|
81
|
+
"r7b_fork_policy_under_restricted_leader_ancestry_is_disabled"
|
|
82
|
+
);
|
|
75
83
|
const R8_TEST: &str = concat!(
|
|
76
84
|
"lifecycle::tests::clone_fork_copilot_perms_red::",
|
|
77
85
|
"r8_copilot_fork_is_no_longer_capability_refused"
|
|
@@ -121,6 +129,247 @@ fn copilot_clone_fork_env_fixtures_run_outside_parent_process() {
|
|
|
121
129
|
});
|
|
122
130
|
}
|
|
123
131
|
|
|
132
|
+
/// Gate6 CI-hermeticity revision: the R7 fixture must pin the process-ancestry
|
|
133
|
+
/// seam explicitly (`TEAM_AGENT_TEST_PROCESS_ANCESTRY_ARGV_JSON`) instead of
|
|
134
|
+
/// depending on the REAL ancestry of the test-runner host. Unpinned, a local
|
|
135
|
+
/// runner descending from a dangerous-bypass leader yields
|
|
136
|
+
/// `source=leader_process` (historical local green) while a clean CI runner
|
|
137
|
+
/// correctly yields `source=disabled` — a non-hermetic assertion, not a product
|
|
138
|
+
/// regression. Precedent: `codex_mcp_approval_inheritance_red.rs` `MockAncestry`
|
|
139
|
+
/// (pins both bypass and restricted leader argv).
|
|
140
|
+
const ANCESTRY_ENV: &str = "TEAM_AGENT_TEST_PROCESS_ANCESTRY_ARGV_JSON";
|
|
141
|
+
const CODEX_BYPASS: &str = "--dangerously-bypass-approvals-and-sandbox";
|
|
142
|
+
const RESTRICTED_LEADER_ARGV: &[&str] = &[
|
|
143
|
+
"codex",
|
|
144
|
+
"--sandbox",
|
|
145
|
+
"read-only",
|
|
146
|
+
"--ask-for-approval",
|
|
147
|
+
"on-request",
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
struct Case {
|
|
151
|
+
env: HermeticTestEnv,
|
|
152
|
+
workspace: PathBuf,
|
|
153
|
+
shim_path: String,
|
|
154
|
+
ancestry_json: String,
|
|
155
|
+
socket: Option<PathBuf>,
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
impl Case {
|
|
159
|
+
/// R7 (permission-clamp guardrail) uses a claude source with a success-path
|
|
160
|
+
/// backing shim so the fork actually produces a NEW row whose permission clamp
|
|
161
|
+
/// can be inspected — without a real fork the guardrail would read no row and
|
|
162
|
+
/// pass vacuously. (R8 does not use Case: it exercises the library entry with
|
|
163
|
+
/// an in-process RecordingTransport — see `r8_...`.)
|
|
164
|
+
fn start(tag: &str) -> Self {
|
|
165
|
+
Self::start_with_ancestry(tag, &["codex", CODEX_BYPASS])
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/// Every CLI invocation of this Case pins `ancestry_argv` through the
|
|
169
|
+
/// product's existing test seam so the derived approval policy is a
|
|
170
|
+
/// function of the FIXTURE, never of the host process tree.
|
|
171
|
+
fn start_with_ancestry(tag: &str, ancestry_argv: &[&str]) -> Self {
|
|
172
|
+
let env = HermeticTestEnv::enter_with_leader(tag);
|
|
173
|
+
let workspace = env.workspace("ws");
|
|
174
|
+
write_team_docs(&workspace, "claude");
|
|
175
|
+
let shim_dir = write_claude_backing_shim(&workspace);
|
|
176
|
+
let shim_path = format!(
|
|
177
|
+
"{}:{}",
|
|
178
|
+
shim_dir.display(),
|
|
179
|
+
std::env::var("PATH").expect("PATH present")
|
|
180
|
+
);
|
|
181
|
+
let mut case = Self {
|
|
182
|
+
env,
|
|
183
|
+
workspace,
|
|
184
|
+
shim_path,
|
|
185
|
+
ancestry_json: serde_json::to_string(ancestry_argv).expect("ancestry argv json"),
|
|
186
|
+
socket: None,
|
|
187
|
+
};
|
|
188
|
+
case.quick_start();
|
|
189
|
+
case.seed_source_session_tuple();
|
|
190
|
+
case
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
fn ws(&self) -> &str {
|
|
194
|
+
self.workspace.to_str().expect("ws utf8")
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
fn state_path(&self) -> PathBuf {
|
|
198
|
+
self.workspace
|
|
199
|
+
.join(".team")
|
|
200
|
+
.join("runtime")
|
|
201
|
+
.join("state.json")
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
fn run(&self, args: &[&str]) -> Output {
|
|
205
|
+
self.env.run_cli_env(
|
|
206
|
+
&self.workspace,
|
|
207
|
+
args,
|
|
208
|
+
&[
|
|
209
|
+
("PATH", self.shim_path.as_str()),
|
|
210
|
+
(ANCESTRY_ENV, self.ancestry_json.as_str()),
|
|
211
|
+
],
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
fn quick_start(&mut self) {
|
|
216
|
+
let out = self.run(&[
|
|
217
|
+
"quick-start",
|
|
218
|
+
self.ws(),
|
|
219
|
+
"--workspace",
|
|
220
|
+
self.ws(),
|
|
221
|
+
"--name",
|
|
222
|
+
TEAM_NAME,
|
|
223
|
+
"--yes",
|
|
224
|
+
"--json",
|
|
225
|
+
]);
|
|
226
|
+
if let Ok(v) = serde_json::from_slice::<Value>(&out.stdout) {
|
|
227
|
+
if let Some(cmd) = v
|
|
228
|
+
.get("attach_commands")
|
|
229
|
+
.and_then(|a| a.as_array())
|
|
230
|
+
.and_then(|a| a.first())
|
|
231
|
+
.and_then(|c| c.as_str())
|
|
232
|
+
.or_else(|| v.get("leader_attach_command").and_then(|c| c.as_str()))
|
|
233
|
+
{
|
|
234
|
+
let toks: Vec<&str> = cmd.split_whitespace().collect();
|
|
235
|
+
if let Some(i) = toks.iter().position(|t| *t == "-S") {
|
|
236
|
+
if let Some(sock) = toks.get(i + 1) {
|
|
237
|
+
self.socket = Some(PathBuf::from(*sock));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/// Seed the SOURCE session tuple so the fork reaches the capability gate
|
|
245
|
+
/// (not a missing-session gate) — mirrors the old refusal contract's
|
|
246
|
+
/// `seed_session_id`, which existed precisely so "the capability gate is what
|
|
247
|
+
/// fires".
|
|
248
|
+
fn seed_source_session_tuple(&self) {
|
|
249
|
+
// A real rollout file the source tuple points at.
|
|
250
|
+
let rollout_file = self.workspace.join("fixture-source-rollout.jsonl");
|
|
251
|
+
let _ = std::fs::write(&rollout_file, "{\"type\":\"fixture-source\"}\n");
|
|
252
|
+
let Ok(raw) = std::fs::read_to_string(self.state_path()) else {
|
|
253
|
+
return;
|
|
254
|
+
};
|
|
255
|
+
let Ok(mut state) = serde_json::from_str::<Value>(&raw) else {
|
|
256
|
+
return;
|
|
257
|
+
};
|
|
258
|
+
let tuple = json!({
|
|
259
|
+
"session_id": "sess-cf-batch4-source",
|
|
260
|
+
"rollout_path": rollout_file.to_string_lossy(),
|
|
261
|
+
"captured_at": "2026-07-21T00:00:00Z",
|
|
262
|
+
"captured_via": "contract-fixture"
|
|
263
|
+
});
|
|
264
|
+
let mut patch = |row: &mut Value| {
|
|
265
|
+
if let Some(obj) = row.as_object_mut() {
|
|
266
|
+
for (k, v) in tuple.as_object().unwrap() {
|
|
267
|
+
obj.insert(k.clone(), v.clone());
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
if let Some(row) = state.get_mut("agents").and_then(|a| a.get_mut(SOURCE)) {
|
|
272
|
+
patch(row);
|
|
273
|
+
}
|
|
274
|
+
if let Some(teams) = state.get_mut("teams").and_then(Value::as_object_mut) {
|
|
275
|
+
for team in teams.values_mut() {
|
|
276
|
+
if let Some(row) = team.get_mut("agents").and_then(|a| a.get_mut(SOURCE)) {
|
|
277
|
+
patch(row);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
let _ = std::fs::write(
|
|
282
|
+
self.state_path(),
|
|
283
|
+
serde_json::to_string_pretty(&state).unwrap(),
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
fn fork(&self, as_name: &str) -> Value {
|
|
288
|
+
let out = self.run(&[
|
|
289
|
+
"fork-agent",
|
|
290
|
+
SOURCE,
|
|
291
|
+
"--as",
|
|
292
|
+
as_name,
|
|
293
|
+
"--workspace",
|
|
294
|
+
self.ws(),
|
|
295
|
+
"--team",
|
|
296
|
+
TEAM_NAME,
|
|
297
|
+
"--json",
|
|
298
|
+
]);
|
|
299
|
+
let stderr = String::from_utf8_lossy(&out.stderr).to_string();
|
|
300
|
+
serde_json::from_slice::<Value>(&out.stdout).unwrap_or_else(|_| {
|
|
301
|
+
json!({
|
|
302
|
+
"ok": out.status.success(),
|
|
303
|
+
"_exit": out.status.code(),
|
|
304
|
+
"_stderr": stderr,
|
|
305
|
+
})
|
|
306
|
+
})
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
fn team_agent_rows(&self) -> serde_json::Map<String, Value> {
|
|
310
|
+
let Ok(raw) = std::fs::read_to_string(self.state_path()) else {
|
|
311
|
+
return serde_json::Map::new();
|
|
312
|
+
};
|
|
313
|
+
let Ok(v) = serde_json::from_str::<Value>(&raw) else {
|
|
314
|
+
return serde_json::Map::new();
|
|
315
|
+
};
|
|
316
|
+
if let Some(teams) = v.get("teams").and_then(Value::as_object) {
|
|
317
|
+
for team in teams.values() {
|
|
318
|
+
if let Some(agents) = team.get("agents").and_then(Value::as_object) {
|
|
319
|
+
if agents.contains_key(SOURCE) {
|
|
320
|
+
return agents.clone();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
serde_json::Map::new()
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
impl Drop for Case {
|
|
330
|
+
fn drop(&mut self) {
|
|
331
|
+
if let Some(sock) = &self.socket {
|
|
332
|
+
let _ = std::process::Command::new("tmux")
|
|
333
|
+
.args(["-S", sock.to_str().unwrap_or(""), "kill-server"])
|
|
334
|
+
.output();
|
|
335
|
+
}
|
|
336
|
+
let ws = self.workspace.to_string_lossy().to_string();
|
|
337
|
+
if let Ok(out) = std::process::Command::new("ps")
|
|
338
|
+
.args(["-axo", "pid=,command="])
|
|
339
|
+
.output()
|
|
340
|
+
{
|
|
341
|
+
for line in String::from_utf8_lossy(&out.stdout).lines() {
|
|
342
|
+
if line.contains(&ws) {
|
|
343
|
+
if let Some(pid) = line.split_whitespace().next() {
|
|
344
|
+
let _ = std::process::Command::new("kill")
|
|
345
|
+
.args(["-TERM", pid])
|
|
346
|
+
.output();
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
let _ = &self.env;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
fn write_team_docs(workspace: &Path, provider: &str) {
|
|
356
|
+
std::fs::create_dir_all(workspace.join("agents")).expect("create agents dir");
|
|
357
|
+
std::fs::write(
|
|
358
|
+
workspace.join("TEAM.md"),
|
|
359
|
+
format!(
|
|
360
|
+
"---\nname: {TEAM_NAME}\nobjective: clone-fork batch4.\nprovider: {provider}\n---\n"
|
|
361
|
+
),
|
|
362
|
+
)
|
|
363
|
+
.expect("write TEAM.md");
|
|
364
|
+
std::fs::write(
|
|
365
|
+
workspace.join("agents").join(format!("{SOURCE}.md")),
|
|
366
|
+
format!(
|
|
367
|
+
"---\nname: {SOURCE}\nrole: {SOURCE}\nprovider: {provider}\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\n{SOURCE} body.\n"
|
|
368
|
+
),
|
|
369
|
+
)
|
|
370
|
+
.expect("write source role doc");
|
|
371
|
+
}
|
|
372
|
+
|
|
124
373
|
/// Copilot team docs for the library-entry R8 (a separate agents dir so the
|
|
125
374
|
/// OfflineTransport quick-start compiles a copilot source).
|
|
126
375
|
fn write_copilot_team_docs(workspace: &Path) -> PathBuf {
|
|
@@ -197,6 +446,43 @@ fn seed_source_tuple_in_state(workspace: &Path, agent: &str) {
|
|
|
197
446
|
save_runtime_state(workspace, &state).expect("save seeded state");
|
|
198
447
|
}
|
|
199
448
|
|
|
449
|
+
/// Claude success-path shim producing a NEW backing keyed to the predetermined
|
|
450
|
+
/// `--session-id` (same mechanism as batch3): the R7 fork must actually complete
|
|
451
|
+
/// so a NEW state row exists to inspect for the permission clamp — otherwise the
|
|
452
|
+
/// guardrail reads no row and passes vacuously (false-green-hole type 8).
|
|
453
|
+
fn write_claude_backing_shim(workspace: &Path) -> PathBuf {
|
|
454
|
+
let bin_dir = workspace.join("shim-bin");
|
|
455
|
+
std::fs::create_dir_all(&bin_dir).expect("create shim dir");
|
|
456
|
+
let shim = bin_dir.join("claude");
|
|
457
|
+
std::fs::write(
|
|
458
|
+
&shim,
|
|
459
|
+
r#"#!/bin/sh
|
|
460
|
+
sid=""
|
|
461
|
+
prev=""
|
|
462
|
+
for a in "$@"; do
|
|
463
|
+
if [ "$prev" = "--session-id" ]; then sid="$a"; fi
|
|
464
|
+
prev="$a"
|
|
465
|
+
done
|
|
466
|
+
if [ -n "$sid" ]; then
|
|
467
|
+
enc=$(printf '%s' "$PWD" | sed 's/[^a-zA-Z0-9]/-/g')
|
|
468
|
+
dir="$HOME/.claude/projects/$enc"
|
|
469
|
+
mkdir -p "$dir"
|
|
470
|
+
printf '{"sessionId":"%s","type":"fork-backing"}\n' "$sid" > "$dir/$sid.jsonl"
|
|
471
|
+
fi
|
|
472
|
+
echo 'claude shim ready'
|
|
473
|
+
exec sleep 3600
|
|
474
|
+
"#,
|
|
475
|
+
)
|
|
476
|
+
.expect("write claude shim");
|
|
477
|
+
#[cfg(unix)]
|
|
478
|
+
{
|
|
479
|
+
use std::os::unix::fs::PermissionsExt;
|
|
480
|
+
std::fs::set_permissions(&shim, std::fs::Permissions::from_mode(0o755))
|
|
481
|
+
.expect("chmod claude shim");
|
|
482
|
+
}
|
|
483
|
+
bin_dir
|
|
484
|
+
}
|
|
485
|
+
|
|
200
486
|
/// R8 Copilot fork caps RE-CHARTER — a Copilot fork must no longer be refused by a
|
|
201
487
|
/// blanket capability gate (§1.4 proves the directory-copy + SQLite-transaction
|
|
202
488
|
/// primitive is feasible under an isolated COPILOT_HOME). Baseline red: the fork
|
|
@@ -259,6 +545,94 @@ fn r8_copilot_fork_is_no_longer_capability_refused() {
|
|
|
259
545
|
});
|
|
260
546
|
}
|
|
261
547
|
|
|
548
|
+
/// R7 permission-clamp GUARDRAIL — a fork's effective approval policy is derived
|
|
549
|
+
/// from the LEADER and never escalates above it (MUST-16). 0.5.66 bypass 单源:
|
|
550
|
+
/// fork 的 approval policy 由源角色的 `dangerously_skip_permissions` 派生
|
|
551
|
+
/// (本 fixture = false → `source=disabled`),不再依赖 leader argv 继承。任何
|
|
552
|
+
/// fork 都不得出现 `source=leader_process`(旧模型已删)或 capability 高于源。
|
|
553
|
+
#[test]
|
|
554
|
+
#[serial_test::serial(env)]
|
|
555
|
+
fn r7_fork_effective_permissions_are_clamped_to_leader_guardrail() {
|
|
556
|
+
run_process_isolated(R7_CHILD, R7_TEST, || {
|
|
557
|
+
// Claude source + success-path backing shim so the fork COMPLETES and a NEW
|
|
558
|
+
// row exists to inspect — no vacuous pass on a refused fork. The source role
|
|
559
|
+
// declares `dangerously_skip_permissions: false`, so the fork's policy must
|
|
560
|
+
// resolve to `disabled` (fail-closed) — the new single-source model.
|
|
561
|
+
let case = Case::start("cf-r7");
|
|
562
|
+
let fork = case.fork(NEW);
|
|
563
|
+
assert_eq!(
|
|
564
|
+
fork.get("ok").and_then(Value::as_bool),
|
|
565
|
+
Some(true),
|
|
566
|
+
"R7 fixture precondition: the claude fork must complete so a NEW row exists to check the \
|
|
567
|
+
permission clamp (no vacuous guardrail). fork={fork}"
|
|
568
|
+
);
|
|
569
|
+
let policy = new_row_policy(&case);
|
|
570
|
+
let source = policy.get("source").and_then(Value::as_str);
|
|
571
|
+
assert_ne!(
|
|
572
|
+
source,
|
|
573
|
+
Some("leader_process"),
|
|
574
|
+
"0.5.66: fork policy must never be leader_process (old ancestry model removed); \
|
|
575
|
+
policy={policy}"
|
|
576
|
+
);
|
|
577
|
+
assert_eq!(
|
|
578
|
+
source,
|
|
579
|
+
Some("disabled"),
|
|
580
|
+
"guardrail: a fork's approval policy derives from the role's dangerously_skip_permissions \
|
|
581
|
+
(false → disabled), never raw-cloned escalation; MUST-16. policy={policy}"
|
|
582
|
+
);
|
|
583
|
+
assert_ne!(
|
|
584
|
+
policy.get("worker_capability_above_leader").and_then(Value::as_bool),
|
|
585
|
+
Some(true),
|
|
586
|
+
"guardrail: a fork must never carry a capability above the leader; MUST-16. policy={policy}"
|
|
587
|
+
);
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/// R7b reverse positive control — same source role (dangerously_skip_permissions:
|
|
592
|
+
/// false) must also resolve to `source=disabled` under any ancestry seam. 0.5.66
|
|
593
|
+
/// 起 policy 与 leader argv 无关:source 恒 `disabled`,fork 恒不升级(MUST-16)。
|
|
594
|
+
#[test]
|
|
595
|
+
#[serial_test::serial(env)]
|
|
596
|
+
fn r7b_fork_policy_under_restricted_leader_ancestry_is_disabled() {
|
|
597
|
+
run_process_isolated(R7B_CHILD, R7B_TEST, || {
|
|
598
|
+
let case = Case::start_with_ancestry("cf-r7b", RESTRICTED_LEADER_ARGV);
|
|
599
|
+
let fork = case.fork(NEW);
|
|
600
|
+
assert_eq!(
|
|
601
|
+
fork.get("ok").and_then(Value::as_bool),
|
|
602
|
+
Some(true),
|
|
603
|
+
"R7b fixture precondition: the claude fork must complete so a NEW row exists to check the \
|
|
604
|
+
policy (no vacuous control). fork={fork}"
|
|
605
|
+
);
|
|
606
|
+
let policy = new_row_policy(&case);
|
|
607
|
+
assert_eq!(
|
|
608
|
+
policy.get("source").and_then(Value::as_str),
|
|
609
|
+
Some("disabled"),
|
|
610
|
+
"fail-closed: source role declares dangerously_skip_permissions=false → fork policy must \
|
|
611
|
+
be disabled; policy={policy}"
|
|
612
|
+
);
|
|
613
|
+
assert_ne!(
|
|
614
|
+
policy
|
|
615
|
+
.get("worker_capability_above_leader")
|
|
616
|
+
.and_then(Value::as_bool),
|
|
617
|
+
Some(true),
|
|
618
|
+
"a fork must never yield a capability above the source; MUST-16. policy={policy}"
|
|
619
|
+
);
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
fn new_row_policy(case: &Case) -> Value {
|
|
624
|
+
let rows = case.team_agent_rows();
|
|
625
|
+
let new_row = rows
|
|
626
|
+
.get(NEW)
|
|
627
|
+
.unwrap_or_else(|| panic!("NEW fork row must exist to inspect the policy; rows={rows:?}"));
|
|
628
|
+
new_row
|
|
629
|
+
.get("effective_approval_policy")
|
|
630
|
+
.cloned()
|
|
631
|
+
.unwrap_or_else(|| {
|
|
632
|
+
panic!("NEW fork row must carry an effective_approval_policy; row={new_row}")
|
|
633
|
+
})
|
|
634
|
+
}
|
|
635
|
+
|
|
262
636
|
// ---------------------------------------------------------------------------
|
|
263
637
|
// Minimal in-process Transport for the R8 library-entry test (mirrors the
|
|
264
638
|
// RecordingTransport the existing copilot refusal contract uses). Kept local so
|
|
@@ -57,7 +57,7 @@ fn t06_each_official_mode_selects_one_runtime_contract_in_real_spawn_prompt() {
|
|
|
57
57
|
.iter()
|
|
58
58
|
.find(|spawn| spawn.window.as_str().contains(id))
|
|
59
59
|
.unwrap_or_else(|| panic!("T06/{id}: no spawn recorded for product-catalog mode"));
|
|
60
|
-
let prompt = spawn_prompt(
|
|
60
|
+
let prompt = spawn_prompt(spawn);
|
|
61
61
|
let own_heading = format!("{CONTRACT_HEADING_PREFIX}{id}");
|
|
62
62
|
assert!(
|
|
63
63
|
prompt.contains(&own_heading),
|
|
@@ -77,8 +77,9 @@ fn t06_each_official_mode_selects_one_runtime_contract_in_real_spawn_prompt() {
|
|
|
77
77
|
assert!(
|
|
78
78
|
prompt.contains(&format!("ROLE BODY SENTINEL {id}"))
|
|
79
79
|
&& prompt.contains("Team Agent Teammate Runtime Contract")
|
|
80
|
-
&& prompt.contains("
|
|
81
|
-
|
|
80
|
+
&& prompt.contains("send_message exclusively for findings")
|
|
81
|
+
&& !prompt.contains("report_result"),
|
|
82
|
+
"T06/{id}: mode selection must preserve persona body and the send_message-only communication contract"
|
|
82
83
|
);
|
|
83
84
|
}
|
|
84
85
|
}
|
|
@@ -106,7 +107,7 @@ fn t06_selected_templates_project_the_two_signed_communication_boundaries() {
|
|
|
106
107
|
.iter()
|
|
107
108
|
.find(|spawn| spawn.window.as_str().contains(id))
|
|
108
109
|
.unwrap_or_else(|| panic!("T06/{id}: missing recorded spawn"));
|
|
109
|
-
spawn_prompt(
|
|
110
|
+
spawn_prompt(spawn)
|
|
110
111
|
};
|
|
111
112
|
|
|
112
113
|
let leader = prompt(CommunicationMode::LeaderCentric);
|
|
@@ -161,17 +162,17 @@ fn t07_final_spawn_prompt_does_not_leak_leader_centric_obligations_into_orchestr
|
|
|
161
162
|
.as_str()
|
|
162
163
|
.contains(CommunicationMode::Orchestrated.as_str())
|
|
163
164
|
})
|
|
164
|
-
.map(
|
|
165
|
+
.map(spawn_prompt)
|
|
165
166
|
.expect("T07/orchestrated: missing recorded spawn");
|
|
166
167
|
|
|
167
168
|
for required in [
|
|
168
169
|
"All communication must go through Team Agent MCP tools.",
|
|
169
170
|
"Do not reply to pure ACKs, greetings, or unchanged status notices",
|
|
170
|
-
"
|
|
171
|
+
"send_message exclusively for findings",
|
|
171
172
|
] {
|
|
172
173
|
assert!(
|
|
173
174
|
orchestrated.contains(required),
|
|
174
|
-
"T07/orchestrated positive control: removing unconditional duties must preserve common MCP,
|
|
175
|
+
"T07/orchestrated positive control: removing unconditional duties must preserve common MCP, silence, and send_message obligations; missing {required:?}; prompt={orchestrated:?}"
|
|
175
176
|
);
|
|
176
177
|
}
|
|
177
178
|
|
|
@@ -189,7 +190,7 @@ fn t07_final_spawn_prompt_does_not_leak_leader_centric_obligations_into_orchestr
|
|
|
189
190
|
let default_spawns = default_transport.spawns.lock().unwrap();
|
|
190
191
|
let default_prompt = default_spawns
|
|
191
192
|
.first()
|
|
192
|
-
.map(
|
|
193
|
+
.map(spawn_prompt)
|
|
193
194
|
.expect("T07/leader_centric positive control: missing recorded default spawn");
|
|
194
195
|
for required in [
|
|
195
196
|
"Progress, blockers, questions:",
|
|
@@ -266,7 +267,7 @@ fn fixture(tag: &str, team_mode: Option<&str>) -> PathBuf {
|
|
|
266
267
|
std::fs::write(
|
|
267
268
|
root.join("agents").join(format!("worker_{id}.md")),
|
|
268
269
|
format!(
|
|
269
|
-
"---\nname: worker_{id}\nrole: Communication Worker\nprovider:
|
|
270
|
+
"---\nname: worker_{id}\nrole: Communication Worker\nprovider: copilot\nmodel: gpt-5.5\ndangerously_skip_permissions: false\ncommunication_mode: {id}\ntools:\n - mcp_team\n---\n\nROLE BODY SENTINEL {id}\n"
|
|
270
271
|
),
|
|
271
272
|
)
|
|
272
273
|
.unwrap();
|
|
@@ -285,42 +286,26 @@ fn default_fixture(tag: &str) -> PathBuf {
|
|
|
285
286
|
}
|
|
286
287
|
std::fs::write(
|
|
287
288
|
root.join("agents").join("worker_default.md"),
|
|
288
|
-
"---\nname: worker_default\nrole: Communication Worker\nprovider:
|
|
289
|
+
"---\nname: worker_default\nrole: Communication Worker\nprovider: copilot\nmodel: gpt-5.5\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nROLE BODY SENTINEL default\n",
|
|
289
290
|
)
|
|
290
291
|
.unwrap();
|
|
291
292
|
root
|
|
292
293
|
}
|
|
293
294
|
|
|
294
|
-
/// The
|
|
295
|
-
///
|
|
296
|
-
fn spawn_prompt(
|
|
297
|
-
|
|
298
|
-
.
|
|
299
|
-
.
|
|
300
|
-
.and_then(|
|
|
301
|
-
|
|
302
|
-
return String::new();
|
|
303
|
-
};
|
|
304
|
-
let mut prompt = String::with_capacity(escaped.len());
|
|
305
|
-
let mut chars = escaped.chars();
|
|
306
|
-
while let Some(ch) = chars.next() {
|
|
307
|
-
if ch != '\\' {
|
|
308
|
-
prompt.push(ch);
|
|
309
|
-
continue;
|
|
310
|
-
}
|
|
311
|
-
match chars.next() {
|
|
312
|
-
Some('n') => prompt.push('\n'),
|
|
313
|
-
Some(other) => prompt.push(other),
|
|
314
|
-
None => prompt.push('\\'),
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
prompt
|
|
295
|
+
/// The Copilot worker carries the assembled prompt verbatim in the per-worker
|
|
296
|
+
/// AGENTS.md that its spawn env `COPILOT_CUSTOM_INSTRUCTIONS_DIRS` points at.
|
|
297
|
+
fn spawn_prompt(spawn: &RecordedSpawn) -> String {
|
|
298
|
+
spawn
|
|
299
|
+
.instructions_dir
|
|
300
|
+
.as_ref()
|
|
301
|
+
.and_then(|dir| std::fs::read_to_string(Path::new(dir).join("AGENTS.md")).ok())
|
|
302
|
+
.unwrap_or_default()
|
|
318
303
|
}
|
|
319
304
|
|
|
320
305
|
#[derive(Debug, Clone)]
|
|
321
306
|
struct RecordedSpawn {
|
|
322
307
|
window: WindowName,
|
|
323
|
-
|
|
308
|
+
instructions_dir: Option<String>,
|
|
324
309
|
}
|
|
325
310
|
|
|
326
311
|
#[derive(Debug, Default)]
|
|
@@ -348,14 +333,14 @@ impl Transport for RecordingTransport {
|
|
|
348
333
|
&self,
|
|
349
334
|
session: &SessionName,
|
|
350
335
|
window: &WindowName,
|
|
351
|
-
|
|
336
|
+
_argv: &[String],
|
|
352
337
|
_cwd: &Path,
|
|
353
|
-
|
|
338
|
+
env: &BTreeMap<String, String>,
|
|
354
339
|
) -> Result<SpawnResult, TransportError> {
|
|
355
340
|
let mut spawns = self.spawns.lock().unwrap();
|
|
356
341
|
spawns.push(RecordedSpawn {
|
|
357
342
|
window: window.clone(),
|
|
358
|
-
|
|
343
|
+
instructions_dir: env.get("COPILOT_CUSTOM_INSTRUCTIONS_DIRS").cloned(),
|
|
359
344
|
});
|
|
360
345
|
Ok(SpawnResult {
|
|
361
346
|
pane_id: PaneId::new(format!("%{}", spawns.len())),
|
|
@@ -390,8 +375,9 @@ impl Transport for RecordingTransport {
|
|
|
390
375
|
_target: &Target,
|
|
391
376
|
range: CaptureRange,
|
|
392
377
|
) -> Result<CapturedText, TransportError> {
|
|
378
|
+
// A ready Copilot screen ends the startup-trust poll immediately.
|
|
393
379
|
Ok(CapturedText {
|
|
394
|
-
text:
|
|
380
|
+
text: team_agent::provider::COPILOT_READY_MARKER.to_string(),
|
|
395
381
|
range,
|
|
396
382
|
})
|
|
397
383
|
}
|
|
@@ -348,7 +348,7 @@ with the identity section FIRST; head={:?}",
|
|
|
348
348
|
for marker in [
|
|
349
349
|
"# Team Agent Teammate Runtime Contract",
|
|
350
350
|
"COPILOT ROLE BODY SENTINEL",
|
|
351
|
-
"
|
|
351
|
+
"exclusively for findings, progress, questions, and completion updates",
|
|
352
352
|
] {
|
|
353
353
|
if !agents_md.contains(marker) {
|
|
354
354
|
failures.push(format!(
|
|
@@ -1101,14 +1101,14 @@ fn rules_t02_inline_server_map_preserves_unknown_and_non_object_values() {
|
|
|
1101
1101
|
fn rules_t02_non_copilot_writer_keeps_canonical_schema() {
|
|
1102
1102
|
let hermetic = enter_hermetic("rules-t02-canonical");
|
|
1103
1103
|
let ws = hermetic.workspace("canonical");
|
|
1104
|
-
let config = team_agent::provider::get_adapter(Provider::
|
|
1104
|
+
let config = team_agent::provider::get_adapter(Provider::ClaudeCode)
|
|
1105
1105
|
.mcp_config(team_agent::provider::AuthMode::Subscription)
|
|
1106
1106
|
.unwrap();
|
|
1107
1107
|
let path = team_agent::lifecycle::launch::write_worker_mcp_config_for_provider(
|
|
1108
1108
|
&ws,
|
|
1109
1109
|
"synthetic",
|
|
1110
1110
|
&config,
|
|
1111
|
-
Some(Provider::
|
|
1111
|
+
Some(Provider::ClaudeCode),
|
|
1112
1112
|
)
|
|
1113
1113
|
.unwrap();
|
|
1114
1114
|
let written: serde_json::Value =
|
|
@@ -2028,12 +2028,8 @@ fn copilot_tmp_pid_from_name(name: &str) -> Option<u32> {
|
|
|
2028
2028
|
}
|
|
2029
2029
|
|
|
2030
2030
|
fn pid_is_live(pid: u32) -> bool {
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
.stderr(Stdio::null())
|
|
2036
|
-
.status()
|
|
2037
|
-
.map(|status| status.success())
|
|
2038
|
-
.unwrap_or(false)
|
|
2031
|
+
!matches!(
|
|
2032
|
+
crate::platform::process::pid_liveness(pid),
|
|
2033
|
+
Ok(crate::platform::process::ProcessLiveness::Dead)
|
|
2034
|
+
)
|
|
2039
2035
|
}
|