@team-agent/installer 0.5.124 → 0.5.126
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 -8
- package/Cargo.toml +1 -1
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/crates/team-agent/Cargo.toml +0 -1
- package/crates/team-agent/src/cli/diagnose.rs +39 -69
- package/crates/team-agent/src/cli/emit.rs +45 -15
- package/crates/team-agent/src/cli/intent/runtime.rs +5 -53
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +10 -130
- package/crates/team-agent/src/cli/leader.rs +2 -3
- package/crates/team-agent/src/cli/leader_prompt.rs +1 -1
- package/crates/team-agent/src/cli/mod.rs +28 -33
- package/crates/team-agent/src/cli/models.rs +44 -880
- package/crates/team-agent/src/cli/route.rs +1 -1
- package/crates/team-agent/src/cli/send/persist.rs +36 -0
- package/crates/team-agent/src/cli/send/presentation.rs +7 -1
- package/crates/team-agent/src/cli/send.rs +3 -1
- package/crates/team-agent/src/cli/spec.rs +1 -2
- package/crates/team-agent/src/cli/status_port/brief.rs +66 -0
- package/crates/team-agent/src/cli/tests/base.rs +4 -11
- package/crates/team-agent/src/cli/tests/mod.rs +1 -1
- package/crates/team-agent/src/cli/tests/run_delegation.rs +5 -4
- package/crates/team-agent/src/cli/tests/status_send.rs +17 -0
- package/crates/team-agent/src/compiler/tests.rs +39 -8
- package/crates/team-agent/src/compiler.rs +28 -204
- package/crates/team-agent/src/contract_runtime/backend.rs +79 -40
- package/crates/team-agent/src/contract_runtime/config.rs +37 -24
- package/crates/team-agent/src/contract_runtime/discovery.rs +33 -0
- package/crates/team-agent/src/contract_runtime/fork.rs +368 -0
- package/crates/team-agent/src/contract_runtime/framework.rs +87 -34
- package/crates/team-agent/src/contract_runtime/mod.rs +1 -0
- package/crates/team-agent/src/contract_runtime/registry.rs +299 -21
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -1
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +29 -8
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -42
- package/crates/team-agent/src/coordinator/tick.rs +89 -1
- package/crates/team-agent/src/db/message_store.rs +78 -3
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -1
- package/crates/team-agent/src/leader/prompt.rs +1 -2
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -52
- package/crates/team-agent/src/leader/start.rs +1 -2
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +2 -3
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +91 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +15 -195
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -9
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +11 -27
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +18 -29
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +6 -87
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +3 -11
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +74 -244
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -24
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +5 -0
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +21 -61
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -108
- package/crates/team-agent/src/lifecycle/launch.rs +2 -43
- package/crates/team-agent/src/lifecycle/profile_launch.rs +21 -348
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +1 -2
- package/crates/team-agent/src/lifecycle/restart/common.rs +43 -378
- package/crates/team-agent/src/lifecycle/restart/selection.rs +5 -5
- package/crates/team-agent/src/lifecycle/restart.rs +0 -2
- package/crates/team-agent/src/lifecycle/role_config.rs +42 -3
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +11 -6
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +8 -320
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +60 -145
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +8 -334
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +30 -11
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/core.rs +17 -16
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +12 -12
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +3 -51
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +26 -28
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +6 -18
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +52 -70
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +4 -157
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +10 -302
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +1 -68
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +1 -19
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +2 -100
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +11 -10
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +2 -106
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +2 -254
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +4 -4
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +6 -5
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +7 -153
- package/crates/team-agent/src/lifecycle/tests.rs +0 -6
- package/crates/team-agent/src/lifecycle/types.rs +2 -18
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +2 -4
- package/crates/team-agent/src/mcp_server/readiness.rs +148 -97
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +115 -16
- package/crates/team-agent/src/messaging/delivery.rs +185 -168
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +1 -1
- package/crates/team-agent/src/messaging/helpers.rs +19 -0
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +67 -5
- package/crates/team-agent/src/messaging/tests/runtime.rs +110 -4
- package/crates/team-agent/src/messaging/tests/spine.rs +46 -36
- package/crates/team-agent/src/model/enums.rs +1 -8
- package/crates/team-agent/src/provider/adapter.rs +33 -302
- package/crates/team-agent/src/provider/adapters/mod.rs +4 -5
- package/crates/team-agent/src/provider/argv_route.rs +1 -5
- package/crates/team-agent/src/provider/bypass_flags.rs +3 -11
- package/crates/team-agent/src/provider/classify.rs +68 -3
- package/crates/team-agent/src/provider/faults.rs +1 -1
- package/crates/team-agent/src/provider/model_catalog.rs +14 -273
- package/crates/team-agent/src/provider/session/capture.rs +7 -107
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -4
- package/crates/team-agent/src/provider/session/context_fork.rs +17 -109
- package/crates/team-agent/src/provider/session_scan/common.rs +11 -36
- package/crates/team-agent/src/provider/session_scan/pi.rs +1 -34
- package/crates/team-agent/src/provider/session_scan.rs +4 -14
- package/crates/team-agent/src/provider/submit_now.rs +5 -28
- package/crates/team-agent/src/provider/tests/adapter.rs +39 -275
- package/crates/team-agent/src/provider/tests/classify.rs +53 -0
- package/crates/team-agent/src/provider/tests/command_helpers.rs +3 -15
- package/crates/team-agent/src/provider/tests/idle.rs +0 -25
- package/crates/team-agent/src/provider/types.rs +1 -1
- package/crates/team-agent/src/provider/wire.rs +79 -11
- 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/repository/tests.rs +2 -2
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +2 -178
- package/crates/team-agent/src/tmux_backend/tests.rs +151 -0
- package/crates/team-agent/src/tmux_backend.rs +43 -8
- package/crates/team-agent/src/transport/native_input.rs +2 -231
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +7 -5
- 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/cursor_create_chat.rs +0 -229
- package/crates/team-agent/src/lifecycle/launch/cursor_mcp.rs +0 -522
- package/crates/team-agent/src/lifecycle/launch/cursor_mcp_iso.rs +0 -282
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1805
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
- package/crates/team-agent/src/lifecycle/tests/cursor_mcp_overlay.rs +0 -576
- package/crates/team-agent/src/lifecycle/tests/cursor_require_explicit_model_red.rs +0 -222
- package/crates/team-agent/src/lifecycle/tests/cursor_restart_resume_red.rs +0 -511
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1409
- package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
- package/crates/team-agent/src/provider/adapters/cursor_agent.rs +0 -44
- package/crates/team-agent/src/provider/adapters/pi.rs +0 -100
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/cursor.rs +0 -538
- package/crates/team-agent/src/provider/testdata/cursor-list-models-native.stdout +0 -250
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//! purpose: grok 席位角色文件必须显式写 model,缺则拒绝启动
|
|
2
2
|
//! contract: 缺 model 的 grok 角色启动失败(错误含 model 与原因);写了 model
|
|
3
|
-
//! 则该值进入 worker argv 的 `--model <值>`;
|
|
3
|
+
//! 则该值进入 worker argv 的 `--model <值>`;copilot 缺 model 行为不变
|
|
4
4
|
//! boundary: 只钉 Provider::Grok 的启动契约;不改 claude/codex/copilot 路径
|
|
5
5
|
//!
|
|
6
6
|
//! 修之前判红(40e91fba):grok 角色缺 model 仍会成功启动(compiler 填
|
|
@@ -97,20 +97,20 @@ fn grok_role_explicit_model_reaches_argv() {
|
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
/// 3.
|
|
100
|
+
/// 3. copilot 角色缺 model ⇒ 行为不变(仍能启动,不被 grok 的硬性 model 要求误伤)。
|
|
101
101
|
#[test]
|
|
102
102
|
#[serial(env)]
|
|
103
|
-
fn
|
|
104
|
-
let _hermetic = enter_hermetic("grok-
|
|
105
|
-
let ws = tmp_dir("
|
|
103
|
+
fn copilot_role_missing_model_still_starts() {
|
|
104
|
+
let _hermetic = enter_hermetic("grok-copilot-missing-model");
|
|
105
|
+
let ws = tmp_dir("copilot-no-model");
|
|
106
106
|
super::launch_spawn::seed_healthy_coordinator(&ws);
|
|
107
107
|
let team = write_role_team(
|
|
108
108
|
&ws,
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
109
|
+
"copilotteam",
|
|
110
|
+
"copiloter",
|
|
111
|
+
"copilot",
|
|
112
112
|
None,
|
|
113
|
-
"
|
|
113
|
+
"Copilot Worker",
|
|
114
114
|
);
|
|
115
115
|
let transport = OfflineTransport::new();
|
|
116
116
|
|
|
@@ -119,17 +119,17 @@ fn claude_role_missing_model_still_starts() {
|
|
|
119
119
|
&team,
|
|
120
120
|
None,
|
|
121
121
|
true,
|
|
122
|
-
Some("
|
|
122
|
+
Some("copilotteam"),
|
|
123
123
|
&transport,
|
|
124
124
|
);
|
|
125
125
|
assert!(
|
|
126
126
|
result.is_ok(),
|
|
127
|
-
"
|
|
127
|
+
"copilot role without model must keep starting; grok-only requirement leaked; err={result:?}"
|
|
128
128
|
);
|
|
129
129
|
let argv = first_spawn_argv(&transport);
|
|
130
130
|
assert!(
|
|
131
131
|
!argv.is_empty(),
|
|
132
|
-
"
|
|
132
|
+
"copilot seat must still spawn; argv={argv:?}"
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
//! leave a stale .tmp on a failed replace. The contracts assert the original data
|
|
11
11
|
//! survives / no residue.
|
|
12
12
|
//! T3 (false green = unrecognized/failed input silently maps to a success value,
|
|
13
|
-
//! MUST-NOT-13): normalize_result_status unrecognized -> Success;
|
|
14
|
-
//!
|
|
13
|
+
//! MUST-NOT-13): normalize_result_status unrecognized -> Success; schema_diagnosis
|
|
14
|
+
//! missing db -> ok:true; tmux fabricated
|
|
15
15
|
//! `%0` pane id; packaging install/update constant DoctorStatus::Ok.
|
|
16
16
|
//! T5: stop_coordinator_bounded spawns a thread + recv_timeout and never joins it —
|
|
17
17
|
//! a timed-out stop leaves a detached thread. Source grep guard (the bounded-stop
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
#[allow(dead_code)]
|
|
24
24
|
mod mcp_sim_harness;
|
|
25
25
|
|
|
26
|
-
use std::path::
|
|
26
|
+
use std::path::PathBuf;
|
|
27
27
|
use std::sync::atomic::{AtomicU64, Ordering};
|
|
28
28
|
|
|
29
29
|
use mcp_sim_harness::McpSimHarness;
|
|
@@ -419,45 +419,6 @@ check behind it = false green); it must reflect an actual doctor result"
|
|
|
419
419
|
);
|
|
420
420
|
}
|
|
421
421
|
|
|
422
|
-
/// T3-2 (claude_auth_hint parse failure): when `claude auth status` output is
|
|
423
|
-
/// unparseable / unsuccessful, the hint must not default to Present (auth misreported
|
|
424
|
-
/// as available). PATH-shims a `claude` that prints garbage and exits non-zero.
|
|
425
|
-
/// Mutates the process-global PATH/HOME — must not race host_cotenant's ps/tmux
|
|
426
|
-
/// shims (P0 pid-probe isolation) or other env-mutating tests, hence
|
|
427
|
-
/// `#[serial(env, pid_probe)]`.
|
|
428
|
-
#[test]
|
|
429
|
-
#[serial(env, pid_probe)]
|
|
430
|
-
fn t3_claude_auth_hint_parse_failure_is_not_present() {
|
|
431
|
-
let home = tmp_ws("t3-auth-home");
|
|
432
|
-
let shim_dir = home.join("bin");
|
|
433
|
-
std::fs::create_dir_all(&shim_dir).unwrap();
|
|
434
|
-
// claude shim: garbage stdout + non-zero exit (auth status unparseable / failed).
|
|
435
|
-
write_shim(
|
|
436
|
-
&shim_dir.join("claude"),
|
|
437
|
-
"#!/bin/sh\nprintf 'not json at all\\n'\nexit 7\n",
|
|
438
|
-
);
|
|
439
|
-
let old_path = std::env::var("PATH").unwrap_or_default();
|
|
440
|
-
let old_home = std::env::var("HOME").ok();
|
|
441
|
-
std::env::set_var("HOME", &home);
|
|
442
|
-
std::env::set_var("PATH", format!("{}:{old_path}", shim_dir.to_string_lossy()));
|
|
443
|
-
|
|
444
|
-
let status = team_agent::provider::get_adapter(team_agent::provider::Provider::Claude)
|
|
445
|
-
.auth_hint(team_agent::provider::AuthMode::Subscription);
|
|
446
|
-
|
|
447
|
-
std::env::set_var("PATH", &old_path);
|
|
448
|
-
match old_home {
|
|
449
|
-
Some(home) => std::env::set_var("HOME", home),
|
|
450
|
-
None => std::env::remove_var("HOME"),
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
assert_ne!(
|
|
454
|
-
format!("{status:?}"),
|
|
455
|
-
"Present",
|
|
456
|
-
"T3-2: a `claude auth status` that prints unparseable output and exits non-zero \
|
|
457
|
-
must NOT report Present (auth misreported as available is a false green); got {status:?}"
|
|
458
|
-
);
|
|
459
|
-
}
|
|
460
|
-
|
|
461
422
|
// ───────────────────────────────── T5 · thread leak ─────────────────────────────────
|
|
462
423
|
|
|
463
424
|
/// T5 (A2 shutdown thread leak): stop_coordinator_bounded spawns a worker thread and
|
|
@@ -484,15 +445,6 @@ stop; body={body}"
|
|
|
484
445
|
|
|
485
446
|
// ───────────────────────────────────── helpers ─────────────────────────────────────
|
|
486
447
|
|
|
487
|
-
fn write_shim(path: &Path, body: &str) {
|
|
488
|
-
std::fs::write(path, body).unwrap();
|
|
489
|
-
#[cfg(unix)]
|
|
490
|
-
{
|
|
491
|
-
use std::os::unix::fs::PermissionsExt;
|
|
492
|
-
std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o755)).unwrap();
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
|
|
496
448
|
/// Crude single-function body extractor: from the `fn name` line to the next
|
|
497
449
|
/// same-indent ` fn ` (good enough for grep-guard scoping).
|
|
498
450
|
fn fn_body(src: &str, marker: &str) -> String {
|
|
@@ -41,7 +41,6 @@ fn launch_source() -> String {
|
|
|
41
41
|
const QS_TEAM_MD: &str =
|
|
42
42
|
"---\nname: quickteam\nobjective: Quick start.\nprovider: codex\n---\n\nQuick-start team.\n";
|
|
43
43
|
pub(super) const QS_VALID_ROLE: &str = "---\nname: implementer\nrole: Implementation Engineer\nprovider: codex\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nImplement bounded tasks.\n";
|
|
44
|
-
const QS_ROLE_NO_PROVIDER: &str = "---\nname: implementer\nrole: Implementation Engineer\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nImplement bounded tasks.\n";
|
|
45
44
|
|
|
46
45
|
/// A REAL team dir `<base>/teamdir/{TEAM.md, agents/implementer.md}` — already in team-dir
|
|
47
46
|
/// layout, so quick_start's prepare_quick_start_team returns it as-is and writes the compiled
|
|
@@ -476,25 +475,23 @@ fn quick_start_default_workspace_compiled_spec_uses_project_root() {
|
|
|
476
475
|
);
|
|
477
476
|
}
|
|
478
477
|
|
|
479
|
-
//
|
|
480
|
-
//
|
|
481
|
-
|
|
478
|
+
// An omitted role `provider` is the default `pi`, which declares the Pi contract leaf: the
|
|
479
|
+
// compiled spec carries the leaf id, so quick-start never produces a legacy `pi` worker row.
|
|
480
|
+
#[cfg(unix)]
|
|
482
481
|
#[test]
|
|
483
|
-
fn
|
|
484
|
-
let team = quick_start_team_dir(
|
|
485
|
-
|
|
486
|
-
let result = quick_start_with_transport(&team, None, true, None, &transport);
|
|
487
|
-
|
|
488
|
-
let text = format!("{result:?}");
|
|
489
|
-
assert!(
|
|
490
|
-
text.contains("provider"),
|
|
491
|
-
"an invalid role doc (missing provider) must surface the real compile error mentioning \
|
|
492
|
-
'provider'; got {text}"
|
|
493
|
-
);
|
|
494
|
-
assert!(
|
|
495
|
-
!text.contains("no role docs found"),
|
|
496
|
-
"must NOT be the hardcoded stub blocker — real preflight/compile distinguishes the cause"
|
|
482
|
+
fn quick_start_role_without_provider_compiles_to_the_pi_leaf() {
|
|
483
|
+
let team = quick_start_team_dir(
|
|
484
|
+
"---\nname: implementer\nrole: Implementation Engineer\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nImplement bounded tasks.\n",
|
|
497
485
|
);
|
|
486
|
+
let spec = crate::compiler::compile_team(&team).expect("an omitted provider is the default pi");
|
|
487
|
+
let providers = spec
|
|
488
|
+
.get("agents")
|
|
489
|
+
.and_then(crate::model::yaml::Value::as_list)
|
|
490
|
+
.expect("compiled agents")
|
|
491
|
+
.iter()
|
|
492
|
+
.map(|agent| agent.get("provider").and_then(crate::model::yaml::Value::as_str))
|
|
493
|
+
.collect::<Vec<_>>();
|
|
494
|
+
assert_eq!(providers, vec![Some("pi_tui")]);
|
|
498
495
|
}
|
|
499
496
|
|
|
500
497
|
// P0 — launch (dry_run) over a real compiled spec must resolve the REAL route/permission plan
|
|
@@ -2704,21 +2701,22 @@ fn restart_allow_fresh_copilot_keeps_session_id_null_until_capture_confirms() {
|
|
|
2704
2701
|
let _ = plan; // shape verified above; details depend on classifier internals.
|
|
2705
2702
|
}
|
|
2706
2703
|
|
|
2707
|
-
/// 0.4.6 tuple-atomic contract (audit, line 268):
|
|
2708
|
-
/// leaves session_id=null even when
|
|
2704
|
+
/// 0.4.6 tuple-atomic contract (audit, line 268): a fresh restart of a
|
|
2705
|
+
/// preassigned-session worker (Copilot) leaves session_id=null even when the
|
|
2706
|
+
/// input row had a stale session_id.
|
|
2709
2707
|
/// The poisoned-row scenario (Bug 045 release-engineer state).
|
|
2710
2708
|
#[test]
|
|
2711
|
-
fn
|
|
2712
|
-
let ws = temp_ws().join("
|
|
2709
|
+
fn restart_allow_fresh_copilot_clears_poisoned_session_id() {
|
|
2710
|
+
let ws = temp_ws().join("restartcopilot046");
|
|
2713
2711
|
std::fs::create_dir_all(ws.join("agents")).unwrap();
|
|
2714
2712
|
std::fs::write(
|
|
2715
2713
|
ws.join("TEAM.md"),
|
|
2716
|
-
"---\nname:
|
|
2714
|
+
"---\nname: restartcopilot046\nobjective: 0.4.6 contract.\nprovider: claude\n---\n\nteam.\n",
|
|
2717
2715
|
)
|
|
2718
2716
|
.unwrap();
|
|
2719
2717
|
std::fs::write(
|
|
2720
2718
|
ws.join("agents").join("alpha.md"),
|
|
2721
|
-
"---\nname: alpha\nrole: Alpha\nprovider:
|
|
2719
|
+
"---\nname: alpha\nrole: Alpha\nprovider: copilot\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nAlpha.\n",
|
|
2722
2720
|
)
|
|
2723
2721
|
.unwrap();
|
|
2724
2722
|
let spec = crate::compiler::compile_team(&ws).expect("compile");
|
|
@@ -2727,11 +2725,11 @@ fn restart_allow_fresh_claude_clears_poisoned_session_id() {
|
|
|
2727
2725
|
crate::state::persist::save_runtime_state(
|
|
2728
2726
|
&ws,
|
|
2729
2727
|
&json!({
|
|
2730
|
-
"session_name": "team-
|
|
2728
|
+
"session_name": "team-restartcopilot046",
|
|
2731
2729
|
"agents": {
|
|
2732
2730
|
"alpha": {
|
|
2733
2731
|
"status": "running",
|
|
2734
|
-
"provider": "
|
|
2732
|
+
"provider": "copilot",
|
|
2735
2733
|
"window": "alpha",
|
|
2736
2734
|
"first_send_at": "2026-06-23T10:00:00+00:00",
|
|
2737
2735
|
"session_id": stale_uuid,
|
|
@@ -2749,7 +2747,7 @@ fn restart_allow_fresh_claude_clears_poisoned_session_id() {
|
|
|
2749
2747
|
let result = restart_with_transport(&ws, true, None, &transport);
|
|
2750
2748
|
assert!(
|
|
2751
2749
|
matches!(result, Ok(RestartReport::Restarted { .. })),
|
|
2752
|
-
"allow-fresh restart should fresh-spawn the
|
|
2750
|
+
"allow-fresh restart should fresh-spawn the copilot worker; got {result:?}"
|
|
2753
2751
|
);
|
|
2754
2752
|
|
|
2755
2753
|
let state = crate::state::persist::load_runtime_state(&ws).expect("load state");
|
|
@@ -2757,7 +2755,7 @@ fn restart_allow_fresh_claude_clears_poisoned_session_id() {
|
|
|
2757
2755
|
assert_eq!(
|
|
2758
2756
|
agent.get("session_id"),
|
|
2759
2757
|
Some(&serde_json::Value::Null),
|
|
2760
|
-
"0.4.6 contract:
|
|
2758
|
+
"0.4.6 contract: fresh restart must clear stale session_id; agent={agent}"
|
|
2761
2759
|
);
|
|
2762
2760
|
// C1 dual-projection: teams.<key>.agents.alpha.session_id must also be null.
|
|
2763
2761
|
if let Some(teams) = state.get("teams").and_then(serde_json::Value::as_object) {
|
|
@@ -2,10 +2,9 @@ use std::collections::BTreeSet;
|
|
|
2
2
|
use std::path::Path;
|
|
3
3
|
|
|
4
4
|
use crate::lifecycle::launch::pi_mcp::{
|
|
5
|
-
parse_pi_list_models_table, select_exact_pi_model,
|
|
5
|
+
build_pi_command_argv, parse_pi_list_models_table, select_exact_pi_model, PiCommandRequest,
|
|
6
6
|
};
|
|
7
7
|
use crate::model::enums::ProviderEffort;
|
|
8
|
-
use crate::provider::adapters::pi::{build_pi_command_argv, PiCommandRequest, PiSessionSelector};
|
|
9
8
|
|
|
10
9
|
const CATALOG: &[u8] = include_bytes!("fixtures/pi_list_models_g0.stdout.txt");
|
|
11
10
|
// Public pi --list-models rows captured for issue #186, preserving column widths.
|
|
@@ -87,13 +86,12 @@ fn argv_has_pair(argv: &[String], flag: &str, value: &str) -> bool {
|
|
|
87
86
|
|
|
88
87
|
fn command_for_model(model: &str) -> Vec<String> {
|
|
89
88
|
build_pi_command_argv(PiCommandRequest {
|
|
90
|
-
extension: Path::new("/workspace/.team/runtime/pi/t1/
|
|
89
|
+
extension: Path::new("/workspace/.team/runtime/pi/t1/leader/team-mcp.ts"),
|
|
91
90
|
model: Some(model),
|
|
92
91
|
effort: Some(ProviderEffort::Medium),
|
|
93
|
-
system_prompt: "
|
|
94
|
-
session_dir: Some(Path::new("/workspace/.team/runtime/pi/t1/
|
|
95
|
-
|
|
96
|
-
agent_id: "w1",
|
|
92
|
+
system_prompt: "leader contract",
|
|
93
|
+
session_dir: Some(Path::new("/workspace/.team/runtime/pi/t1/leader/sessions")),
|
|
94
|
+
agent_id: "leader",
|
|
97
95
|
})
|
|
98
96
|
.expect("catalog member must build a semantic Pi argv")
|
|
99
97
|
}
|
|
@@ -134,7 +132,7 @@ fn pi_catalog_discovers_all_exact_ids_and_rejects_invalid_or_ambiguous_selection
|
|
|
134
132
|
}
|
|
135
133
|
|
|
136
134
|
#[test]
|
|
137
|
-
fn
|
|
135
|
+
fn pi_exact_catalog_id_is_forwarded_byte_for_byte() {
|
|
138
136
|
let models = parse_pi_list_models_table(CATALOG).expect("frozen unfiltered table must parse");
|
|
139
137
|
assert_eq!(models.len(), 221);
|
|
140
138
|
|
|
@@ -151,14 +149,4 @@ fn pi_exact_catalog_id_is_forwarded_and_started_identity_must_match() {
|
|
|
151
149
|
"model selector must occur exactly once: {argv:?}"
|
|
152
150
|
);
|
|
153
151
|
}
|
|
154
|
-
|
|
155
|
-
assert!(verify_started_pi_model("team-agent/qwen3.8-27b", "team-agent/qwen3.8-27b").is_ok());
|
|
156
|
-
assert!(
|
|
157
|
-
verify_started_pi_model("team-agent/qwen3.8-27b", "xai/grok-4.6").is_err(),
|
|
158
|
-
"started identity mismatch must refuse rather than trust pane chrome"
|
|
159
|
-
);
|
|
160
|
-
assert!(
|
|
161
|
-
verify_started_pi_model("team-agent/qwen3.8-27b", "").is_err(),
|
|
162
|
-
"missing objective started-model evidence must not pass"
|
|
163
|
-
);
|
|
164
152
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
use std::path::Path;
|
|
2
2
|
|
|
3
|
-
use crate::lifecycle::launch::pi_mcp::{
|
|
3
|
+
use crate::lifecycle::launch::pi_mcp::{
|
|
4
|
+
build_pi_command_argv, pi_leader_session_scope, PiCommandRequest, PiSessionScope,
|
|
5
|
+
};
|
|
4
6
|
use crate::model::enums::ProviderEffort;
|
|
5
|
-
use crate::provider::adapters::pi::{build_pi_command_argv, PiCommandRequest, PiSessionSelector};
|
|
6
7
|
|
|
7
|
-
fn
|
|
8
|
+
fn isolated_leader_request() -> PiCommandRequest<'static> {
|
|
8
9
|
PiCommandRequest {
|
|
9
|
-
extension: Path::new("/workspace/.team/runtime/pi/team-a/
|
|
10
|
+
extension: Path::new("/workspace/.team/runtime/pi/team-a/leader/team-mcp.ts"),
|
|
10
11
|
model: Some("team-agent/qwen3.8-27b"),
|
|
11
12
|
effort: Some(ProviderEffort::High),
|
|
12
|
-
system_prompt: "frozen
|
|
13
|
+
system_prompt: "frozen leader prompt",
|
|
13
14
|
session_dir: Some(Path::new(
|
|
14
|
-
"/workspace/.team/runtime/pi/team-a/
|
|
15
|
+
"/workspace/.team/runtime/pi/team-a/leader/sessions",
|
|
15
16
|
)),
|
|
16
|
-
|
|
17
|
-
agent_id: "worker-a",
|
|
17
|
+
agent_id: "leader",
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
#[test]
|
|
22
22
|
fn pi_command_omits_unset_model_and_thinking_flags() {
|
|
23
|
-
let mut request =
|
|
23
|
+
let mut request = isolated_leader_request();
|
|
24
24
|
request.model = None;
|
|
25
25
|
request.effort = None;
|
|
26
26
|
let argv = build_pi_command_argv(request).expect("Pi provider defaults");
|
|
@@ -36,7 +36,6 @@ fn leader_request() -> PiCommandRequest<'static> {
|
|
|
36
36
|
effort: None,
|
|
37
37
|
system_prompt: "frozen leader prompt",
|
|
38
38
|
session_dir: None,
|
|
39
|
-
session: PiSessionSelector::Fresh,
|
|
40
39
|
agent_id: "leader",
|
|
41
40
|
}
|
|
42
41
|
}
|
|
@@ -92,84 +91,67 @@ fn pi_leader_session_scope_keeps_explicit_and_external_routes_isolated() {
|
|
|
92
91
|
|
|
93
92
|
#[test]
|
|
94
93
|
fn pi_command_preserves_direct_pi_defaults_with_only_team_runtime_additions() {
|
|
95
|
-
let fresh = build_pi_command_argv(
|
|
96
|
-
.expect("fresh Pi command");
|
|
94
|
+
let fresh = build_pi_command_argv(isolated_leader_request()).expect("fresh Pi command");
|
|
97
95
|
assert_eq!(
|
|
98
96
|
fresh,
|
|
99
97
|
[
|
|
100
98
|
"pi",
|
|
101
99
|
"-e",
|
|
102
|
-
"/workspace/.team/runtime/pi/team-a/
|
|
100
|
+
"/workspace/.team/runtime/pi/team-a/leader/team-mcp.ts",
|
|
103
101
|
"--model",
|
|
104
102
|
"team-agent/qwen3.8-27b",
|
|
105
103
|
"--thinking",
|
|
106
104
|
"high",
|
|
107
105
|
"--append-system-prompt",
|
|
108
|
-
"frozen
|
|
106
|
+
"frozen leader prompt",
|
|
109
107
|
"--session-dir",
|
|
110
|
-
"/workspace/.team/runtime/pi/team-a/
|
|
108
|
+
"/workspace/.team/runtime/pi/team-a/leader/sessions",
|
|
111
109
|
"--name",
|
|
112
|
-
"
|
|
110
|
+
"leader",
|
|
113
111
|
]
|
|
114
112
|
.map(str::to_string)
|
|
115
113
|
);
|
|
116
114
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
"
|
|
150
|
-
|
|
151
|
-
"--sandbox",
|
|
152
|
-
"--no-extensions",
|
|
153
|
-
"--no-approve",
|
|
154
|
-
"--no-context-files",
|
|
155
|
-
"--no-skills",
|
|
156
|
-
"--no-prompt-templates",
|
|
157
|
-
"--tui-mode",
|
|
158
|
-
"--tools",
|
|
159
|
-
"--system-prompt",
|
|
160
|
-
] {
|
|
161
|
-
assert!(
|
|
162
|
-
!argv.iter().any(|arg| arg == forbidden),
|
|
163
|
-
"materializer-owned Pi argv must not inherit {forbidden}: {argv:?}"
|
|
164
|
-
);
|
|
165
|
-
}
|
|
115
|
+
for forbidden in [
|
|
116
|
+
"rpc",
|
|
117
|
+
"--mode",
|
|
118
|
+
"--print",
|
|
119
|
+
"-p",
|
|
120
|
+
"-r",
|
|
121
|
+
"--resume",
|
|
122
|
+
"-c",
|
|
123
|
+
"--continue",
|
|
124
|
+
"--session",
|
|
125
|
+
"--session-id",
|
|
126
|
+
"--mcp-config",
|
|
127
|
+
"--provider",
|
|
128
|
+
"--fork",
|
|
129
|
+
"--workspace",
|
|
130
|
+
"--cwd",
|
|
131
|
+
"--rules",
|
|
132
|
+
"--always-approve",
|
|
133
|
+
"--force",
|
|
134
|
+
"--trust",
|
|
135
|
+
"--sandbox",
|
|
136
|
+
"--no-extensions",
|
|
137
|
+
"--no-approve",
|
|
138
|
+
"--no-context-files",
|
|
139
|
+
"--no-skills",
|
|
140
|
+
"--no-prompt-templates",
|
|
141
|
+
"--tui-mode",
|
|
142
|
+
"--tools",
|
|
143
|
+
"--system-prompt",
|
|
144
|
+
] {
|
|
145
|
+
assert!(
|
|
146
|
+
!fresh.iter().any(|arg| arg == forbidden),
|
|
147
|
+
"materializer-owned Pi argv must not inherit {forbidden}: {fresh:?}"
|
|
148
|
+
);
|
|
166
149
|
}
|
|
167
150
|
}
|
|
168
151
|
|
|
169
152
|
#[test]
|
|
170
153
|
fn pi_command_keeps_direct_plugins_skills_context_auth_and_tools() {
|
|
171
|
-
let argv = build_pi_command_argv(
|
|
172
|
-
.expect("fresh Pi command");
|
|
154
|
+
let argv = build_pi_command_argv(isolated_leader_request()).expect("fresh Pi command");
|
|
173
155
|
|
|
174
156
|
for forbidden in [
|
|
175
157
|
"--no-context-files",
|
|
@@ -184,17 +166,17 @@ fn pi_command_keeps_direct_plugins_skills_context_auth_and_tools() {
|
|
|
184
166
|
assert_eq!(
|
|
185
167
|
argv.iter().filter(|arg| arg.as_str() == forbidden).count(),
|
|
186
168
|
0,
|
|
187
|
-
"
|
|
169
|
+
"Pi leader must preserve the direct Pi default instead of adding {forbidden}; argv={argv:?}"
|
|
188
170
|
);
|
|
189
171
|
}
|
|
190
172
|
assert!(argv.windows(2).any(|pair| {
|
|
191
173
|
pair == [
|
|
192
174
|
"-e",
|
|
193
|
-
"/workspace/.team/runtime/pi/team-a/
|
|
175
|
+
"/workspace/.team/runtime/pi/team-a/leader/team-mcp.ts",
|
|
194
176
|
]
|
|
195
177
|
}));
|
|
196
178
|
assert_eq!(argv.iter().filter(|arg| arg.as_str() == "-e").count(), 1);
|
|
197
179
|
assert!(argv
|
|
198
180
|
.windows(2)
|
|
199
|
-
.any(|pair| pair == ["--append-system-prompt", "frozen
|
|
181
|
+
.any(|pair| pair == ["--append-system-prompt", "frozen leader prompt"]));
|
|
200
182
|
}
|