@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.
Files changed (144) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/crates/team-agent/src/cli/diagnose.rs +0 -137
  4. package/crates/team-agent/src/cli/emit.rs +13 -8
  5. package/crates/team-agent/src/cli/grok_slot.rs +88 -3
  6. package/crates/team-agent/src/cli/intent/runtime.rs +6 -4
  7. package/crates/team-agent/src/cli/intent/runtime_tests.rs +55 -10
  8. package/crates/team-agent/src/cli/mod.rs +35 -29
  9. package/crates/team-agent/src/cli/models.rs +33 -944
  10. package/crates/team-agent/src/cli/tests/leader_watch.rs +1 -1
  11. package/crates/team-agent/src/cli/tests/mod.rs +3 -3
  12. package/crates/team-agent/src/cli/tests/run_delegation.rs +8 -7
  13. package/crates/team-agent/src/cli/tests/status_send.rs +2 -2
  14. package/crates/team-agent/src/compiler/tests.rs +54 -12
  15. package/crates/team-agent/src/compiler.rs +7 -205
  16. package/crates/team-agent/src/contract_runtime/backend.rs +97 -38
  17. package/crates/team-agent/src/contract_runtime/commands.rs +335 -4
  18. package/crates/team-agent/src/contract_runtime/config.rs +12 -8
  19. package/crates/team-agent/src/contract_runtime/fork.rs +368 -0
  20. package/crates/team-agent/src/contract_runtime/framework.rs +8 -13
  21. package/crates/team-agent/src/contract_runtime/mod.rs +1 -0
  22. package/crates/team-agent/src/contract_runtime/registry.rs +100 -60
  23. package/crates/team-agent/src/coordinator/steps/abnormal.rs +45 -5
  24. package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +54 -16
  25. package/crates/team-agent/src/coordinator/tests/energy.rs +4 -4
  26. package/crates/team-agent/src/coordinator/tests/health_sync.rs +2 -44
  27. package/crates/team-agent/src/coordinator/tests/main_preserved.rs +2 -2
  28. package/crates/team-agent/src/coordinator/tests/spine.rs +1 -1
  29. package/crates/team-agent/src/coordinator/tests/takeover.rs +3 -3
  30. package/crates/team-agent/src/leader/start.rs +1 -1
  31. package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +2 -195
  32. package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +11 -27
  33. package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +22 -200
  34. package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +6 -87
  35. package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +5 -496
  36. package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +74 -244
  37. package/crates/team-agent/src/lifecycle/launch/quick_start.rs +2 -26
  38. package/crates/team-agent/src/lifecycle/launch/role_source.rs +5 -0
  39. package/crates/team-agent/src/lifecycle/launch/spawn.rs +26 -51
  40. package/crates/team-agent/src/lifecycle/launch.rs +3 -34
  41. package/crates/team-agent/src/lifecycle/profile_launch.rs +18 -373
  42. package/crates/team-agent/src/lifecycle/restart/common.rs +45 -463
  43. package/crates/team-agent/src/lifecycle/restart/remove.rs +129 -0
  44. package/crates/team-agent/src/lifecycle/restart/selection.rs +5 -5
  45. package/crates/team-agent/src/lifecycle/restart.rs +0 -2
  46. package/crates/team-agent/src/lifecycle/role_config.rs +40 -13
  47. package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +1 -1
  48. package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +8 -12
  49. package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +38 -236
  50. package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +8 -320
  51. package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +106 -186
  52. package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +4 -334
  53. package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +19 -15
  54. package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +2 -2
  55. package/crates/team-agent/src/lifecycle/tests/core.rs +33 -58
  56. package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +22 -8
  57. package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +15 -133
  58. package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +3 -51
  59. package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +30 -67
  60. package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +3 -31
  61. package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +194 -169
  62. package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +162 -284
  63. package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +15 -78
  64. package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +7 -7
  65. package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +75 -69
  66. package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +2 -10
  67. package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +6 -18
  68. package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +52 -70
  69. package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +4 -157
  70. package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +10 -302
  71. package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +1 -68
  72. package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +1 -19
  73. package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +2 -100
  74. package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +15 -14
  75. package/crates/team-agent/src/lifecycle/tests/restart.rs +12 -153
  76. package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +27 -5
  77. package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +59 -10
  78. package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +47 -6
  79. package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +3 -1478
  80. package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +27 -10
  81. package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +7 -7
  82. package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +67 -313
  83. package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +2 -254
  84. package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +2 -2
  85. package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +1 -1
  86. package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +2 -2
  87. package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +4 -4
  88. package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +74 -19
  89. package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +39 -38
  90. package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +42 -97
  91. package/crates/team-agent/src/lifecycle/tests.rs +0 -7
  92. package/crates/team-agent/src/lifecycle/types.rs +2 -21
  93. package/crates/team-agent/src/mcp_server/readiness_tests.rs +15 -17
  94. package/crates/team-agent/src/messaging/delivery.rs +14 -195
  95. package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
  96. package/crates/team-agent/src/messaging/tests/dup_inject.rs +68 -69
  97. package/crates/team-agent/src/messaging/tests/main_preserved.rs +2 -2
  98. package/crates/team-agent/src/messaging/tests/runtime.rs +5 -5
  99. package/crates/team-agent/src/messaging/tests/spine.rs +30 -32
  100. package/crates/team-agent/src/messaging/tests/wave2.rs +13 -20
  101. package/crates/team-agent/src/provider/adapter.rs +71 -572
  102. package/crates/team-agent/src/provider/adapters/mod.rs +6 -8
  103. package/crates/team-agent/src/provider/model_catalog.rs +13 -201
  104. package/crates/team-agent/src/provider/session/capture.rs +11 -211
  105. package/crates/team-agent/src/provider/session/context_fork/outcome.rs +8 -24
  106. package/crates/team-agent/src/provider/session/context_fork.rs +29 -240
  107. package/crates/team-agent/src/provider/session/mod.rs +2 -3
  108. package/crates/team-agent/src/provider/session_scan/common.rs +27 -87
  109. package/crates/team-agent/src/provider/session_scan/pi.rs +1 -34
  110. package/crates/team-agent/src/provider/session_scan.rs +7 -23
  111. package/crates/team-agent/src/provider/tests/adapter.rs +66 -204
  112. package/crates/team-agent/src/provider/tests/command_helpers.rs +3 -29
  113. package/crates/team-agent/src/provider/tests/idle.rs +0 -68
  114. package/crates/team-agent/src/provider/types.rs +0 -4
  115. package/crates/team-agent/src/provider/wire.rs +77 -23
  116. package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +1 -1
  117. package/crates/team-agent/src/state/persist.rs +6 -6
  118. package/crates/team-agent/src/state/repository/tests.rs +2 -2
  119. package/crates/team-agent/src/tmux_backend.rs +4 -3
  120. package/package.json +4 -4
  121. package/skills/team-agent/SKILL.md +8 -5
  122. package/skills/team-agent/command-coverage.json +29 -1
  123. package/skills/team-agent/docs/reference/team-agent-operator.md +7 -3
  124. package/skills/team-agent/references/team-agent-operator.md +7 -3
  125. package/crates/team-agent/src/lifecycle/launch/grok_per_seat.rs +0 -260
  126. package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1805
  127. package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
  128. package/crates/team-agent/src/lifecycle/tests/codex_weak_window_attribution_red.rs +0 -683
  129. package/crates/team-agent/src/lifecycle/tests/grok_effort_argv_red.rs +0 -247
  130. package/crates/team-agent/src/lifecycle/tests/grok_mcp_overlay_red.rs +0 -507
  131. package/crates/team-agent/src/lifecycle/tests/grok_restart_resume_red.rs +0 -300
  132. package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
  133. package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1409
  134. package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
  135. package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
  136. package/crates/team-agent/src/provider/adapters/codex.rs +0 -101
  137. package/crates/team-agent/src/provider/adapters/grok.rs +0 -67
  138. package/crates/team-agent/src/provider/adapters/pi.rs +0 -100
  139. package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
  140. package/crates/team-agent/src/provider/session/context_fork/codex.rs +0 -514
  141. package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
  142. package/crates/team-agent/src/provider/session_scan/codex.rs +0 -326
  143. package/crates/team-agent/src/provider/session_scan/grok.rs +0 -288
  144. package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
@@ -653,6 +653,135 @@ fn remove_agent_at_paths(
653
653
  }
654
654
  }
655
655
 
656
+ struct ContractRemovalInputs {
657
+ paths: LifecyclePaths,
658
+ team: Option<String>,
659
+ transport: crate::tmux_backend::TmuxBackend,
660
+ state: serde_json::Value,
661
+ spec: YamlValue,
662
+ team_key: String,
663
+ }
664
+
665
+ impl ContractRemovalInputs {
666
+ fn resolve(workspace: &Path, agent_id: &AgentId, team: Option<&str>) -> Result<Self, LifecycleError> {
667
+ let paths = lifecycle_paths(workspace, team)?;
668
+ let team = paths.canonical_team(team).map(str::to_string);
669
+ let transport = paths.tmux_backend()?;
670
+ let state = resolve_team_scoped_state_or_refuse(&paths.run_workspace, team.as_deref())?;
671
+ crate::lifecycle::launch::ensure_owner_allowed_for_state(&state, Some(agent_id))?;
672
+ let spec = load_team_spec(&paths.spec_workspace)?;
673
+ let team_key = state
674
+ .get("active_team_key")
675
+ .and_then(serde_json::Value::as_str)
676
+ .filter(|key| !key.is_empty())
677
+ .map(str::to_string)
678
+ .unwrap_or_else(|| crate::state::projection::team_state_key(&state));
679
+ Ok(Self { paths, team, transport, state, spec, team_key })
680
+ }
681
+
682
+ fn refs(&self) -> LifecyclePathRefs<'_> {
683
+ LifecyclePathRefs {
684
+ run_workspace: &self.paths.run_workspace,
685
+ spec_workspace: &self.paths.spec_workspace,
686
+ }
687
+ }
688
+
689
+ fn rollback(&self, agent_id: &AgentId) -> Result<RemoveRollback, LifecycleError> {
690
+ RemoveRollback::capture(
691
+ &self.paths.run_workspace,
692
+ &self.paths.spec_workspace,
693
+ &self.spec,
694
+ &self.state,
695
+ &self.team_key,
696
+ agent_id,
697
+ )
698
+ }
699
+ }
700
+
701
+ /// ---
702
+ /// purpose: 契约席位摘除前的只读预检;在原生席位停机或退役之前,确认逻辑摘除所需输入都能解析
703
+ /// errors: 选不到 team、owner 门不过、spec 缺失或摘除后 spec 校验不过时返回 LifecycleError
704
+ /// ---
705
+ /// Deterministic failures surface while the native seat is still intact.
706
+ pub(crate) fn preflight_contract_removal(
707
+ workspace: &Path,
708
+ agent_id: &AgentId,
709
+ team: Option<&str>,
710
+ ) -> Result<(), LifecycleError> {
711
+ let inputs = ContractRemovalInputs::resolve(workspace, agent_id, team)?;
712
+ inputs.rollback(agent_id)?;
713
+ let removed = spec_without_agent(&inputs.spec, agent_id);
714
+ if should_validate_removed_spec(&removed, &inputs.refs()) {
715
+ crate::model::spec::validate_spec(&removed, &inputs.paths.run_workspace)
716
+ .map_err(|e| LifecycleError::Compile(e.to_string()))?;
717
+ }
718
+ Ok(())
719
+ }
720
+
721
+ /// ---
722
+ /// purpose: 契约席位的逻辑摘除;原生 store 的停机与退役已由调用方在同一把生命周期锁下完成
723
+ /// returns: 摘除结果
724
+ /// errors: 选不到 team、owner 门不过或写盘失败时返回 LifecycleError,并按快照回滚
725
+ /// ---
726
+ /// A contract seat has no workspace pane to resolve, so no legacy transport
727
+ /// identity is consulted. Only the shared logical records are removed.
728
+ pub(crate) fn remove_contract_records_locked(
729
+ workspace: &Path,
730
+ agent_id: &AgentId,
731
+ from_spec: bool,
732
+ force: bool,
733
+ stopped: bool,
734
+ team: Option<&str>,
735
+ ) -> Result<RemoveAgentOutcome, LifecycleError> {
736
+ let inputs = ContractRemovalInputs::resolve(workspace, agent_id, team)?;
737
+ let rollback = inputs.rollback(agent_id)?;
738
+ let refs = inputs.refs();
739
+ let team = inputs.team.as_deref();
740
+ let result = remove_agent_inner(
741
+ &refs,
742
+ agent_id,
743
+ &inputs.spec,
744
+ inputs.state.clone(),
745
+ None,
746
+ &inputs.team_key,
747
+ false,
748
+ team,
749
+ &inputs.transport,
750
+ );
751
+ match result {
752
+ Ok(success) => {
753
+ write_remove_complete_event(
754
+ refs.run_workspace,
755
+ agent_id,
756
+ from_spec,
757
+ force,
758
+ stopped,
759
+ success.role_file_removed,
760
+ success.cleared_locations,
761
+ )?;
762
+ Ok(success.outcome)
763
+ }
764
+ Err(error) => {
765
+ let restore_errors =
766
+ rollback.restore(refs.run_workspace, refs.spec_workspace, team, &inputs.transport);
767
+ let rollback_ok = restore_errors.is_empty();
768
+ let _ = write_remove_rollback_events(RemoveRollbackEvent {
769
+ agent_id,
770
+ workspace: refs.run_workspace,
771
+ from_spec,
772
+ force,
773
+ stopped,
774
+ error: &error,
775
+ rollback_ok,
776
+ restore_errors: &restore_errors,
777
+ });
778
+ Err(LifecycleError::StatePersist(format!(
779
+ "remove-agent failed for {agent_id}: {error}; rollback_ok={rollback_ok}"
780
+ )))
781
+ }
782
+ }
783
+ }
784
+
656
785
  fn remove_agent_inner(
657
786
  paths: &LifecyclePathRefs<'_>,
658
787
  agent_id: &AgentId,
@@ -45,7 +45,7 @@ mod contract_route_tests {
45
45
  fn mixed_team_retains_legacy_classification_without_native_codex_fallback() {
46
46
  let state = serde_json::json!({"agents": {
47
47
  "native": {"provider":"cursor","status":"running","session_id":"native-id"},
48
- "legacy": {"provider":"pi","status":"running"},
48
+ "legacy": {"provider":"copilot","status":"running"},
49
49
  }});
50
50
  let plan = classify_restart_plan(&state, false).unwrap();
51
51
  assert_eq!(plan.decisions.len(), 1);
@@ -61,11 +61,11 @@ mod stopped_restart_tests {
61
61
  #[test]
62
62
  fn stopped_rows_never_enter_validation_or_fresh_spawn_even_with_allow_fresh() {
63
63
  let state = serde_json::json!({"agents": {
64
- "stopped": {"provider":"pi","status":"stopped","explicit_stop":true,
64
+ "stopped": {"provider":"copilot","status":"stopped","explicit_stop":true,
65
65
  "session_id":"preserved","generation":7,"first_send_at":false},
66
- "legacy_stopped": {"provider":"pi","status":"stopped"},
67
- "marker": {"provider":"pi","status":"running","explicit_stop":true},
68
- "active": {"provider":"pi","status":"running"}
66
+ "legacy_stopped": {"provider":"copilot","status":"stopped"},
67
+ "marker": {"provider":"copilot","status":"running","explicit_stop":true},
68
+ "active": {"provider":"copilot","status":"running"}
69
69
  }});
70
70
  let before = state.clone();
71
71
  for allow_fresh in [false, true] {
@@ -66,8 +66,6 @@ struct LifecyclePathRefs<'a> {
66
66
  }
67
67
 
68
68
  mod agent;
69
- mod avatar;
70
- pub(crate) use avatar::fork_pi_new_seat_locked;
71
69
  mod common;
72
70
  mod orchestrator;
73
71
  pub mod preflight;
@@ -52,6 +52,20 @@ pub fn add_agent_from_role(
52
52
  })
53
53
  }
54
54
 
55
+ #[cfg(test)]
56
+ pub(crate) fn add_agent_from_role_with_transport(
57
+ workspace: &Path,
58
+ agent_id: &AgentId,
59
+ source: Option<&Path>,
60
+ patch: &RoleConfigPatch,
61
+ force: bool,
62
+ transport: &dyn Transport,
63
+ ) -> Result<AddAgentReport, LifecycleError> {
64
+ with_selected(&select(workspace, None)?, agent_id, |selected| {
65
+ add_at_selected(selected, agent_id, source, patch, force, transport)
66
+ })
67
+ }
68
+
55
69
  pub fn start_agent_from_role(
56
70
  workspace: &Path,
57
71
  agent_id: &AgentId,
@@ -108,27 +122,38 @@ fn add_at_selected(
108
122
  )));
109
123
  }
110
124
  let role_path = role_path(selected, agent_id);
111
- if !recreate {
125
+ // --force re-adopts the role file a removed seat left behind (#391): CLI
126
+ // values override its frontmatter and its body is kept.
127
+ let adopted = !recreate
128
+ && force
129
+ && source.is_none()
130
+ && fs::symlink_metadata(&role_path).is_ok_and(|meta| meta.is_file());
131
+ if !recreate && !adopted {
112
132
  check_destination(&role_path, source)?;
113
133
  }
114
134
  let text = match source {
115
135
  Some(path) => read_text(path)?,
136
+ None if adopted => patched_role(&read_text(&role_path)?, agent_id, patch, false)?,
116
137
  None => String::new(),
117
138
  };
139
+ let generated = source.is_none() && !adopted;
118
140
  #[allow(unused_mut)]
119
141
  let mut reconciled = reconcile_creation(&text, patch)?;
120
142
  // A generated legacy role falls back to its id as instructions at compile
121
143
  // time; a contract role requires a body, so give it a neutral default.
122
144
  #[cfg(unix)]
123
- if source.is_none()
145
+ if generated
124
146
  && reconciled.prompt.is_none()
125
- && crate::contract_runtime::framework::declares_contract(None, reconciled.provider.as_deref())
147
+ && crate::contract_runtime::framework::declares_contract(
148
+ None,
149
+ reconciled.provider.as_deref(),
150
+ )
126
151
  {
127
152
  reconciled.prompt = Some(format!(
128
153
  "You are {agent_id}. Complete the tasks assigned by the leader.\n"
129
154
  ));
130
155
  }
131
- let next = patched_role(&text, agent_id, &reconciled, source.is_none())?;
156
+ let next = patched_role(&text, agent_id, &reconciled, generated)?;
132
157
  let snapshot = RoleSnapshot::capture(selected, &role_path)?;
133
158
  let result = (|| {
134
159
  if snapshot.role.bytes.as_deref() != Some(next.as_bytes()) {
@@ -342,12 +367,11 @@ fn reconcile_creation(
342
367
  .get("provider")
343
368
  .and_then(Value::as_str)
344
369
  .filter(|value| !value.trim().is_empty());
345
- let opted_in = matches!(meta.get("contract_runtime"), Some(Value::Bool(true)));
346
370
  if let Some(file_provider) = file_provider {
347
- let file_provider = declared_provider(file_provider, opted_in)
371
+ let file_provider = declared_provider(file_provider)
348
372
  .ok_or_else(|| LifecycleError::Compile("unknown role provider".into()))?;
349
373
  if let Some(provider) = &next.provider {
350
- if declared_provider(provider, opted_in) != Some(file_provider) {
374
+ if declared_provider(provider) != Some(file_provider) {
351
375
  return Err(conflict("provider"));
352
376
  }
353
377
  next.provider = None;
@@ -415,13 +439,11 @@ fn reconcile_creation(
415
439
 
416
440
  /// One identity per declared provider: its contract leaf id, else its legacy
417
441
  /// wire form, so `agent` in a role file and `--provider cursor` agree.
418
- fn declared_provider(value: &str, contract_runtime: bool) -> Option<&'static str> {
442
+ fn declared_provider(value: &str) -> Option<&'static str> {
419
443
  #[cfg(unix)]
420
- if let Some(descriptor) = crate::contract_runtime::registry::declared(value, contract_runtime) {
444
+ if let Some(descriptor) = crate::contract_runtime::registry::declared(value) {
421
445
  return Some(descriptor.identity.id);
422
446
  }
423
- #[cfg(not(unix))]
424
- let _ = contract_runtime;
425
447
  crate::provider::wire::parse_provider(value).map(crate::provider::wire::provider_wire)
426
448
  }
427
449
 
@@ -449,8 +471,13 @@ fn check_destination(path: &Path, source: Option<&Path>) -> Result<(), Lifecycle
449
471
  .is_some_and(|(source, target)| source == target)
450
472
  }) {
451
473
  return Err(LifecycleError::RequirementUnmet(format!(
452
- "role file already exists: {}",
453
- path.display()
474
+ "role file already exists: {}{}",
475
+ path.display(),
476
+ if source.is_none() {
477
+ "; reuse it with --role-file or re-adopt it with --force"
478
+ } else {
479
+ ""
480
+ }
454
481
  )));
455
482
  }
456
483
  }
@@ -405,7 +405,7 @@ fn write_min_team(ws: &Path, name: &str) -> PathBuf {
405
405
  .unwrap();
406
406
  std::fs::write(
407
407
  team.join("agents/worker_a.md"),
408
- "---\nname: worker_a\nrole: Worker\nprovider: codex\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker.\n",
408
+ "---\nname: worker_a\nrole: Worker\nprovider: fake\nmodel: fake\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker.\n",
409
409
  )
410
410
  .unwrap();
411
411
  team
@@ -1,3 +1,4 @@
1
+ use super::lane_ops::assert_legacy_fork_unverified;
1
2
  use super::launch_spawn::{
2
3
  quick_start_team_dir, restart_ws_two_resumable_workers, seed_healthy_coordinator,
3
4
  DELEG_ROLE_ALPHA, DELEG_ROLE_BRAVO, QS_VALID_ROLE,
@@ -43,8 +44,8 @@ pub(super) fn lanea_team_ws(status: &str) -> PathBuf {
43
44
  &json!({
44
45
  "session_name": "team-laneateam",
45
46
  "agents": {
46
- "alpha": {"status": status, "provider": "codex", "window": "alpha"},
47
- "bravo": {"status": status, "provider": "codex", "window": "bravo"}
47
+ "alpha": {"status": status, "provider": "fake", "window": "alpha"},
48
+ "bravo": {"status": status, "provider": "fake", "window": "bravo"}
48
49
  }
49
50
  }),
50
51
  )
@@ -264,14 +265,9 @@ fn lanea_fork_agent_unknown_source_is_unknown_worker_before_session_check() {
264
265
  fn lanea_fork_agent_duplicate_target_is_already_exists_before_session_check() {
265
266
  let ws = lanea_team_ws("stopped");
266
267
  // target 'bravo' already exists in the spec -> duplicate; source 'alpha' exists (its session_id is irrelevant).
267
- let text = format!(
268
- "{:?}",
269
- fork_agent(&ws, &aid("alpha"), &aid("bravo"), None, false, None)
270
- );
271
- assert!(
272
- text.contains("unverified") || text.contains("未验证") || text.contains("refuses --as"),
273
- "codex fork is unverified in-window; duplicate --as is not reached. got {text}"
274
- );
268
+ // The legacy fork entry refuses the fake source as unverified; duplicate --as is not reached.
269
+ let result = fork_agent(&ws, &aid("alpha"), &aid("bravo"), None, false, None);
270
+ assert_legacy_fork_unverified(&result, "fake");
275
271
  }
276
272
 
277
273
  // SEAM-GATED real-machine boundary (note to porter): stop_agent / reset_agent / fork_agent must drive a
@@ -320,7 +316,7 @@ fn add_agent_joins_w2_into_running_roster_and_existing_session() {
320
316
  workspace,
321
317
  &json!({
322
318
  "session_name": "team-implteam",
323
- "agents": {"w1": {"status": "running", "provider": "codex", "window": "w1"}}
319
+ "agents": {"w1": {"status": "running", "provider": "fake", "window": "w1"}}
324
320
  }),
325
321
  )
326
322
  .unwrap();
@@ -329,7 +325,7 @@ fn add_agent_joins_w2_into_running_roster_and_existing_session() {
329
325
  let role_file = team_dir.join("w2-role.md");
330
326
  std::fs::write(
331
327
  &role_file,
332
- "---\nname: w2\nrole: Worker Two\nprovider: codex\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker two.\n",
328
+ "---\nname: w2\nrole: Worker Two\nprovider: fake\nmodel: fake\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker two.\n",
333
329
  )
334
330
  .unwrap();
335
331
  let transport = OfflineTransport::new().with_session_present(true);