@team-agent/installer 0.5.126 → 0.5.127
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/crates/team-agent/src/cli/diagnose.rs +0 -69
- package/crates/team-agent/src/cli/emit.rs +10 -9
- package/crates/team-agent/src/cli/grok_slot.rs +88 -3
- package/crates/team-agent/src/cli/intent/runtime.rs +6 -4
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +45 -0
- package/crates/team-agent/src/cli/mod.rs +13 -1
- package/crates/team-agent/src/cli/models.rs +27 -181
- package/crates/team-agent/src/cli/tests/leader_watch.rs +1 -1
- package/crates/team-agent/src/cli/tests/mod.rs +2 -2
- package/crates/team-agent/src/cli/tests/run_delegation.rs +3 -3
- package/crates/team-agent/src/cli/tests/status_send.rs +2 -2
- package/crates/team-agent/src/compiler/tests.rs +36 -9
- package/crates/team-agent/src/compiler.rs +3 -2
- package/crates/team-agent/src/contract_runtime/backend.rs +36 -0
- package/crates/team-agent/src/contract_runtime/commands.rs +335 -4
- package/crates/team-agent/src/contract_runtime/config.rs +6 -5
- package/crates/team-agent/src/contract_runtime/framework.rs +2 -5
- package/crates/team-agent/src/contract_runtime/registry.rs +66 -67
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +45 -5
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +27 -10
- package/crates/team-agent/src/coordinator/tests/energy.rs +4 -4
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +2 -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/lifecycle/launch/fork_agent.rs +17 -185
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +4 -487
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +2 -2
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +8 -21
- package/crates/team-agent/src/lifecycle/launch.rs +3 -11
- package/crates/team-agent/src/lifecycle/profile_launch.rs +8 -64
- package/crates/team-agent/src/lifecycle/restart/common.rs +6 -151
- package/crates/team-agent/src/lifecycle/restart/remove.rs +129 -0
- package/crates/team-agent/src/lifecycle/role_config.rs +40 -13
- 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/cli_argv_routing_red.rs +95 -59
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +20 -35
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/core.rs +22 -48
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +22 -8
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +6 -124
- 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 +136 -256
- 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/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/quick_start_worker_readiness_red.rs +7 -7
- 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 +5 -5
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +67 -313
- 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 +70 -15
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +35 -35
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +36 -82
- package/crates/team-agent/src/lifecycle/tests.rs +0 -4
- package/crates/team-agent/src/lifecycle/types.rs +2 -5
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +15 -17
- package/crates/team-agent/src/messaging/delivery.rs +9 -61
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +67 -68
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/messaging/tests/runtime.rs +5 -5
- package/crates/team-agent/src/messaging/tests/spine.rs +5 -1
- package/crates/team-agent/src/messaging/tests/wave2.rs +13 -20
- package/crates/team-agent/src/provider/adapter.rs +58 -356
- package/crates/team-agent/src/provider/adapters/mod.rs +5 -7
- package/crates/team-agent/src/provider/session/capture.rs +5 -105
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +8 -20
- package/crates/team-agent/src/provider/session/context_fork.rs +23 -142
- package/crates/team-agent/src/provider/session/mod.rs +2 -3
- package/crates/team-agent/src/provider/session_scan/common.rs +21 -57
- package/crates/team-agent/src/provider/session_scan.rs +6 -16
- package/crates/team-agent/src/provider/tests/adapter.rs +37 -118
- package/crates/team-agent/src/provider/tests/command_helpers.rs +1 -18
- package/crates/team-agent/src/provider/tests/idle.rs +0 -43
- package/crates/team-agent/src/provider/types.rs +0 -4
- package/crates/team-agent/src/provider/wire.rs +34 -8
- package/crates/team-agent/src/tmux_backend.rs +4 -3
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +3 -2
- package/skills/team-agent/command-coverage.json +14 -0
- package/skills/team-agent/docs/reference/team-agent-operator.md +3 -1
- package/skills/team-agent/references/team-agent-operator.md +3 -1
- 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
|
@@ -53,13 +53,6 @@ impl Fixture {
|
|
|
53
53
|
fs::create_dir(&bin).unwrap();
|
|
54
54
|
let probes = env.root().join("probe-argv");
|
|
55
55
|
let native = env.root().join("native-argv");
|
|
56
|
-
// Synthetic noncredential metadata; no user auth store or login is read.
|
|
57
|
-
fs::create_dir_all(env.home().join(".grok")).unwrap();
|
|
58
|
-
fs::write(
|
|
59
|
-
env.home().join(".grok/auth.json"),
|
|
60
|
-
r#"{"fixture_only":true}"#,
|
|
61
|
-
)
|
|
62
|
-
.unwrap();
|
|
63
56
|
let script = format!("#!/bin/sh\ncase \"$1\" in\n--version) printf '%s\\n' \"$*\" >> '{}'; echo 0.87.1; exit 0;;\n--list-models) printf '%s\\n' \"$*\" >> '{}'; printf 'provider model\\nteam-agent qwen3.8-27b\\n'; exit 0;;\nplugin|mcp|auth|list) printf '%s\\n' \"$*\" >> '{}'; exit 0;;\nesac\nprintf '%s\\0' \"$@\" > '{}'\n/bin/kill -TERM \"$PPID\"\n", probes.display(), probes.display(), probes.display(), native.display());
|
|
64
57
|
for name in ["claude", "codex", "copilot", "gemini", "grok", "agent"] {
|
|
65
58
|
executable(&bin.join(name), &script);
|
|
@@ -76,7 +69,6 @@ impl Fixture {
|
|
|
76
69
|
let guards = vec![
|
|
77
70
|
env.with_env("PATH", &format!("{}:/usr/bin:/bin", bin.display())),
|
|
78
71
|
env.with_env(SWITCH, "off"),
|
|
79
|
-
env.with_env("GROK_FOLDER_TRUST", "0"),
|
|
80
72
|
env.with_env(
|
|
81
73
|
"TEAM_AGENT_TEST_PROCESS_ANCESTRY_ARGV_JSON",
|
|
82
74
|
"[\"/bin/zsh\"]",
|
|
@@ -293,7 +285,7 @@ fn live_pane(ws: &Path) -> PaneInfo {
|
|
|
293
285
|
window_name: Some(WindowName::new("worker")),
|
|
294
286
|
pane_index: None,
|
|
295
287
|
tty: None,
|
|
296
|
-
current_command: Some("
|
|
288
|
+
current_command: Some("copilot".into()),
|
|
297
289
|
current_path: None,
|
|
298
290
|
active: true,
|
|
299
291
|
pane_pid: None,
|
|
@@ -306,15 +298,18 @@ fn live_pane(ws: &Path) -> PaneInfo {
|
|
|
306
298
|
fn a01_default_off_matches_explicit_off_at_cold_common_and_leader_boundaries() {
|
|
307
299
|
let f = Fixture::new("argv-a01");
|
|
308
300
|
f.switch(None);
|
|
309
|
-
let cold = f.cold("
|
|
301
|
+
let cold = f.cold("copilot");
|
|
310
302
|
assert!(!f.config().exists());
|
|
311
303
|
unsafe {
|
|
312
304
|
std::env::set_var("TMUX", "fixture,1,0");
|
|
313
305
|
}
|
|
314
306
|
let leader = f.leader(Provider::Codex, true, false).unwrap();
|
|
315
|
-
f.seed(
|
|
307
|
+
f.seed(
|
|
308
|
+
true,
|
|
309
|
+
json!({"codex":["must-not-appear"],"copilot":["must-not-appear"]}),
|
|
310
|
+
);
|
|
316
311
|
f.switch(Some("off"));
|
|
317
|
-
assert_eq!(normalized(&f.cold("
|
|
312
|
+
assert_eq!(normalized(&f.cold("copilot")), normalized(&cold));
|
|
318
313
|
let off_leader = f.leader(Provider::Codex, true, false).unwrap();
|
|
319
314
|
assert_eq!(off_leader.argv, leader.argv);
|
|
320
315
|
same_leader_env(&off_leader.leader_env, &leader.leader_env);
|
|
@@ -326,7 +321,7 @@ fn a01_default_off_matches_explicit_off_at_cold_common_and_leader_boundaries() {
|
|
|
326
321
|
drop(f);
|
|
327
322
|
let f = Fixture::new("argv-a01-common");
|
|
328
323
|
f.switch(None);
|
|
329
|
-
f.start_team("
|
|
324
|
+
f.start_team("copilot", &["worker"]);
|
|
330
325
|
let baseline = offline();
|
|
331
326
|
start_agent_with_transport(
|
|
332
327
|
&f.ws,
|
|
@@ -338,7 +333,7 @@ fn a01_default_off_matches_explicit_off_at_cold_common_and_leader_boundaries() {
|
|
|
338
333
|
&baseline,
|
|
339
334
|
)
|
|
340
335
|
.unwrap();
|
|
341
|
-
f.seed(true, json!({"
|
|
336
|
+
f.seed(true, json!({"copilot":["must-not-appear"]}));
|
|
342
337
|
f.switch(Some("off"));
|
|
343
338
|
let t = offline();
|
|
344
339
|
start_agent_with_transport(
|
|
@@ -367,16 +362,16 @@ fn a01_default_off_matches_explicit_off_at_cold_common_and_leader_boundaries() {
|
|
|
367
362
|
#[serial(env)]
|
|
368
363
|
fn a02_off_invalid_and_unopted_bad_json_preserve_native_startup() {
|
|
369
364
|
let f = Fixture::new("argv-a02");
|
|
370
|
-
let base = f.cold("
|
|
365
|
+
let base = f.cold("copilot");
|
|
371
366
|
for raw in [
|
|
372
367
|
"bad JSON",
|
|
373
368
|
r#"{"enabled":false,"providers":"bad"}"#,
|
|
374
|
-
r#"{"enabled":true,"providers":{"
|
|
369
|
+
r#"{"enabled":true,"providers":{"copilot":[0]}}"#,
|
|
375
370
|
] {
|
|
376
371
|
f.raw(raw);
|
|
377
372
|
for value in [Some("off"), Some(" 0 "), Some(""), Some("bogus")] {
|
|
378
373
|
f.switch(value);
|
|
379
|
-
assert_eq!(normalized(&f.cold("
|
|
374
|
+
assert_eq!(normalized(&f.cold("copilot")), normalized(&base));
|
|
380
375
|
}
|
|
381
376
|
}
|
|
382
377
|
for raw in [
|
|
@@ -386,7 +381,7 @@ fn a02_off_invalid_and_unopted_bad_json_preserve_native_startup() {
|
|
|
386
381
|
] {
|
|
387
382
|
f.raw(raw);
|
|
388
383
|
f.switch(None);
|
|
389
|
-
assert_eq!(normalized(&f.cold("
|
|
384
|
+
assert_eq!(normalized(&f.cold("copilot")), normalized(&base));
|
|
390
385
|
}
|
|
391
386
|
}
|
|
392
387
|
|
|
@@ -445,16 +440,16 @@ fn off_fifo_child() {
|
|
|
445
440
|
#[serial(env)]
|
|
446
441
|
fn a03_persisted_enabled_and_env_override_apply_at_native_cold_boundary() {
|
|
447
442
|
let f = Fixture::new("argv-a03");
|
|
448
|
-
let base = f.cold("
|
|
443
|
+
let base = f.cold("copilot");
|
|
449
444
|
for (persisted, env, should_route) in [
|
|
450
445
|
(true, None, true),
|
|
451
446
|
(false, None, false),
|
|
452
447
|
(false, Some("on"), true),
|
|
453
448
|
(true, Some("false"), false),
|
|
454
449
|
] {
|
|
455
|
-
f.seed(persisted, json!({"
|
|
450
|
+
f.seed(persisted, json!({"copilot":["route-priority"]}));
|
|
456
451
|
f.switch(env);
|
|
457
|
-
let argv = f.cold("
|
|
452
|
+
let argv = f.cold("copilot");
|
|
458
453
|
injected(
|
|
459
454
|
&base,
|
|
460
455
|
&if should_route {
|
|
@@ -471,7 +466,7 @@ fn a03_persisted_enabled_and_env_override_apply_at_native_cold_boundary() {
|
|
|
471
466
|
#[serial(env)]
|
|
472
467
|
fn a05_generated_literal_tokens_roundtrip_cli_json_native_and_posix_wrappers() {
|
|
473
468
|
let f = Fixture::new("argv-literal");
|
|
474
|
-
let base = f.cold("
|
|
469
|
+
let base = f.cold("copilot");
|
|
475
470
|
let sentinel = f.env.root().join("INJECTION-MUST-NOT-RUN");
|
|
476
471
|
for seed in 0..16 {
|
|
477
472
|
let route = vec![
|
|
@@ -492,7 +487,7 @@ fn a05_generated_literal_tokens_roundtrip_cli_json_native_and_posix_wrappers() {
|
|
|
492
487
|
];
|
|
493
488
|
let mut cmd = Command::new(super::test_binary_path());
|
|
494
489
|
cmd.current_dir(&f.ws)
|
|
495
|
-
.args(["route", "set", "
|
|
490
|
+
.args(["route", "set", "copilot", "--json", "--"])
|
|
496
491
|
.args(&route)
|
|
497
492
|
.env(SWITCH, "off");
|
|
498
493
|
let out = cmd.output().unwrap();
|
|
@@ -502,12 +497,12 @@ fn a05_generated_literal_tokens_roundtrip_cli_json_native_and_posix_wrappers() {
|
|
|
502
497
|
String::from_utf8_lossy(&out.stderr)
|
|
503
498
|
);
|
|
504
499
|
let persisted: Value = serde_json::from_slice(&fs::read(f.config()).unwrap()).unwrap();
|
|
505
|
-
assert_eq!(persisted["providers"]["
|
|
500
|
+
assert_eq!(persisted["providers"]["copilot"], json!(route));
|
|
506
501
|
f.switch(Some("on"));
|
|
507
|
-
let actual = f.cold("
|
|
502
|
+
let actual = f.cold("copilot");
|
|
508
503
|
injected(&base, &route, &actual);
|
|
509
504
|
let mut recorded = actual.clone();
|
|
510
|
-
recorded[0] = f.bin.join("
|
|
505
|
+
recorded[0] = f.bin.join("copilot").to_string_lossy().into_owned();
|
|
511
506
|
for leader in [false, true] {
|
|
512
507
|
let line = if leader {
|
|
513
508
|
crate::tmux_backend::leader_shell_wrapper_command(
|
|
@@ -515,7 +510,7 @@ fn a05_generated_literal_tokens_roundtrip_cli_json_native_and_posix_wrappers() {
|
|
|
515
510
|
&f.ws,
|
|
516
511
|
&BTreeMap::new(),
|
|
517
512
|
&[],
|
|
518
|
-
"
|
|
513
|
+
"copilot",
|
|
519
514
|
)
|
|
520
515
|
} else {
|
|
521
516
|
crate::tmux_backend::worker_shell_wrapper_command(
|
|
@@ -523,7 +518,7 @@ fn a05_generated_literal_tokens_roundtrip_cli_json_native_and_posix_wrappers() {
|
|
|
523
518
|
&f.ws,
|
|
524
519
|
&BTreeMap::new(),
|
|
525
520
|
&[],
|
|
526
|
-
"
|
|
521
|
+
"copilot",
|
|
527
522
|
)
|
|
528
523
|
};
|
|
529
524
|
// Recorder terminates its exact parent shell after capturing argv; no inert-tail orphan.
|
|
@@ -573,10 +568,8 @@ fn provider_property(key: &str, provider: Provider) {
|
|
|
573
568
|
}
|
|
574
569
|
macro_rules! provider_tests { ($($name:ident => $key:literal, $provider:ident;)*) => { $(#[test] #[serial(env)] fn $name() { provider_property($key, Provider::$provider); })* }; }
|
|
575
570
|
provider_tests! {
|
|
576
|
-
a06_codex => "codex", Codex;
|
|
577
571
|
a06_copilot => "copilot", Copilot;
|
|
578
572
|
a06_gemini_cli => "gemini_cli", GeminiCli;
|
|
579
|
-
a06_grok => "grok", Grok;
|
|
580
573
|
}
|
|
581
574
|
|
|
582
575
|
#[test]
|
|
@@ -704,15 +697,15 @@ fn a07_pi_explicit_invalid_arguments_remain_rejected_under_routing() {
|
|
|
704
697
|
#[serial(env)]
|
|
705
698
|
fn a08_quick_start_first_later_paused_dry_run_and_live_noop() {
|
|
706
699
|
let f = Fixture::new("argv-quick");
|
|
707
|
-
f.seed(true, json!({"
|
|
700
|
+
f.seed(true, json!({"copilot":["cold-route"]}));
|
|
708
701
|
f.switch(None);
|
|
709
|
-
let t = f.start_team("
|
|
702
|
+
let t = f.start_team("copilot", &["worker", "mate"]);
|
|
710
703
|
let observed_spawns = t.spawn_records();
|
|
711
704
|
let noop =
|
|
712
705
|
quick_start_with_transport_in_workspace(&f.ws, &f.team, None, true, Some("argvteam"), &t);
|
|
713
706
|
assert!(noop.is_ok());
|
|
714
707
|
assert_eq!(t.spawn_records().len(), 2, "live-noop must not spawn again");
|
|
715
|
-
let spec = f.spec("
|
|
708
|
+
let spec = f.spec("copilot", &["worker", "mate"]);
|
|
716
709
|
f.raw("invalid schema");
|
|
717
710
|
f.switch(Some("on"));
|
|
718
711
|
let dry = offline();
|
|
@@ -720,7 +713,7 @@ fn a08_quick_start_first_later_paused_dry_run_and_live_noop() {
|
|
|
720
713
|
assert!(dry.spawn_records().is_empty());
|
|
721
714
|
drop(f);
|
|
722
715
|
let f = Fixture::new("argv-paused");
|
|
723
|
-
let spec = f.spec("
|
|
716
|
+
let spec = f.spec("copilot", &["worker", "mate"]);
|
|
724
717
|
f.raw("invalid schema");
|
|
725
718
|
f.switch(Some("on"));
|
|
726
719
|
// Typed paused flags, not assumptions about YAML renderer indentation.
|
|
@@ -759,8 +752,8 @@ fn a08_quick_start_first_later_paused_dry_run_and_live_noop() {
|
|
|
759
752
|
#[serial(env)]
|
|
760
753
|
fn a09_start_fresh_missing_backing_reset_and_add_use_new_route_once() {
|
|
761
754
|
let f = Fixture::new("argv-single");
|
|
762
|
-
f.start_team("
|
|
763
|
-
f.seed(true, json!({"
|
|
755
|
+
f.start_team("copilot", &["worker"]);
|
|
756
|
+
f.seed(true, json!({"copilot":["single-route"]}));
|
|
764
757
|
f.switch(None);
|
|
765
758
|
let mut samples = Vec::new();
|
|
766
759
|
for backing in [false, true] {
|
|
@@ -803,7 +796,7 @@ fn a09_start_fresh_missing_backing_reset_and_add_use_new_route_once() {
|
|
|
803
796
|
assert_eq!(reset.spawn_records().len(), 1);
|
|
804
797
|
samples.push(reset.spawn_records()[0].1.clone());
|
|
805
798
|
let role_file = f.ws.join("mate-role.md");
|
|
806
|
-
fs::write(&role_file, role("
|
|
799
|
+
fs::write(&role_file, role("copilot", "mate")).unwrap();
|
|
807
800
|
let added = offline().with_session_present(true);
|
|
808
801
|
add_agent_with_transport(
|
|
809
802
|
&f.team,
|
|
@@ -826,7 +819,7 @@ fn a09_start_fresh_missing_backing_reset_and_add_use_new_route_once() {
|
|
|
826
819
|
#[serial(env)]
|
|
827
820
|
fn a09_remove_rollback_respawns_original_seat_with_route_once() {
|
|
828
821
|
let f = Fixture::new("argv-rollback");
|
|
829
|
-
f.start_team("
|
|
822
|
+
f.start_team("copilot", &["worker", "mate"]);
|
|
830
823
|
f.mutate_agent("worker", |a| {
|
|
831
824
|
a["pane_id"] = json!("%old");
|
|
832
825
|
a["window"] = json!("worker");
|
|
@@ -835,7 +828,7 @@ fn a09_remove_rollback_respawns_original_seat_with_route_once() {
|
|
|
835
828
|
"TEAM_AGENT_TEST_FAIL_REMOVE_AFTER_AGENT_HEALTH_DELETE",
|
|
836
829
|
"argv-route-red",
|
|
837
830
|
);
|
|
838
|
-
f.seed(true, json!({"
|
|
831
|
+
f.seed(true, json!({"copilot":["rollback-route"]}));
|
|
839
832
|
f.switch(None);
|
|
840
833
|
let t = offline()
|
|
841
834
|
.with_session_present(true)
|
|
@@ -866,7 +859,7 @@ fn a09_remove_rollback_respawns_original_seat_with_route_once() {
|
|
|
866
859
|
#[serial(env)]
|
|
867
860
|
fn a09_public_clone_reaches_native_argv_without_inheriting_old_route() {
|
|
868
861
|
let f = Fixture::new("argv-clone");
|
|
869
|
-
f.start_team("
|
|
862
|
+
f.start_team("copilot", &["worker"]);
|
|
870
863
|
// Public clone has no Transport seam: this fixture tmux executes the actual
|
|
871
864
|
// generated provider shell line against the argv recorder, never real tmux.
|
|
872
865
|
let calls = f.env.root().join("clone-spawn-calls");
|
|
@@ -887,12 +880,12 @@ new-window|new-session|split-window)
|
|
|
887
880
|
previous=$last
|
|
888
881
|
done
|
|
889
882
|
printf '%s\n' "$op" >> '{}'
|
|
890
|
-
printf '%%99__TA_FIELD__%s__TA_FIELD__1__TA_FIELD__%s__TA_FIELD__0__TA_FIELD__/dev/pts/
|
|
883
|
+
printf '%%99__TA_FIELD__%s__TA_FIELD__1__TA_FIELD__%s__TA_FIELD__0__TA_FIELD__/dev/pts/99__TA_FIELD__copilot__TA_FIELD__1__TA_FIELD__{}__TA_FIELD__0__TA_FIELD__0__TA_FIELD__1__TA_FIELD__\n' "$session" "$window" > '{}'
|
|
891
884
|
/bin/sh -c "$last" >/dev/null 2>&1
|
|
892
885
|
echo %99; exit 0;;
|
|
893
886
|
list-panes) while IFS= read -r line; do printf '%s\n' "$line"; done < '{}';;
|
|
894
887
|
display-message) for last do :; done; case "$last" in *pane_id*) echo %99;; *pane_dead*) echo 0;; *pane_width*) echo 120;; esac;;
|
|
895
|
-
capture-pane)
|
|
888
|
+
capture-pane) printf '%s\n' '❯' ' / commands · ? help';;
|
|
896
889
|
*) exit 0;;
|
|
897
890
|
esac
|
|
898
891
|
"#,
|
|
@@ -902,7 +895,7 @@ esac
|
|
|
902
895
|
identity.display()
|
|
903
896
|
),
|
|
904
897
|
);
|
|
905
|
-
f.seed(true, json!({"
|
|
898
|
+
f.seed(true, json!({"copilot":["clone-route"]}));
|
|
906
899
|
f.switch(None);
|
|
907
900
|
let cloned = crate::lifecycle::clone_agent(
|
|
908
901
|
&f.ws,
|
|
@@ -934,10 +927,10 @@ esac
|
|
|
934
927
|
#[serial(env)]
|
|
935
928
|
fn a09_allowed_force_recreate_uses_route_once_after_old_seat_is_dead() {
|
|
936
929
|
let f = Fixture::new("argv-force");
|
|
937
|
-
f.start_team("
|
|
930
|
+
f.start_team("copilot", &["worker"]);
|
|
938
931
|
let role_file = f.ws.join("replacement.md");
|
|
939
|
-
fs::write(&role_file, role("
|
|
940
|
-
f.seed(true, json!({"
|
|
932
|
+
fs::write(&role_file, role("copilot", "worker")).unwrap();
|
|
933
|
+
f.seed(true, json!({"copilot":["force-route"]}));
|
|
941
934
|
f.switch(None);
|
|
942
935
|
let t = offline();
|
|
943
936
|
let result = crate::lifecycle::launch::add_agent_with_transport_force(
|
|
@@ -961,7 +954,7 @@ fn a09_allowed_force_recreate_uses_route_once_after_old_seat_is_dead() {
|
|
|
961
954
|
#[serial(env)]
|
|
962
955
|
fn a10_live_start_noop_is_not_validated_against_bad_route_config() {
|
|
963
956
|
let f = Fixture::new("argv-keep");
|
|
964
|
-
f.start_team("
|
|
957
|
+
f.start_team("copilot", &["worker"]);
|
|
965
958
|
f.mutate_agent("worker", |a| {
|
|
966
959
|
a["pane_id"] = json!("%old");
|
|
967
960
|
a["window"] = json!("worker");
|
|
@@ -995,10 +988,10 @@ fn a10_live_start_noop_is_not_validated_against_bad_route_config() {
|
|
|
995
988
|
#[serial(env)]
|
|
996
989
|
fn a10_restart_first_parallel_later_reloads_mapping_without_stacking() {
|
|
997
990
|
let f = Fixture::new("argv-restart");
|
|
998
|
-
f.start_team("
|
|
991
|
+
f.start_team("copilot", &["worker", "mate", "third"]);
|
|
999
992
|
let mut samples = Vec::new();
|
|
1000
993
|
for marker in ["route-generation-one", "route-generation-two"] {
|
|
1001
|
-
f.seed(true, json!({"
|
|
994
|
+
f.seed(true, json!({"copilot":[marker]}));
|
|
1002
995
|
f.switch(None);
|
|
1003
996
|
let t = offline();
|
|
1004
997
|
let result = restart_with_transport(&f.ws, true, Some("argvteam"), &t);
|
|
@@ -1024,7 +1017,7 @@ fn a10_restart_first_parallel_later_reloads_mapping_without_stacking() {
|
|
|
1024
1017
|
#[serial(env)]
|
|
1025
1018
|
fn a11_enabled_bad_schema_fails_before_native_spawn_at_all_three_boundaries() {
|
|
1026
1019
|
let f = Fixture::new("argv-errors");
|
|
1027
|
-
f.start_team("
|
|
1020
|
+
f.start_team("copilot", &["worker"]);
|
|
1028
1021
|
for raw in [
|
|
1029
1022
|
"bad JSON",
|
|
1030
1023
|
r#"{"schema_version":2,"enabled":true,"providers":{}}"#,
|
|
@@ -1035,7 +1028,7 @@ fn a11_enabled_bad_schema_fails_before_native_spawn_at_all_three_boundaries() {
|
|
|
1035
1028
|
] {
|
|
1036
1029
|
f.raw(raw);
|
|
1037
1030
|
f.switch(Some("on"));
|
|
1038
|
-
let spec = f.spec("
|
|
1031
|
+
let spec = f.spec("copilot", &["worker"]);
|
|
1039
1032
|
let cold = offline();
|
|
1040
1033
|
assert!(
|
|
1041
1034
|
launch_with_transport_in_workspace(&f.ws, &spec, false, false, true, &cold).is_err(),
|
|
@@ -1202,10 +1195,10 @@ fn a14_conpty_spawn_request_frame_preserves_routed_vector_not_windows_live_pass(
|
|
|
1202
1195
|
let f = Fixture::new("argv-conpty");
|
|
1203
1196
|
f.seed(
|
|
1204
1197
|
true,
|
|
1205
|
-
json!({"
|
|
1198
|
+
json!({"copilot":["", "a b", "路由", "\"x\"\\", "line\nbreak"]}),
|
|
1206
1199
|
);
|
|
1207
1200
|
f.switch(None);
|
|
1208
|
-
let argv = f.cold("
|
|
1201
|
+
let argv = f.cold("copilot");
|
|
1209
1202
|
assert_eq!(&argv[1..6], &["", "a b", "路由", "\"x\"\\", "line\nbreak"]);
|
|
1210
1203
|
let request = SpawnRequest {
|
|
1211
1204
|
session: "team-argvteam".into(),
|
|
@@ -1229,10 +1222,10 @@ fn a14_conpty_spawn_request_frame_preserves_routed_vector_not_windows_live_pass(
|
|
|
1229
1222
|
#[serial(env)]
|
|
1230
1223
|
fn a15_provider_drift_and_unknown_force_remain_refused() {
|
|
1231
1224
|
let f = Fixture::new("argv-drift");
|
|
1232
|
-
f.start_team("
|
|
1225
|
+
f.start_team("copilot", &["worker"]);
|
|
1233
1226
|
f.seed(
|
|
1234
1227
|
true,
|
|
1235
|
-
json!({"pi":["must-not-spawn"],"
|
|
1228
|
+
json!({"pi":["must-not-spawn"],"copilot":["must-not-spawn"]}),
|
|
1236
1229
|
);
|
|
1237
1230
|
f.switch(None);
|
|
1238
1231
|
f.mutate_agent("worker", |a| {
|
|
@@ -1255,7 +1248,7 @@ fn a15_provider_drift_and_unknown_force_remain_refused() {
|
|
|
1255
1248
|
);
|
|
1256
1249
|
assert!(!f.native_file().exists());
|
|
1257
1250
|
let role_file = f.ws.join("replacement.md");
|
|
1258
|
-
fs::write(&role_file, role("
|
|
1251
|
+
fs::write(&role_file, role("copilot", "worker")).unwrap();
|
|
1259
1252
|
// The public role-config admission guard owns unknown/live force refusal.
|
|
1260
1253
|
// Its native tmux fixture returns inconclusive identity, never proven dead.
|
|
1261
1254
|
executable(&f.bin.join("tmux"), "#!/bin/sh\ncase \"$*\" in\n*-V*) echo 'tmux 3.4';;\n*display-message*) echo 'fixture backend unavailable' >&2; exit 1;;\n*) exit 0;;\nesac\n");
|
|
@@ -1283,7 +1276,7 @@ fn a15_provider_drift_and_unknown_force_remain_refused() {
|
|
|
1283
1276
|
#[serial(env)]
|
|
1284
1277
|
fn issue381_every_cursor_name_adds_through_the_contract_leaf_never_legacy_agent() {
|
|
1285
1278
|
let f = Fixture::new("cursor-contract-add");
|
|
1286
|
-
f.start_team("
|
|
1279
|
+
f.start_team("copilot", &["worker"]);
|
|
1287
1280
|
let before = crate::state::projection::select_runtime_state(&f.ws, Some("argvteam")).unwrap();
|
|
1288
1281
|
let probes_before = fs::read_to_string(&f.probes).unwrap_or_default();
|
|
1289
1282
|
for (index, name) in ["cursor", "cursor-agent", "agent", "cursor_agent"].into_iter().enumerate() {
|
|
@@ -1320,12 +1313,12 @@ fn issue381_every_cursor_name_adds_through_the_contract_leaf_never_legacy_agent(
|
|
|
1320
1313
|
#[serial(env)]
|
|
1321
1314
|
fn a15_route_does_not_relax_running_start_reset_discard_or_unsupported_fork() {
|
|
1322
1315
|
let f = Fixture::new("argv-old-refusals");
|
|
1323
|
-
f.start_team("
|
|
1316
|
+
f.start_team("copilot", &["worker"]);
|
|
1324
1317
|
f.mutate_agent("worker", |a| {
|
|
1325
1318
|
a["pane_id"] = json!("%old");
|
|
1326
1319
|
a["window"] = json!("worker");
|
|
1327
1320
|
});
|
|
1328
|
-
f.seed(true, json!({"
|
|
1321
|
+
f.seed(true, json!({"copilot":["refusal-route"]}));
|
|
1329
1322
|
f.switch(None);
|
|
1330
1323
|
let t = offline()
|
|
1331
1324
|
.with_session_present(true)
|
|
@@ -1377,3 +1370,46 @@ fn a15_route_does_not_relax_running_start_reset_discard_or_unsupported_fork() {
|
|
|
1377
1370
|
let before = load_runtime_state(&f.ws).unwrap();
|
|
1378
1371
|
assert!(before.pointer("/agents/forked").is_none());
|
|
1379
1372
|
}
|
|
1373
|
+
|
|
1374
|
+
#[test]
|
|
1375
|
+
#[serial(env)]
|
|
1376
|
+
fn a16_cold_spawn_refuses_retired_or_missing_worker_provider_before_any_pane() {
|
|
1377
|
+
use crate::model::yaml::Value as Yaml;
|
|
1378
|
+
// A pre-upgrade spec agent naming a retired legacy key, or naming no
|
|
1379
|
+
// provider at all, never falls back to a legacy engine.
|
|
1380
|
+
for (tag, provider, expected) in [
|
|
1381
|
+
("argv-retired-codex", Some("codex"), "legacy codex seat has no runtime in this release"),
|
|
1382
|
+
("argv-retired-grok", Some("grok"), "legacy grok seat has no runtime in this release"),
|
|
1383
|
+
("argv-missing-provider", None, "unknown worker provider \"\""),
|
|
1384
|
+
] {
|
|
1385
|
+
let f = Fixture::new(tag);
|
|
1386
|
+
let spec = f.spec("copilot", &["worker"]);
|
|
1387
|
+
let mut edited = crate::model::yaml::loads(&fs::read_to_string(&spec).unwrap()).unwrap();
|
|
1388
|
+
let Yaml::Map(top) = &mut edited else {
|
|
1389
|
+
panic!("fixture spec object");
|
|
1390
|
+
};
|
|
1391
|
+
let Yaml::List(agents) = &mut top.iter_mut().find(|(key, _)| key == "agents").unwrap().1 else {
|
|
1392
|
+
panic!("fixture agents list");
|
|
1393
|
+
};
|
|
1394
|
+
for agent in agents {
|
|
1395
|
+
let Yaml::Map(fields) = agent else {
|
|
1396
|
+
panic!("fixture agent object");
|
|
1397
|
+
};
|
|
1398
|
+
fields.retain(|(key, _)| key != "provider");
|
|
1399
|
+
if let Some(provider) = provider {
|
|
1400
|
+
fields.push(("provider".into(), Yaml::Str(provider.into())));
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
fs::write(&spec, crate::model::yaml::dumps(&edited)).unwrap();
|
|
1404
|
+
let state_path = crate::state::persist::runtime_state_path(&f.ws);
|
|
1405
|
+
fs::create_dir_all(state_path.parent().unwrap()).unwrap();
|
|
1406
|
+
fs::write(state_path, "{}").unwrap();
|
|
1407
|
+
let t = offline();
|
|
1408
|
+
let error = launch_with_transport_in_workspace(&f.ws, &spec, false, false, true, &t)
|
|
1409
|
+
.unwrap_err()
|
|
1410
|
+
.to_string();
|
|
1411
|
+
assert!(error.contains(expected), "{tag}: {error}");
|
|
1412
|
+
assert!(t.spawn_records().is_empty(), "{tag}");
|
|
1413
|
+
assert!(!f.native_file().exists(), "{tag}");
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
@@ -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),
|
|
@@ -106,7 +106,7 @@ fn t06_selected_templates_project_the_two_signed_communication_boundaries() {
|
|
|
106
106
|
.iter()
|
|
107
107
|
.find(|spawn| spawn.window.as_str().contains(id))
|
|
108
108
|
.unwrap_or_else(|| panic!("T06/{id}: missing recorded spawn"));
|
|
109
|
-
spawn_prompt(
|
|
109
|
+
spawn_prompt(spawn)
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
let leader = prompt(CommunicationMode::LeaderCentric);
|
|
@@ -161,7 +161,7 @@ fn t07_final_spawn_prompt_does_not_leak_leader_centric_obligations_into_orchestr
|
|
|
161
161
|
.as_str()
|
|
162
162
|
.contains(CommunicationMode::Orchestrated.as_str())
|
|
163
163
|
})
|
|
164
|
-
.map(
|
|
164
|
+
.map(spawn_prompt)
|
|
165
165
|
.expect("T07/orchestrated: missing recorded spawn");
|
|
166
166
|
|
|
167
167
|
for required in [
|
|
@@ -189,7 +189,7 @@ fn t07_final_spawn_prompt_does_not_leak_leader_centric_obligations_into_orchestr
|
|
|
189
189
|
let default_spawns = default_transport.spawns.lock().unwrap();
|
|
190
190
|
let default_prompt = default_spawns
|
|
191
191
|
.first()
|
|
192
|
-
.map(
|
|
192
|
+
.map(spawn_prompt)
|
|
193
193
|
.expect("T07/leader_centric positive control: missing recorded default spawn");
|
|
194
194
|
for required in [
|
|
195
195
|
"Progress, blockers, questions:",
|
|
@@ -266,7 +266,7 @@ fn fixture(tag: &str, team_mode: Option<&str>) -> PathBuf {
|
|
|
266
266
|
std::fs::write(
|
|
267
267
|
root.join("agents").join(format!("worker_{id}.md")),
|
|
268
268
|
format!(
|
|
269
|
-
"---\nname: worker_{id}\nrole: Communication Worker\nprovider:
|
|
269
|
+
"---\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
270
|
),
|
|
271
271
|
)
|
|
272
272
|
.unwrap();
|
|
@@ -285,42 +285,26 @@ fn default_fixture(tag: &str) -> PathBuf {
|
|
|
285
285
|
}
|
|
286
286
|
std::fs::write(
|
|
287
287
|
root.join("agents").join("worker_default.md"),
|
|
288
|
-
"---\nname: worker_default\nrole: Communication Worker\nprovider:
|
|
288
|
+
"---\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
289
|
)
|
|
290
290
|
.unwrap();
|
|
291
291
|
root
|
|
292
292
|
}
|
|
293
293
|
|
|
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
|
|
294
|
+
/// The Copilot worker carries the assembled prompt verbatim in the per-worker
|
|
295
|
+
/// AGENTS.md that its spawn env `COPILOT_CUSTOM_INSTRUCTIONS_DIRS` points at.
|
|
296
|
+
fn spawn_prompt(spawn: &RecordedSpawn) -> String {
|
|
297
|
+
spawn
|
|
298
|
+
.instructions_dir
|
|
299
|
+
.as_ref()
|
|
300
|
+
.and_then(|dir| std::fs::read_to_string(Path::new(dir).join("AGENTS.md")).ok())
|
|
301
|
+
.unwrap_or_default()
|
|
318
302
|
}
|
|
319
303
|
|
|
320
304
|
#[derive(Debug, Clone)]
|
|
321
305
|
struct RecordedSpawn {
|
|
322
306
|
window: WindowName,
|
|
323
|
-
|
|
307
|
+
instructions_dir: Option<String>,
|
|
324
308
|
}
|
|
325
309
|
|
|
326
310
|
#[derive(Debug, Default)]
|
|
@@ -348,14 +332,14 @@ impl Transport for RecordingTransport {
|
|
|
348
332
|
&self,
|
|
349
333
|
session: &SessionName,
|
|
350
334
|
window: &WindowName,
|
|
351
|
-
|
|
335
|
+
_argv: &[String],
|
|
352
336
|
_cwd: &Path,
|
|
353
|
-
|
|
337
|
+
env: &BTreeMap<String, String>,
|
|
354
338
|
) -> Result<SpawnResult, TransportError> {
|
|
355
339
|
let mut spawns = self.spawns.lock().unwrap();
|
|
356
340
|
spawns.push(RecordedSpawn {
|
|
357
341
|
window: window.clone(),
|
|
358
|
-
|
|
342
|
+
instructions_dir: env.get("COPILOT_CUSTOM_INSTRUCTIONS_DIRS").cloned(),
|
|
359
343
|
});
|
|
360
344
|
Ok(SpawnResult {
|
|
361
345
|
pane_id: PaneId::new(format!("%{}", spawns.len())),
|
|
@@ -390,8 +374,9 @@ impl Transport for RecordingTransport {
|
|
|
390
374
|
_target: &Target,
|
|
391
375
|
range: CaptureRange,
|
|
392
376
|
) -> Result<CapturedText, TransportError> {
|
|
377
|
+
// A ready Copilot screen ends the startup-trust poll immediately.
|
|
393
378
|
Ok(CapturedText {
|
|
394
|
-
text:
|
|
379
|
+
text: team_agent::provider::COPILOT_READY_MARKER.to_string(),
|
|
395
380
|
range,
|
|
396
381
|
})
|
|
397
382
|
}
|
|
@@ -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::GeminiCli)
|
|
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::GeminiCli),
|
|
1112
1112
|
)
|
|
1113
1113
|
.unwrap();
|
|
1114
1114
|
let written: serde_json::Value =
|