@team-agent/installer 0.5.125 → 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 -137
- package/crates/team-agent/src/cli/emit.rs +13 -8
- 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 +55 -10
- package/crates/team-agent/src/cli/mod.rs +35 -29
- package/crates/team-agent/src/cli/models.rs +33 -944
- package/crates/team-agent/src/cli/tests/leader_watch.rs +1 -1
- package/crates/team-agent/src/cli/tests/mod.rs +3 -3
- package/crates/team-agent/src/cli/tests/run_delegation.rs +8 -7
- package/crates/team-agent/src/cli/tests/status_send.rs +2 -2
- package/crates/team-agent/src/compiler/tests.rs +54 -12
- package/crates/team-agent/src/compiler.rs +7 -205
- package/crates/team-agent/src/contract_runtime/backend.rs +97 -38
- package/crates/team-agent/src/contract_runtime/commands.rs +335 -4
- package/crates/team-agent/src/contract_runtime/config.rs +12 -8
- package/crates/team-agent/src/contract_runtime/fork.rs +368 -0
- package/crates/team-agent/src/contract_runtime/framework.rs +8 -13
- package/crates/team-agent/src/contract_runtime/mod.rs +1 -0
- package/crates/team-agent/src/contract_runtime/registry.rs +100 -60
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +45 -5
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +54 -16
- package/crates/team-agent/src/coordinator/tests/energy.rs +4 -4
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +2 -44
- 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/leader/start.rs +1 -1
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +2 -195
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +11 -27
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +22 -200
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +6 -87
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +5 -496
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +74 -244
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +2 -26
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +5 -0
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +26 -51
- package/crates/team-agent/src/lifecycle/launch.rs +3 -34
- package/crates/team-agent/src/lifecycle/profile_launch.rs +18 -373
- package/crates/team-agent/src/lifecycle/restart/common.rs +45 -463
- 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 +0 -2
- 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 +38 -236
- 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 +106 -186
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +4 -334
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +19 -15
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/core.rs +33 -58
- 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 +15 -133
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +3 -51
- 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 +162 -284
- 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/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 +15 -14
- 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 -1478
- 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 +2 -254
- 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 +39 -38
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +42 -97
- package/crates/team-agent/src/lifecycle/tests.rs +0 -7
- package/crates/team-agent/src/lifecycle/types.rs +2 -21
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +15 -17
- package/crates/team-agent/src/messaging/delivery.rs +14 -195
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +68 -69
- 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 +30 -32
- package/crates/team-agent/src/messaging/tests/wave2.rs +13 -20
- package/crates/team-agent/src/provider/adapter.rs +71 -572
- package/crates/team-agent/src/provider/adapters/mod.rs +6 -8
- package/crates/team-agent/src/provider/model_catalog.rs +13 -201
- package/crates/team-agent/src/provider/session/capture.rs +11 -211
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +8 -24
- package/crates/team-agent/src/provider/session/context_fork.rs +29 -240
- package/crates/team-agent/src/provider/session/mod.rs +2 -3
- package/crates/team-agent/src/provider/session_scan/common.rs +27 -87
- package/crates/team-agent/src/provider/session_scan/pi.rs +1 -34
- package/crates/team-agent/src/provider/session_scan.rs +7 -23
- package/crates/team-agent/src/provider/tests/adapter.rs +66 -204
- package/crates/team-agent/src/provider/tests/command_helpers.rs +3 -29
- package/crates/team-agent/src/provider/tests/idle.rs +0 -68
- package/crates/team-agent/src/provider/types.rs +0 -4
- package/crates/team-agent/src/provider/wire.rs +77 -23
- 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.rs +4 -3
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +8 -5
- package/skills/team-agent/command-coverage.json +29 -1
- package/skills/team-agent/docs/reference/team-agent-operator.md +7 -3
- package/skills/team-agent/references/team-agent-operator.md +7 -3
- package/crates/team-agent/src/lifecycle/launch/grok_per_seat.rs +0 -260
- 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/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/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/codex.rs +0 -101
- package/crates/team-agent/src/provider/adapters/grok.rs +0 -67
- 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/context_fork/codex.rs +0 -514
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/codex.rs +0 -326
- package/crates/team-agent/src/provider/session_scan/grok.rs +0 -288
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
|
@@ -19,6 +19,7 @@ use team_agent::coordinator::{
|
|
|
19
19
|
use team_agent::db::schema::open_db;
|
|
20
20
|
use team_agent::lifecycle::{
|
|
21
21
|
add_agent_with_transport, fork_agent_with_transport, remove_agent_with_transport,
|
|
22
|
+
LifecycleError,
|
|
22
23
|
};
|
|
23
24
|
use team_agent::message_store::MessageStore;
|
|
24
25
|
use team_agent::model::ids::AgentId;
|
|
@@ -91,32 +92,30 @@ fn fork_agent_rollback_cleans_spawned_window_spec_state_and_mcp_after_post_spawn
|
|
|
91
92
|
let mcp_path = fixture.team.join(".team/runtime/mcp/newfork.json");
|
|
92
93
|
|
|
93
94
|
assert!(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
err.contains("unverified") || err.contains("未验证") || err.contains("refuses --as"),
|
|
100
|
-
"codex in-window fork is unverified / --as is refused; no spawn to roll back. result={result:?}"
|
|
95
|
+
matches!(
|
|
96
|
+
&result,
|
|
97
|
+
Err(LifecycleError::Provider(message)) if message == "fake native session fork is unverified (未验证); no legacy fork or fresh replacement was performed"
|
|
98
|
+
),
|
|
99
|
+
"the legacy fork entry refuses the fake source as unverified before any spawn; no spawn to roll back. result={result:?}"
|
|
101
100
|
);
|
|
102
101
|
assert!(
|
|
103
102
|
transport.killed().is_empty(),
|
|
104
|
-
"
|
|
103
|
+
"refused legacy fork must not spawn a window to kill; killed={:?} result={result:?}",
|
|
105
104
|
transport.killed()
|
|
106
105
|
);
|
|
107
106
|
assert_eq!(
|
|
108
107
|
spec_after, spec_before,
|
|
109
|
-
"refused
|
|
108
|
+
"refused legacy fork must not mutate team.spec.yaml; result={result:?}"
|
|
110
109
|
);
|
|
111
110
|
assert!(
|
|
112
111
|
state_after
|
|
113
112
|
.pointer("/agents/newfork")
|
|
114
113
|
.is_none(),
|
|
115
|
-
"refused
|
|
114
|
+
"refused legacy fork must not create a newfork row; state={state_after}"
|
|
116
115
|
);
|
|
117
116
|
assert!(
|
|
118
117
|
!mcp_path.exists(),
|
|
119
|
-
"refused
|
|
118
|
+
"refused legacy fork must not write MCP config; leaked={}",
|
|
120
119
|
mcp_path.display()
|
|
121
120
|
);
|
|
122
121
|
|
|
@@ -265,61 +264,26 @@ impl RollbackFixture {
|
|
|
265
264
|
"fixture must compile agent ids alpha/bravo before lifecycle calls; spec={yaml}"
|
|
266
265
|
);
|
|
267
266
|
std::fs::write(self.team.join("team.spec.yaml"), yaml).unwrap();
|
|
268
|
-
// Seed identity-complete Codex source backings so rollback tests reach
|
|
269
|
-
// their post-spawn failure injection instead of stopping at materialization.
|
|
270
|
-
let rollout_root = PathBuf::from(std::env::var_os("HOME").expect("hermetic HOME"))
|
|
271
|
-
.join(".codex/sessions/rollback-source");
|
|
272
|
-
std::fs::create_dir_all(&rollout_root).unwrap();
|
|
273
|
-
for (agent, session) in [("alpha", "sess-alpha"), ("bravo", "sess-bravo")] {
|
|
274
|
-
std::fs::write(
|
|
275
|
-
rollout_root.join(format!("rollout-{session}.jsonl")),
|
|
276
|
-
format!(
|
|
277
|
-
"{}\n{}\n",
|
|
278
|
-
json!({
|
|
279
|
-
"type": "session_meta",
|
|
280
|
-
"payload": {"id": session, "cwd": self.team}
|
|
281
|
-
}),
|
|
282
|
-
json!({
|
|
283
|
-
"type": "response_item",
|
|
284
|
-
"payload": {"content": [{
|
|
285
|
-
"type": "input_text",
|
|
286
|
-
"text": format!("You are Team Agent worker `{agent}` with role `fixture`.")
|
|
287
|
-
}]}
|
|
288
|
-
})
|
|
289
|
-
),
|
|
290
|
-
)
|
|
291
|
-
.unwrap();
|
|
292
|
-
}
|
|
293
267
|
save_runtime_state(
|
|
294
268
|
&self.team,
|
|
295
269
|
&json!({
|
|
296
270
|
"session_name": "team-rollbackteam",
|
|
297
271
|
"active_team_key": "rollbackteam",
|
|
298
|
-
// 0.4.6 tuple-atomic contract: fork now requires complete
|
|
299
|
-
// source tuple. Seed real rollout files + captured_at/via
|
|
300
|
-
// so the fork-source backing guard passes and the test
|
|
301
|
-
// reaches the rollback behaviour it actually asserts.
|
|
302
272
|
"agents": {
|
|
303
273
|
"alpha": {
|
|
304
274
|
"status": "stopped",
|
|
305
|
-
"provider": "
|
|
275
|
+
"provider": "fake",
|
|
306
276
|
"auth_mode": "subscription",
|
|
307
277
|
"window": "alpha",
|
|
308
278
|
"session_id": "sess-alpha",
|
|
309
|
-
"rollout_path": rollout_root.join("rollout-sess-alpha.jsonl").to_string_lossy(),
|
|
310
|
-
"captured_at": "2026-06-25T10:00:00+00:00",
|
|
311
|
-
"captured_via": "session.captured",
|
|
312
279
|
"owner_team_id": "rollbackteam"
|
|
313
280
|
},
|
|
314
281
|
"bravo": {
|
|
315
282
|
"status": "running",
|
|
316
|
-
"provider": "
|
|
283
|
+
"provider": "fake",
|
|
317
284
|
"auth_mode": "subscription",
|
|
318
285
|
"window": "bravo",
|
|
319
286
|
"session_id": "sess-bravo",
|
|
320
|
-
"rollout_path": rollout_root.join("rollout-sess-bravo.jsonl").to_string_lossy(),
|
|
321
|
-
"captured_at": "2026-06-25T10:00:00+00:00",
|
|
322
|
-
"captured_via": "session.captured",
|
|
323
287
|
"owner_team_id": "rollbackteam"
|
|
324
288
|
}
|
|
325
289
|
}
|
|
@@ -350,7 +314,7 @@ impl RollbackFixture {
|
|
|
350
314
|
"agents": {
|
|
351
315
|
"newfork": {
|
|
352
316
|
"status": "running",
|
|
353
|
-
"provider": "
|
|
317
|
+
"provider": "fake",
|
|
354
318
|
"pane_id": "%sibling-newfork",
|
|
355
319
|
"owner_team_id": "sibling"
|
|
356
320
|
}
|
|
@@ -418,7 +382,7 @@ impl RollbackFixture {
|
|
|
418
382
|
|
|
419
383
|
fn agent_doc(name: &str, role: &str) -> String {
|
|
420
384
|
format!(
|
|
421
|
-
"---\nname: {name}\nrole: {role}\nprovider:
|
|
385
|
+
"---\nname: {name}\nrole: {role}\nprovider: fake\nmodel: fake\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\n{role}.\n"
|
|
422
386
|
)
|
|
423
387
|
}
|
|
424
388
|
|
|
@@ -470,9 +434,8 @@ impl RecordingTransport {
|
|
|
470
434
|
&self,
|
|
471
435
|
session: &SessionName,
|
|
472
436
|
window: &WindowName,
|
|
473
|
-
|
|
437
|
+
_argv: &[String],
|
|
474
438
|
) -> Result<SpawnResult, TransportError> {
|
|
475
|
-
emit_codex_fork_backing(argv);
|
|
476
439
|
self.windows
|
|
477
440
|
.lock()
|
|
478
441
|
.unwrap()
|
|
@@ -486,32 +449,6 @@ impl RecordingTransport {
|
|
|
486
449
|
}
|
|
487
450
|
}
|
|
488
451
|
|
|
489
|
-
fn emit_codex_fork_backing(argv: &[String]) {
|
|
490
|
-
if !argv
|
|
491
|
-
.windows(2)
|
|
492
|
-
.any(|pair| pair[0] == "codex" && pair[1] == "fork")
|
|
493
|
-
{
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
|
-
static SESSION_SEQ: AtomicU64 = AtomicU64::new(0);
|
|
497
|
-
let session_id = format!(
|
|
498
|
-
"rollback-fork-{}-{}",
|
|
499
|
-
std::process::id(),
|
|
500
|
-
SESSION_SEQ.fetch_add(1, Ordering::Relaxed)
|
|
501
|
-
);
|
|
502
|
-
let root = PathBuf::from(std::env::var_os("HOME").expect("hermetic HOME"))
|
|
503
|
-
.join(".codex/sessions/lifecycle-rollback-fixture");
|
|
504
|
-
std::fs::create_dir_all(&root).unwrap();
|
|
505
|
-
std::fs::write(
|
|
506
|
-
root.join(format!("rollout-{session_id}.jsonl")),
|
|
507
|
-
format!(
|
|
508
|
-
"{{\"session_meta\":{{\"payload\":{{\"id\":\"{session_id}\"}}}},\"created_at\":\"{}\"}}\n",
|
|
509
|
-
chrono::Utc::now().to_rfc3339()
|
|
510
|
-
),
|
|
511
|
-
)
|
|
512
|
-
.unwrap();
|
|
513
|
-
}
|
|
514
|
-
|
|
515
452
|
impl Transport for RecordingTransport {
|
|
516
453
|
fn kind(&self) -> BackendKind {
|
|
517
454
|
BackendKind::Tmux
|
|
@@ -222,16 +222,16 @@ impl crate::transport::Transport for SessionProbeRecordingTransport {
|
|
|
222
222
|
unimplemented!("not reached")
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
|
|
225
|
+
// The spawn-kind decision is independent of the start mode, so a fresh `fake` worker (no stored
|
|
226
|
+
// session) exercises the same respawn path without a provider resume backing.
|
|
227
|
+
fn respawn_ws_one_worker() -> PathBuf {
|
|
226
228
|
let ws = temp_ws().join("respawn_dead_session");
|
|
227
229
|
std::fs::create_dir_all(&ws).unwrap();
|
|
228
|
-
let rollout = ws.join("alpha-rollout.jsonl");
|
|
229
|
-
std::fs::write(&rollout, "{}\n").unwrap();
|
|
230
230
|
crate::state::persist::save_runtime_state(
|
|
231
231
|
&ws,
|
|
232
232
|
&json!({
|
|
233
233
|
"session_name": "team-sa",
|
|
234
|
-
"agents": {"alpha": {"status": "running", "provider": "
|
|
234
|
+
"agents": {"alpha": {"status": "running", "provider": "fake"}}
|
|
235
235
|
}),
|
|
236
236
|
)
|
|
237
237
|
.unwrap();
|
|
@@ -246,7 +246,7 @@ fn respawn_ws_one_resumable_worker() -> PathBuf {
|
|
|
246
246
|
// the transport implements has_session, so the only failure is the wrong spawn kind.
|
|
247
247
|
#[test]
|
|
248
248
|
fn start_agent_respawn_into_dead_session_uses_new_session_not_new_window() {
|
|
249
|
-
let ws =
|
|
249
|
+
let ws = respawn_ws_one_worker();
|
|
250
250
|
let spawns = std::sync::Arc::new(std::sync::Mutex::new(Vec::new()));
|
|
251
251
|
// session_exists=false models the dead CP-1 `-L` server after --discard-session.
|
|
252
252
|
let transport = SessionProbeRecordingTransport {
|
|
@@ -449,8 +449,8 @@ fn bugb_routed_team_ws() -> PathBuf {
|
|
|
449
449
|
&json!({
|
|
450
450
|
"session_name": "team-laneateam",
|
|
451
451
|
"agents": {
|
|
452
|
-
"alpha": {"status": "stopped", "provider": "
|
|
453
|
-
"bravo": {"status": "stopped", "provider": "
|
|
452
|
+
"alpha": {"status": "stopped", "provider": "fake", "window": "alpha"},
|
|
453
|
+
"bravo": {"status": "stopped", "provider": "fake", "window": "bravo"}
|
|
454
454
|
}
|
|
455
455
|
}),
|
|
456
456
|
)
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
mod hermetic_guard;
|
|
3
3
|
|
|
4
4
|
use super::agent_ops::lanea_team_ws;
|
|
5
|
-
use super::lane_ops::{
|
|
6
|
-
|
|
7
|
-
quick_start_team_dir, seed_healthy_coordinator, DELEG_ROLE_ALPHA, QS_VALID_ROLE,
|
|
5
|
+
use super::lane_ops::{
|
|
6
|
+
assert_legacy_fork_unverified, fork_ws, LaneHomeGuard, LaneTransport, COPILOT_ROLE_ALPHA,
|
|
8
7
|
};
|
|
8
|
+
use super::launch_spawn::{quick_start_team_dir, seed_healthy_coordinator, QS_VALID_ROLE};
|
|
9
9
|
use super::*;
|
|
10
10
|
use crate::lifecycle::lock::{
|
|
11
11
|
acquire_agent_lifecycle_lock_for_test, override_agent_lifecycle_lock_deadlines_for_test,
|
|
@@ -46,7 +46,7 @@ fn concurrent_reset_discard_session_serializes() {
|
|
|
46
46
|
let workspace = team.parent().expect("team workspace").to_path_buf();
|
|
47
47
|
seed_healthy_coordinator(&workspace);
|
|
48
48
|
|
|
49
|
-
let launch_transport =
|
|
49
|
+
let launch_transport = copilot_ready_transport();
|
|
50
50
|
let quick_start = quick_start_with_transport_in_workspace(
|
|
51
51
|
&workspace,
|
|
52
52
|
&team,
|
|
@@ -61,7 +61,7 @@ fn concurrent_reset_discard_session_serializes() {
|
|
|
61
61
|
"fixture must launch: {quick_start:?}"
|
|
62
62
|
);
|
|
63
63
|
|
|
64
|
-
let reset_transport =
|
|
64
|
+
let reset_transport = copilot_ready_transport()
|
|
65
65
|
.with_session_present(true)
|
|
66
66
|
.with_windows(ids.iter().map(|id| WindowName::new(id.as_str())).collect());
|
|
67
67
|
let outcomes = ids
|
|
@@ -203,7 +203,7 @@ fn add_fork_remove_share_lifecycle_lock_behavior() {
|
|
|
203
203
|
"released add-agent must add the worker"
|
|
204
204
|
);
|
|
205
205
|
|
|
206
|
-
let fork_workspace = fork_ws(
|
|
206
|
+
let fork_workspace = fork_ws(COPILOT_ROLE_ALPHA);
|
|
207
207
|
let fork_transport = LaneTransport::new("team-laneateam", &[]);
|
|
208
208
|
let fork_spec_before = std::fs::read_to_string(fork_workspace.join("team.spec.yaml")).unwrap();
|
|
209
209
|
let fork_state_before = crate::state::persist::load_runtime_state(&fork_workspace).unwrap();
|
|
@@ -213,21 +213,18 @@ fn add_fork_remove_share_lifecycle_lock_behavior() {
|
|
|
213
213
|
Duration::from_millis(120),
|
|
214
214
|
Duration::from_secs(5),
|
|
215
215
|
);
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|| fork_held_text.contains("未验证")
|
|
229
|
-
|| fork_held_text.contains("LifecycleLockTimeout"),
|
|
230
|
-
"codex in-window fork is unverified (lock is not reached); got {fork_held:?}"
|
|
216
|
+
// The legacy fork entry takes the lifecycle lock before reading the source row.
|
|
217
|
+
assert_lock_timeout(
|
|
218
|
+
crate::lifecycle::fork_agent_with_transport(
|
|
219
|
+
&fork_workspace,
|
|
220
|
+
&aid("alpha"),
|
|
221
|
+
&fork_agent,
|
|
222
|
+
None,
|
|
223
|
+
false,
|
|
224
|
+
None,
|
|
225
|
+
&fork_transport,
|
|
226
|
+
),
|
|
227
|
+
"fork-agent",
|
|
231
228
|
);
|
|
232
229
|
assert!(
|
|
233
230
|
fork_transport.spawns().is_empty(),
|
|
@@ -254,10 +251,10 @@ fn add_fork_remove_share_lifecycle_lock_behavior() {
|
|
|
254
251
|
None,
|
|
255
252
|
&fork_transport,
|
|
256
253
|
);
|
|
257
|
-
|
|
254
|
+
assert_legacy_fork_unverified(&fork_after, "copilot");
|
|
258
255
|
assert!(
|
|
259
|
-
|
|
260
|
-
"
|
|
256
|
+
fork_transport.spawns().is_empty(),
|
|
257
|
+
"released legacy fork-agent stays refused and must not spawn a window"
|
|
261
258
|
);
|
|
262
259
|
|
|
263
260
|
let remove_workspace = lanea_team_ws("stopped");
|
|
@@ -423,19 +420,17 @@ fn breal_reset_rehydrates_role_context_from_compiled_spec() {
|
|
|
423
420
|
)
|
|
424
421
|
.expect("reset should use spec-rehydrated role context");
|
|
425
422
|
|
|
426
|
-
let
|
|
427
|
-
|
|
428
|
-
.
|
|
429
|
-
.map(|record| record.join("\n"))
|
|
423
|
+
let prompt = transport
|
|
424
|
+
.spawn_instructions()
|
|
425
|
+
.pop()
|
|
430
426
|
.expect("reset must spawn w1");
|
|
431
427
|
assert!(
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
"spawn argv must carry role from compiled spec/role doc, got:\n{argv}"
|
|
428
|
+
prompt.contains("role `Phase B Real Worker One`"),
|
|
429
|
+
"spawned worker instructions must carry role from compiled spec/role doc, got:\n{prompt}"
|
|
435
430
|
);
|
|
436
431
|
assert!(
|
|
437
|
-
!
|
|
438
|
-
"
|
|
432
|
+
!prompt.contains("role `developer`"),
|
|
433
|
+
"spawned worker instructions must not fall back to generic developer, got:\n{prompt}"
|
|
439
434
|
);
|
|
440
435
|
}
|
|
441
436
|
|
|
@@ -450,19 +445,17 @@ fn breal_restart_rehydrates_role_context_from_compiled_spec() {
|
|
|
450
445
|
crate::lifecycle::restart_with_transport(&workspace, true, Some("teamdir"), &transport)
|
|
451
446
|
.expect("restart should use spec-rehydrated role context");
|
|
452
447
|
|
|
453
|
-
let
|
|
454
|
-
|
|
455
|
-
.
|
|
456
|
-
.map(|record| record.join("\n"))
|
|
448
|
+
let prompt = transport
|
|
449
|
+
.spawn_instructions()
|
|
450
|
+
.pop()
|
|
457
451
|
.expect("restart must spawn w1");
|
|
458
452
|
assert!(
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
"restart spawn argv must carry role from compiled spec/role doc, got:\n{argv}"
|
|
453
|
+
prompt.contains("role `Phase B Real Worker One`"),
|
|
454
|
+
"restart worker instructions must carry role from compiled spec/role doc, got:\n{prompt}"
|
|
462
455
|
);
|
|
463
456
|
assert!(
|
|
464
|
-
!
|
|
465
|
-
"restart
|
|
457
|
+
!prompt.contains("role `developer`"),
|
|
458
|
+
"restart worker instructions must not fall back to generic developer, got:\n{prompt}"
|
|
466
459
|
);
|
|
467
460
|
}
|
|
468
461
|
|
|
@@ -481,12 +474,12 @@ fn team_dir_with_roles(role_docs: &[(&str, &str)]) -> PathBuf {
|
|
|
481
474
|
}
|
|
482
475
|
|
|
483
476
|
fn breal_workspace() -> (PathBuf, PathBuf) {
|
|
484
|
-
let w1 = "---\nname: w1\nrole: Phase B Real Worker One\nprovider:
|
|
485
|
-
let w2 = "---\nname: w2\nrole: Phase B Real Worker Two\nprovider:
|
|
477
|
+
let w1 = "---\nname: w1\nrole: Phase B Real Worker One\nprovider: copilot\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker one body.\n";
|
|
478
|
+
let w2 = "---\nname: w2\nrole: Phase B Real Worker Two\nprovider: copilot\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker two body.\n";
|
|
486
479
|
let team = team_dir_with_roles(&[("w1.md", w1), ("w2.md", w2)]);
|
|
487
480
|
let workspace = team.parent().expect("team workspace").to_path_buf();
|
|
488
481
|
seed_healthy_coordinator(&workspace);
|
|
489
|
-
let launch_transport =
|
|
482
|
+
let launch_transport = copilot_ready_transport();
|
|
490
483
|
quick_start_with_transport_in_workspace(
|
|
491
484
|
&workspace,
|
|
492
485
|
&team,
|
|
@@ -500,11 +493,11 @@ fn breal_workspace() -> (PathBuf, PathBuf) {
|
|
|
500
493
|
}
|
|
501
494
|
|
|
502
495
|
fn breal_one_worker_workspace() -> (PathBuf, PathBuf) {
|
|
503
|
-
let w1 = "---\nname: w1\nrole: Phase B Real Worker One\nprovider:
|
|
496
|
+
let w1 = "---\nname: w1\nrole: Phase B Real Worker One\nprovider: copilot\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker one body.\n";
|
|
504
497
|
let team = team_dir_with_roles(&[("w1.md", w1)]);
|
|
505
498
|
let workspace = team.parent().expect("team workspace").to_path_buf();
|
|
506
499
|
seed_healthy_coordinator(&workspace);
|
|
507
|
-
let launch_transport =
|
|
500
|
+
let launch_transport = copilot_ready_transport();
|
|
508
501
|
quick_start_with_transport_in_workspace(
|
|
509
502
|
&workspace,
|
|
510
503
|
&team,
|
|
@@ -542,7 +535,7 @@ fn strip_runtime_command_context(workspace: &std::path::Path) {
|
|
|
542
535
|
|
|
543
536
|
fn role_doc(id: &str) -> String {
|
|
544
537
|
format!(
|
|
545
|
-
"---\nname: {id}\nrole: {id} Worker\nprovider:
|
|
538
|
+
"---\nname: {id}\nrole: {id} Worker\nprovider: fake\nmodel: fake\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\n{id} worker.\n"
|
|
546
539
|
)
|
|
547
540
|
}
|
|
548
541
|
|
|
@@ -550,7 +543,7 @@ fn add_fixture() -> (PathBuf, PathBuf, PathBuf, OfflineTransport) {
|
|
|
550
543
|
let team = quick_start_team_dir(QS_VALID_ROLE);
|
|
551
544
|
let workspace = team.parent().expect("team workspace").to_path_buf();
|
|
552
545
|
seed_healthy_coordinator(&workspace);
|
|
553
|
-
let launch_transport =
|
|
546
|
+
let launch_transport = copilot_ready_transport();
|
|
554
547
|
quick_start_with_transport_in_workspace(
|
|
555
548
|
&workspace,
|
|
556
549
|
&team,
|
|
@@ -566,14 +559,17 @@ fn add_fixture() -> (PathBuf, PathBuf, PathBuf, OfflineTransport) {
|
|
|
566
559
|
team,
|
|
567
560
|
workspace,
|
|
568
561
|
role,
|
|
569
|
-
|
|
562
|
+
copilot_ready_transport().with_session_present(true),
|
|
570
563
|
)
|
|
571
564
|
}
|
|
572
565
|
|
|
573
|
-
|
|
566
|
+
/// Every pane shows the Copilot ready screen, so a Copilot worker's startup-prompt handler returns
|
|
567
|
+
/// at once instead of polling an empty pane; `fake` workers never capture.
|
|
568
|
+
fn copilot_ready_transport() -> OfflineTransport {
|
|
574
569
|
let mut transport = OfflineTransport::new();
|
|
575
570
|
for pane in 0..32 {
|
|
576
|
-
transport = transport
|
|
571
|
+
transport = transport
|
|
572
|
+
.with_capture_for_pane(format!("%{pane}"), crate::provider::COPILOT_READY_MARKER);
|
|
577
573
|
}
|
|
578
574
|
transport
|
|
579
575
|
}
|
|
@@ -629,32 +625,34 @@ enum BRealMode {
|
|
|
629
625
|
struct BRealTransport {
|
|
630
626
|
mode: BRealMode,
|
|
631
627
|
spawns: std::sync::Mutex<Vec<Vec<String>>>,
|
|
628
|
+
// Copilot carries the compiled role prompt in the per-worker AGENTS.md named by
|
|
629
|
+
// COPILOT_CUSTOM_INSTRUCTIONS_DIRS, not in argv; snapshot it at spawn time.
|
|
630
|
+
instructions: std::sync::Mutex<Vec<String>>,
|
|
632
631
|
}
|
|
633
632
|
|
|
634
633
|
impl BRealTransport {
|
|
635
|
-
fn
|
|
634
|
+
fn new(mode: BRealMode) -> Self {
|
|
636
635
|
Self {
|
|
637
|
-
mode
|
|
636
|
+
mode,
|
|
638
637
|
spawns: std::sync::Mutex::new(Vec::new()),
|
|
638
|
+
instructions: std::sync::Mutex::new(Vec::new()),
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
|
|
642
|
+
fn misowned() -> Self {
|
|
643
|
+
Self::new(BRealMode::Misowned)
|
|
644
|
+
}
|
|
645
|
+
|
|
642
646
|
fn dead_after_spawn() -> Self {
|
|
643
|
-
Self
|
|
644
|
-
mode: BRealMode::DeadAfterSpawn,
|
|
645
|
-
spawns: std::sync::Mutex::new(Vec::new()),
|
|
646
|
-
}
|
|
647
|
+
Self::new(BRealMode::DeadAfterSpawn)
|
|
647
648
|
}
|
|
648
649
|
|
|
649
650
|
fn owned() -> Self {
|
|
650
|
-
Self
|
|
651
|
-
mode: BRealMode::Owned,
|
|
652
|
-
spawns: std::sync::Mutex::new(Vec::new()),
|
|
653
|
-
}
|
|
651
|
+
Self::new(BRealMode::Owned)
|
|
654
652
|
}
|
|
655
653
|
|
|
656
|
-
fn
|
|
657
|
-
self.
|
|
654
|
+
fn spawn_instructions(&self) -> Vec<String> {
|
|
655
|
+
self.instructions.lock().unwrap().clone()
|
|
658
656
|
}
|
|
659
657
|
|
|
660
658
|
fn spawn_result(
|
|
@@ -662,8 +660,16 @@ impl BRealTransport {
|
|
|
662
660
|
session: &SessionName,
|
|
663
661
|
window: &WindowName,
|
|
664
662
|
argv: &[String],
|
|
663
|
+
env: &std::collections::BTreeMap<String, String>,
|
|
665
664
|
) -> SpawnResult {
|
|
666
665
|
self.spawns.lock().unwrap().push(argv.to_vec());
|
|
666
|
+
self.instructions.lock().unwrap().push(
|
|
667
|
+
env.get("COPILOT_CUSTOM_INSTRUCTIONS_DIRS")
|
|
668
|
+
.and_then(|dir| {
|
|
669
|
+
std::fs::read_to_string(std::path::Path::new(dir).join("AGENTS.md")).ok()
|
|
670
|
+
})
|
|
671
|
+
.unwrap_or_default(),
|
|
672
|
+
);
|
|
667
673
|
let pane = match self.mode {
|
|
668
674
|
BRealMode::Misowned => "%5",
|
|
669
675
|
BRealMode::DeadAfterSpawn => "%9",
|
|
@@ -689,9 +695,9 @@ impl Transport for BRealTransport {
|
|
|
689
695
|
window: &WindowName,
|
|
690
696
|
argv: &[String],
|
|
691
697
|
_cwd: &std::path::Path,
|
|
692
|
-
|
|
698
|
+
env: &std::collections::BTreeMap<String, String>,
|
|
693
699
|
) -> Result<SpawnResult, TransportError> {
|
|
694
|
-
Ok(self.spawn_result(session, window, argv))
|
|
700
|
+
Ok(self.spawn_result(session, window, argv, env))
|
|
695
701
|
}
|
|
696
702
|
|
|
697
703
|
fn spawn_into(
|
|
@@ -700,9 +706,9 @@ impl Transport for BRealTransport {
|
|
|
700
706
|
window: &WindowName,
|
|
701
707
|
argv: &[String],
|
|
702
708
|
_cwd: &std::path::Path,
|
|
703
|
-
|
|
709
|
+
env: &std::collections::BTreeMap<String, String>,
|
|
704
710
|
) -> Result<SpawnResult, TransportError> {
|
|
705
|
-
Ok(self.spawn_result(session, window, argv))
|
|
711
|
+
Ok(self.spawn_result(session, window, argv, env))
|
|
706
712
|
}
|
|
707
713
|
|
|
708
714
|
fn inject(
|
|
@@ -732,7 +738,7 @@ impl Transport for BRealTransport {
|
|
|
732
738
|
range: CaptureRange,
|
|
733
739
|
) -> Result<CapturedText, TransportError> {
|
|
734
740
|
Ok(CapturedText {
|
|
735
|
-
text:
|
|
741
|
+
text: crate::provider::COPILOT_READY_MARKER.to_string(),
|
|
736
742
|
range,
|
|
737
743
|
})
|
|
738
744
|
}
|
|
@@ -146,17 +146,9 @@ fn two_worker_team_dir(hermetic: &HermeticTestEnv) -> PathBuf {
|
|
|
146
146
|
team
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
fn codex_ready_transport() -> OfflineTransport {
|
|
150
|
-
let mut transport = OfflineTransport::new();
|
|
151
|
-
for pane in 0..16 {
|
|
152
|
-
transport = transport.with_capture_for_pane(format!("%{pane}"), "OpenAI Codex");
|
|
153
|
-
}
|
|
154
|
-
transport
|
|
155
|
-
}
|
|
156
|
-
|
|
157
149
|
fn role_doc(id: &str) -> String {
|
|
158
150
|
format!(
|
|
159
|
-
"---\nname: {id}\nrole: {id} Worker\nprovider:
|
|
151
|
+
"---\nname: {id}\nrole: {id} Worker\nprovider: fake\nmodel: fake\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\n{id} worker.\n"
|
|
160
152
|
)
|
|
161
153
|
}
|
|
162
154
|
|
|
@@ -183,7 +175,7 @@ fn run_diagnose_after_unbound_state_fixture() -> Value {
|
|
|
183
175
|
let team = two_worker_team_dir(&hermetic);
|
|
184
176
|
let workspace = team.parent().expect("workspace").to_path_buf();
|
|
185
177
|
seed_healthy_coordinator(&workspace);
|
|
186
|
-
let launch_transport =
|
|
178
|
+
let launch_transport = OfflineTransport::new();
|
|
187
179
|
crate::lifecycle::launch::materialize_unbound_state_for_test(
|
|
188
180
|
&workspace, &team, "teamdir", &launch_transport,
|
|
189
181
|
).expect("materialize the recording-only tombstone fixture, not a callerless public start");
|
|
@@ -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
|
}
|