@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
@@ -1,17 +1,15 @@
1
- //! #264 behavioral diff regression contracts (D1-D9).
1
+ //! #264 behavioral diff regression contracts (D4-D6, D8-D9).
2
2
  //!
3
3
  //! Source of truth: Python runtime 0.2.11 (`~/.team-agent/runtime/0.2.11/src/team_agent/`).
4
4
  //! Every asserted value below was grounded by executing the Python truth source
5
- //! (CodexAdapter.build_command / compile_system_prompt / providers.shell_command) —
5
+ //! (compile_system_prompt / providers.shell_command) —
6
6
  //! see `.team/artifacts/264-behavioral-diff-report.md` for the per-item file:line evidence.
7
+ //! D1-D3 (codex argv golden) and D7 (codex `/fast` toggle) retired with the legacy
8
+ //! Codex worker runtime.
7
9
  //!
8
- //! D1: codex developer_instructions triple escape (\\ then " then \n) — codex.py:120-121
9
- //! D2: codex MCP `-c mcp_servers.<name>.tool_timeout_sec=600.0` — codex.py:129
10
- //! D3: codex `--profile <CODEX_PROFILE>` + `-c <codex_config>` items — codex.py:105-107,117-118 / provider_env.py:62-79
11
10
  //! D4: worker shell env TEAM_AGENT_ID=<worker self> (overrides parent) — providers.py:131
12
11
  //! D5: fresh launch spawn cwd == workspace (tmux cwd + state.spawn_cwd) — providers.py:145 / launch/core.py:253
13
12
  //! D6: compiled system prompt first section is identity — prompt.py:39
14
- //! D7: runtime.fast → codex fast-mode toggle "/fast" after spawn — launch/core.py:235-237
15
13
  //! D8: launch session_name fallback = team-{name}, not a constant — launch/core.py:56
16
14
  //! D9: profile env_unset truly unsets in the worker shell line — providers.py:142-145 / provider_env.py:82-90
17
15
 
@@ -41,138 +39,6 @@ use team_agent::transport::{
41
39
  const ANCESTRY_KEY: &str = "TEAM_AGENT_TEST_PROCESS_ANCESTRY_ARGV_JSON";
42
40
  const NEUTRAL_ANCESTRY: &str = "[\"/bin/zsh\"]";
43
41
 
44
- /// D1+D2+D3: one codex argv golden locks the three codex command-construction gaps.
45
- ///
46
- /// Python golden (executed 0.2.11 CodexAdapter.build_command with the same profile values):
47
- /// `codex --no-alt-screen --disable shell_snapshot --disable apps --profile relay-fast
48
- /// --sandbox read-only --ask-for-approval on-request --model gpt-5.5
49
- /// -c model_provider="relay" -c model_providers.relay.base_url="https://relay.example/v1"
50
- /// -c model_providers.relay.env_key="TEAM_AGENT_PROVIDER_API_KEY"
51
- /// -c model_providers.relay.wire_api="chat" -c model_providers.relay.name="Relay"
52
- /// -c developer_instructions="...\n...ESCAPE-CHECK back\\slash \"dq\" end..."
53
- /// -c mcp_servers.team_orchestrator.command="..." ... -c mcp_servers.team_orchestrator.tool_timeout_sec=600.0`
54
- #[test]
55
- #[serial(env)]
56
- fn d1_d2_d3_codex_argv_matches_python_golden_escape_timeout_profile() {
57
- let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("behavioral-d123-codex");
58
- let _ancestry = EnvGuard::set(&[(ANCESTRY_KEY, NEUTRAL_ANCESTRY)]);
59
- let ws = tmp_dir("d123-codex-argv");
60
- let team_dir = write_team(
61
- &ws,
62
- &TeamFixture {
63
- name: "d123team",
64
- provider: "codex",
65
- fast: false,
66
- agents: &[AgentDoc {
67
- id: "worker_a",
68
- role: "Codex Diff Worker",
69
- provider: "codex",
70
- auth_mode: "compatible_api",
71
- model: Some("gpt-5.5"),
72
- profile: Some("relay"),
73
- tools: &["mcp_team"],
74
- body: "ESCAPE-CHECK back\\slash \"dq\" end",
75
- }],
76
- },
77
- );
78
- write_relay_profile(&team_dir);
79
- seed_healthy_coordinator(&ws);
80
- let transport = RecordingTransport::new();
81
-
82
- quick_start_with_transport_in_workspace(
83
- &ws,
84
- &team_dir,
85
- None,
86
- true,
87
- Some("d123team"),
88
- &transport,
89
- )
90
- .expect("quick-start should reach codex command construction");
91
- let spawn = transport.single_spawn();
92
- let argv = &spawn.argv;
93
- let mut failures = Vec::new();
94
-
95
- // D1: triple escape, Python order \\ -> \" -> \n (codex.py:120-121).
96
- let dev = argv
97
- .iter()
98
- .find(|arg| arg.starts_with("developer_instructions=\""));
99
- match dev {
100
- None => failures
101
- .push("D1: no `-c developer_instructions=\"...\"` value in codex argv".to_string()),
102
- Some(dev) => {
103
- if dev.contains('\n') {
104
- failures.push(format!(
105
- "D1: developer_instructions value contains RAW newlines; Python escapes them as literal \\n (codex.py:120). head={:?}",
106
- dev.chars().take(120).collect::<String>()
107
- ));
108
- }
109
- // Raw marker `ESCAPE-CHECK back\slash "dq" end` must arrive as `back\\slash \"dq\" end`.
110
- let escaped_marker = "ESCAPE-CHECK back\\\\slash \\\"dq\\\" end";
111
- if !dev.contains(escaped_marker) {
112
- failures.push(format!(
113
- "D1: developer_instructions must contain the Python-escaped marker {escaped_marker:?} (backslash doubled before quote/newline escaping)"
114
- ));
115
- }
116
- }
117
- }
118
-
119
- // D2: codex.py:129 — every MCP server gets tool_timeout_sec=600.0.
120
- let timeout_item = "mcp_servers.team_orchestrator.tool_timeout_sec=600.0";
121
- if !argv.iter().any(|arg| arg == timeout_item) {
122
- failures.push(format!("D2: codex argv missing `-c {timeout_item}`"));
123
- }
124
-
125
- // D3: profile command overrides (provider_env.py:62-79 + codex.py:105-107,117-118).
126
- if flag_value(argv, "--profile").as_deref() != Some("relay-fast") {
127
- failures.push(format!(
128
- "D3: codex argv must carry `--profile relay-fast` from profile CODEX_PROFILE; got {:?}",
129
- flag_value(argv, "--profile")
130
- ));
131
- }
132
- for config in [
133
- "model_provider=\"relay\"",
134
- "model_providers.relay.base_url=\"https://relay.example/v1\"",
135
- "model_providers.relay.env_key=\"TEAM_AGENT_PROVIDER_API_KEY\"",
136
- "model_providers.relay.wire_api=\"chat\"",
137
- "model_providers.relay.name=\"Relay\"",
138
- ] {
139
- if !argv.iter().any(|arg| arg == config) {
140
- failures.push(format!(
141
- "D3: codex argv missing `-c {config}` (profile codex_config)"
142
- ));
143
- }
144
- }
145
- // Python golden order: --profile before --sandbox; codex_config -c before developer_instructions.
146
- if let (Some(profile_idx), Some(sandbox_idx)) = (
147
- argv.iter().position(|arg| arg == "--profile"),
148
- argv.iter().position(|arg| arg == "--sandbox"),
149
- ) {
150
- if profile_idx > sandbox_idx {
151
- failures
152
- .push("D3: `--profile` must precede `--sandbox` (codex.py:105-113)".to_string());
153
- }
154
- }
155
- if let (Some(config_idx), Some(dev_idx)) = (
156
- argv.iter()
157
- .position(|arg| arg == "model_provider=\"relay\""),
158
- argv.iter()
159
- .position(|arg| arg.starts_with("developer_instructions=")),
160
- ) {
161
- if config_idx > dev_idx {
162
- failures.push(
163
- "D3: profile codex_config `-c` items must precede developer_instructions (codex.py:117-121)"
164
- .to_string(),
165
- );
166
- }
167
- }
168
-
169
- assert!(
170
- failures.is_empty(),
171
- "D1/D2/D3 codex argv contract failed:\n{}\nargv={argv:?}",
172
- failures.join("\n")
173
- );
174
- }
175
-
176
42
  /// D4: providers.py:131 — the worker shell env must export TEAM_AGENT_ID=<the worker itself>,
177
43
  /// overriding any TEAM_AGENT_ID inherited from the launching process (e.g. an add-agent issued
178
44
  /// from another worker's MCP server, whose environ carries the CALLER's TEAM_AGENT_ID).
@@ -185,7 +51,7 @@ fn d4_worker_shell_env_sets_team_agent_id_to_worker_self() {
185
51
  ("TEAM_AGENT_ID", "stale-mcp-caller"),
186
52
  ]);
187
53
  let ws = tmp_dir("d4-spawn-env");
188
- let team_dir = write_team(&ws, &simple_codex_team("d4team", "worker_a", "Env Worker"));
54
+ let team_dir = write_team(&ws, &simple_fake_team("d4team", "worker_a", "Env Worker"));
189
55
  seed_healthy_coordinator(&ws);
190
56
  let transport = RecordingTransport::new();
191
57
 
@@ -223,7 +89,7 @@ fn d5_fresh_launch_spawn_cwd_and_state_use_workspace() {
223
89
  let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("behavioral-d5-spawn-cwd");
224
90
  let _ancestry = EnvGuard::set(&[(ANCESTRY_KEY, NEUTRAL_ANCESTRY)]);
225
91
  let ws = tmp_dir("d5-spawn-cwd");
226
- let team_dir = write_team(&ws, &simple_codex_team("d5team", "worker_a", "Cwd Worker"));
92
+ let team_dir = write_team(&ws, &simple_fake_team("d5team", "worker_a", "Cwd Worker"));
227
93
  seed_healthy_coordinator(&ws);
228
94
  let transport = RecordingTransport::new();
229
95
 
@@ -269,14 +135,13 @@ fn d6_compiled_system_prompt_first_section_is_identity() {
269
135
  &ws,
270
136
  &TeamFixture {
271
137
  name: "d6team",
272
- provider: "claude",
273
- fast: false,
138
+ provider: "codex",
274
139
  agents: &[AgentDoc {
275
140
  id: "worker_a",
276
141
  role: "Prompt Order Worker",
277
- provider: "claude",
142
+ provider: "copilot",
278
143
  auth_mode: "subscription",
279
- model: Some("fake"),
144
+ model: None,
280
145
  profile: None,
281
146
  tools: &["mcp_team"],
282
147
  body: "ROLE BODY SENTINEL for prompt ordering.",
@@ -287,10 +152,16 @@ fn d6_compiled_system_prompt_first_section_is_identity() {
287
152
  let transport = RecordingTransport::new();
288
153
 
289
154
  quick_start_with_transport_in_workspace(&ws, &team_dir, None, true, Some("d6team"), &transport)
290
- .expect("quick-start should spawn the claude worker");
155
+ .expect("quick-start should spawn the copilot worker");
291
156
  let spawn = transport.single_spawn();
292
- let prompt = flag_value(&spawn.argv, "--append-system-prompt")
293
- .expect("claude argv must carry --append-system-prompt");
157
+ // Copilot receives the compiled system prompt verbatim through the per-worker
158
+ // AGENTS.md that COPILOT_CUSTOM_INSTRUCTIONS_DIRS points at (never argv).
159
+ let instructions_dir = spawn
160
+ .env
161
+ .get("COPILOT_CUSTOM_INSTRUCTIONS_DIRS")
162
+ .expect("copilot spawn env must carry COPILOT_CUSTOM_INSTRUCTIONS_DIRS");
163
+ let prompt = std::fs::read_to_string(Path::new(instructions_dir).join("AGENTS.md"))
164
+ .expect("copilot per-worker AGENTS.md must hold the compiled system prompt");
294
165
 
295
166
  let identity = "You are Team Agent worker `worker_a` with role `Prompt Order Worker`. \
296
167
  When asked about your role or identity, answer with this Team Agent worker identity first, \
@@ -310,32 +181,6 @@ chunks=[identity, TEAMMATE_SYSTEM_PROMPT, ...]; live ps confirms identity-first)
310
181
  );
311
182
  }
312
183
 
313
- /// D7: launch/core.py:235-237 — runtime.fast + provider==codex must toggle codex fast mode
314
- /// after spawn by sending `/fast` + Enter to the worker pane (tmux_prompt.py:124-129).
315
- #[test]
316
- #[serial(env)]
317
- fn d7_runtime_fast_sends_codex_fast_mode_toggle() {
318
- let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("behavioral-d7-fast-mode");
319
- let _ancestry = EnvGuard::set(&[(ANCESTRY_KEY, NEUTRAL_ANCESTRY)]);
320
- let ws = tmp_dir("d7-fast-mode");
321
- let mut fixture = simple_codex_team("d7team", "worker_a", "Fast Worker");
322
- fixture.fast = true;
323
- let team_dir = write_team(&ws, &fixture);
324
- seed_healthy_coordinator(&ws);
325
- let transport = RecordingTransport::new();
326
-
327
- quick_start_with_transport_in_workspace(&ws, &team_dir, None, true, Some("d7team"), &transport)
328
- .expect("quick-start should spawn the codex worker");
329
- transport.single_spawn();
330
- let sent = transport.sent_text();
331
- assert!(
332
- sent.iter().any(|text| text.contains("/fast")),
333
- "D7: TEAM.md `fast: true` (compiled to runtime.fast) must send the `/fast` toggle to the \
334
- codex worker after spawn (Python launch/core.py:235-237 + tmux_prompt.py:124-129); recorded \
335
- keystrokes/injections={sent:?}"
336
- );
337
- }
338
-
339
184
  /// D8: launch/core.py:56 — when the spec carries no runtime.session_name, the session falls
340
185
  /// back to `team-{team.name}`, never a fixed constant.
341
186
  #[test]
@@ -345,7 +190,7 @@ fn d8_launch_session_name_fallback_derives_from_team_name() {
345
190
  let ws = tmp_dir("d8-session-name");
346
191
  let team_dir = write_team(
347
192
  &ws,
348
- &simple_codex_team("d8team", "worker_a", "Session Worker"),
193
+ &simple_fake_team("d8team", "worker_a", "Session Worker"),
349
194
  );
350
195
  let spec = team_agent::compiler::compile_team(&team_dir).expect("compile fixture team");
351
196
  let spec_text = team_agent::model::yaml::dumps(&spec);
@@ -373,8 +218,8 @@ not a constant; argv={:?}",
373
218
  );
374
219
  }
375
220
 
376
- /// D9: provider_env.py:82-90 + providers.py:142-145 — profile env_unset keys (codex
377
- /// compatible_api → OPENAI_API_KEY / OPENAI_BASE_URL) must be REALLY unset in the worker
221
+ /// D9: provider_env.py:82-90 + providers.py:142-145 — profile env_unset keys (gemini_cli
222
+ /// compatible_api → GEMINI_API_KEY) must be REALLY unset in the worker
378
223
  /// shell line (Python sources the env file whose first lines are `unset <KEY>`), because the
379
224
  /// tmux server environment can still carry stale values that plain map-removal cannot clear.
380
225
  #[test]
@@ -382,7 +227,7 @@ not a constant; argv={:?}",
382
227
  fn d9_profile_env_unset_reaches_worker_shell_line() {
383
228
  let _guard = EnvGuard::set(&[
384
229
  (ANCESTRY_KEY, NEUTRAL_ANCESTRY),
385
- ("OPENAI_API_KEY", "stale-parent-key"),
230
+ ("GEMINI_API_KEY", "stale-parent-key"),
386
231
  ]);
387
232
  let ws = tmp_dir("d9-env-unset");
388
233
  let team_dir = write_team(
@@ -390,20 +235,19 @@ fn d9_profile_env_unset_reaches_worker_shell_line() {
390
235
  &TeamFixture {
391
236
  name: "d9team",
392
237
  provider: "codex",
393
- fast: false,
394
238
  agents: &[AgentDoc {
395
239
  id: "worker_a",
396
240
  role: "Unset Worker",
397
- provider: "codex",
241
+ provider: "gemini_cli",
398
242
  auth_mode: "compatible_api",
399
- model: Some("gpt-5.5"),
243
+ model: Some("gemini-2.5-pro"),
400
244
  profile: Some("relay-nokey"),
401
245
  tools: &["mcp_team"],
402
246
  body: "Unset worker.",
403
247
  }],
404
248
  },
405
249
  );
406
- // No API_KEY on purpose: OPENAI_API_KEY lands in env_unset (provider_env.py:51-52) and is
250
+ // No API_KEY on purpose: GEMINI_API_KEY lands in env_unset (provider_env.py:51-52) and is
407
251
  // never re-exported, so the stale tmux-server/parent value leaks unless the shell really
408
252
  // unsets it. (With API_KEY present the overlay re-export would mask the missing unset.)
409
253
  let profiles = team_dir.join("profiles");
@@ -437,17 +281,17 @@ fn d9_profile_env_unset_reaches_worker_shell_line() {
437
281
  let env_file = ws.join(".team/runtime/provider-env/worker_a.env");
438
282
  let mut failures = Vec::new();
439
283
  let env_file_text = std::fs::read_to_string(&env_file).unwrap_or_default();
440
- if !env_file_text.contains("unset OPENAI_API_KEY") {
284
+ if !env_file_text.contains("unset GEMINI_API_KEY") {
441
285
  failures.push(format!(
442
- "D9: provider env file must contain `unset OPENAI_API_KEY` (Python provider_env.py:86); path={} content={env_file_text:?}",
286
+ "D9: provider env file must contain `unset GEMINI_API_KEY` (Python provider_env.py:86); path={} content={env_file_text:?}",
443
287
  env_file.display()
444
288
  ));
445
289
  }
446
- let unsets_inline = shell_line.contains("unset OPENAI_API_KEY");
290
+ let unsets_inline = shell_line.contains("unset GEMINI_API_KEY");
447
291
  let sources_env_file = shell_line.contains(&*env_file.to_string_lossy());
448
292
  if !(unsets_inline || sources_env_file) {
449
293
  failures.push(format!(
450
- "D9: worker shell line must really unset OPENAI_API_KEY — either inline `unset OPENAI_API_KEY` \
294
+ "D9: worker shell line must really unset GEMINI_API_KEY — either inline `unset GEMINI_API_KEY` \
451
295
  or by sourcing the env file `{}` before exec (Python providers.py:142-145); shell_line={shell_line:?}",
452
296
  env_file.display()
453
297
  ));
@@ -466,7 +310,6 @@ or by sourcing the env file `{}` before exec (Python providers.py:142-145); shel
466
310
  struct TeamFixture<'a> {
467
311
  name: &'a str,
468
312
  provider: &'a str,
469
- fast: bool,
470
313
  agents: &'a [AgentDoc<'a>],
471
314
  }
472
315
 
@@ -481,7 +324,7 @@ struct AgentDoc<'a> {
481
324
  body: &'a str,
482
325
  }
483
326
 
484
- fn simple_codex_team(
327
+ fn simple_fake_team(
485
328
  name: &'static str,
486
329
  agent: &'static str,
487
330
  role: &'static str,
@@ -489,9 +332,9 @@ fn simple_codex_team(
489
332
  let agents: &'static [AgentDoc<'static>] = Box::leak(Box::new([AgentDoc {
490
333
  id: agent,
491
334
  role,
492
- provider: "codex",
335
+ provider: "fake",
493
336
  auth_mode: "subscription",
494
- model: Some("gpt-5.5"),
337
+ model: Some("fake"),
495
338
  profile: None,
496
339
  tools: &["mcp_team"],
497
340
  body: Box::leak(format!("{role}.").into_boxed_str()),
@@ -499,7 +342,6 @@ fn simple_codex_team(
499
342
  TeamFixture {
500
343
  name,
501
344
  provider: "codex",
502
- fast: false,
503
345
  agents,
504
346
  }
505
347
  }
@@ -507,11 +349,10 @@ fn simple_codex_team(
507
349
  fn write_team(workspace: &Path, fixture: &TeamFixture<'_>) -> PathBuf {
508
350
  let team = workspace.join(fixture.name);
509
351
  std::fs::create_dir_all(team.join("agents")).unwrap();
510
- let fast = if fixture.fast { "fast: true\n" } else { "" };
511
352
  std::fs::write(
512
353
  team.join("TEAM.md"),
513
354
  format!(
514
- "---\nname: {}\nobjective: 264 behavioral diff fixture.\nprovider: {}\n{fast}---\n\nTeam fixture.\n",
355
+ "---\nname: {}\nobjective: 264 behavioral diff fixture.\nprovider: {}\n---\n\nTeam fixture.\n",
515
356
  fixture.name, fixture.provider
516
357
  ),
517
358
  )
@@ -542,24 +383,6 @@ fn write_team(workspace: &Path, fixture: &TeamFixture<'_>) -> PathBuf {
542
383
  team
543
384
  }
544
385
 
545
- /// Profile values mirror the Python golden run: provider_env.py:62-79 turns these into
546
- /// codex_profile=relay-fast plus the five `-c` codex_config items asserted in D3.
547
- fn write_relay_profile(team_dir: &Path) {
548
- let profiles = team_dir.join("profiles");
549
- std::fs::create_dir_all(&profiles).unwrap();
550
- std::fs::write(
551
- profiles.join("relay.env"),
552
- "AUTH_MODE=compatible_api\n\
553
- BASE_URL=https://relay.example/v1\n\
554
- API_KEY=sk-relay-264\n\
555
- MODEL_PROVIDER=relay\n\
556
- WIRE_API=chat\n\
557
- PROVIDER_NAME=Relay\n\
558
- CODEX_PROFILE=relay-fast\n",
559
- )
560
- .unwrap();
561
- }
562
-
563
386
  fn seed_healthy_coordinator(workspace: &Path) {
564
387
  let workspace = team_agent::coordinator::WorkspacePath::new(workspace.to_path_buf());
565
388
  let pid = team_agent::coordinator::Pid::new(std::process::id());
@@ -594,11 +417,6 @@ fn tmp_dir(tag: &str) -> PathBuf {
594
417
  std::fs::canonicalize(dir).unwrap()
595
418
  }
596
419
 
597
- fn flag_value(argv: &[String], flag: &str) -> Option<String> {
598
- argv.windows(2)
599
- .find_map(|pair| (pair[0] == flag).then(|| pair[1].clone()))
600
- }
601
-
602
420
  struct EnvGuard {
603
421
  previous: Vec<(&'static str, Option<String>)>,
604
422
  }
@@ -628,7 +446,7 @@ impl Drop for EnvGuard {
628
446
  }
629
447
 
630
448
  // ---------------------------------------------------------------------------
631
- // recording transport (argv + env + cwd + session + keystrokes)
449
+ // recording transport (argv + env + cwd + session)
632
450
  // ---------------------------------------------------------------------------
633
451
 
634
452
  #[derive(Debug, Clone)]
@@ -642,7 +460,6 @@ struct RecordedSpawn {
642
460
  #[derive(Default)]
643
461
  struct RecordingTransport {
644
462
  spawns: Mutex<Vec<RecordedSpawn>>,
645
- sent_text: Mutex<Vec<String>>,
646
463
  session_present: Mutex<bool>,
647
464
  }
648
465
 
@@ -661,10 +478,6 @@ impl RecordingTransport {
661
478
  spawns[0].clone()
662
479
  }
663
480
 
664
- fn sent_text(&self) -> Vec<String> {
665
- self.sent_text.lock().unwrap().clone()
666
- }
667
-
668
481
  fn record_spawn(
669
482
  &self,
670
483
  session: &SessionName,
@@ -720,13 +533,10 @@ impl Transport for RecordingTransport {
720
533
  fn inject(
721
534
  &self,
722
535
  _target: &Target,
723
- payload: &InjectPayload,
536
+ _payload: &InjectPayload,
724
537
  _submit: Key,
725
538
  _bracketed: bool,
726
539
  ) -> Result<InjectReport, TransportError> {
727
- if let Some(text) = payload.text() {
728
- self.sent_text.lock().unwrap().push(text.to_string());
729
- }
730
540
  Ok(InjectReport {
731
541
  stage_reached: InjectStage::Submit,
732
542
  inject_verification: InjectVerification::CaptureContainsToken,
@@ -737,16 +547,7 @@ impl Transport for RecordingTransport {
737
547
  })
738
548
  }
739
549
 
740
- fn send_keys(&self, _target: &Target, keys: &[Key]) -> Result<(), TransportError> {
741
- let text: String = keys
742
- .iter()
743
- .map(|key| match key {
744
- Key::Char(c) => *c,
745
- Key::Enter => '\n',
746
- _ => '\u{FFFD}',
747
- })
748
- .collect();
749
- self.sent_text.lock().unwrap().push(text);
550
+ fn send_keys(&self, _target: &Target, _keys: &[Key]) -> Result<(), TransportError> {
750
551
  Ok(())
751
552
  }
752
553
 
@@ -755,8 +556,9 @@ impl Transport for RecordingTransport {
755
556
  _target: &Target,
756
557
  range: CaptureRange,
757
558
  ) -> Result<CapturedText, TransportError> {
559
+ // A ready Copilot screen ends the D6 startup-trust poll immediately.
758
560
  Ok(CapturedText {
759
- text: "Claude Code\n> \nOpenAI Codex\ncodex>".to_string(),
561
+ text: team_agent::provider::COPILOT_READY_MARKER.to_string(),
760
562
  range,
761
563
  })
762
564
  }