@team-agent/installer 0.5.126 → 0.5.128
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/README.md +11 -0
- package/crates/team-agent/src/cli/adapters.rs +3 -13
- package/crates/team-agent/src/cli/arguments.rs +4 -0
- package/crates/team-agent/src/cli/diagnose.rs +68 -91
- package/crates/team-agent/src/cli/emit.rs +61 -28
- package/crates/team-agent/src/cli/grok_slot.rs +88 -3
- package/crates/team-agent/src/cli/intent/runtime.rs +38 -9
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +147 -11
- package/crates/team-agent/src/cli/intent/tests.rs +10 -12
- package/crates/team-agent/src/cli/intent.rs +1 -1
- package/crates/team-agent/src/cli/mod.rs +38 -9
- package/crates/team-agent/src/cli/models.rs +789 -186
- package/crates/team-agent/src/cli/schedule.rs +175 -0
- package/crates/team-agent/src/cli/send/persist.rs +0 -36
- package/crates/team-agent/src/cli/send/presentation.rs +1 -1
- package/crates/team-agent/src/cli/send.rs +108 -110
- package/crates/team-agent/src/cli/spec.rs +6 -0
- package/crates/team-agent/src/cli/status_port/brief.rs +5 -67
- package/crates/team-agent/src/cli/tests/leader_watch.rs +12 -62
- package/crates/team-agent/src/cli/tests/mod.rs +3 -3
- package/crates/team-agent/src/cli/tests/named_address.rs +11 -10
- package/crates/team-agent/src/cli/tests/run_delegation.rs +12 -9
- package/crates/team-agent/src/cli/tests/status_send.rs +70 -273
- package/crates/team-agent/src/compiler/tests.rs +39 -27
- package/crates/team-agent/src/compiler.rs +206 -6
- package/crates/team-agent/src/contract_runtime/backend.rs +181 -11
- package/crates/team-agent/src/contract_runtime/commands.rs +338 -7
- package/crates/team-agent/src/contract_runtime/config.rs +30 -19
- package/crates/team-agent/src/contract_runtime/config_tests.rs +24 -4
- package/crates/team-agent/src/contract_runtime/discovery.rs +12 -1
- package/crates/team-agent/src/contract_runtime/fork.rs +3 -10
- package/crates/team-agent/src/contract_runtime/framework.rs +28 -14
- package/crates/team-agent/src/contract_runtime/mcp.rs +19 -24
- package/crates/team-agent/src/contract_runtime/prompt.rs +2 -2
- package/crates/team-agent/src/contract_runtime/registry.rs +93 -130
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +45 -5
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +8 -29
- package/crates/team-agent/src/coordinator/tests/energy.rs +4 -4
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +44 -2
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/coordinator/tests/spine.rs +1 -1
- package/crates/team-agent/src/coordinator/tests/takeover.rs +3 -3
- package/crates/team-agent/src/coordinator/tick.rs +1 -89
- package/crates/team-agent/src/db/message_store.rs +7 -65
- package/crates/team-agent/src/direct_delivery.rs +368 -0
- package/crates/team-agent/src/inbox_store.rs +169 -0
- package/crates/team-agent/src/leader/registry.rs +5 -0
- package/crates/team-agent/src/leader/start.rs +2 -1
- package/crates/team-agent/src/leader/tests/lease_api.rs +2 -2
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +1 -0
- package/crates/team-agent/src/lib.rs +2 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +33 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +206 -1
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +28 -2
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +36 -179
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +87 -6
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +13 -488
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +351 -81
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +3 -4
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +26 -2
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +41 -31
- package/crates/team-agent/src/lifecycle/launch.rs +27 -12
- package/crates/team-agent/src/lifecycle/profile_launch.rs +318 -64
- package/crates/team-agent/src/lifecycle/restart/agent.rs +1 -0
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +1798 -0
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +163 -0
- package/crates/team-agent/src/lifecycle/restart/common.rs +298 -133
- 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 +4 -0
- package/crates/team-agent/src/lifecycle/role_config.rs +79 -27
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +1 -1
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +8 -12
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +37 -240
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +325 -0
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +320 -8
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +329 -70
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +378 -4
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +25 -39
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +7 -11
- package/crates/team-agent/src/lifecycle/tests/core.rs +39 -36
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +22 -8
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +2 -1
- 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 +60 -20
- 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 +164 -282
- 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/mcp_tool_name_format_red.rs +6 -6
- 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 +18 -6
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +70 -52
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +210 -0
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +157 -4
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +526 -10
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +1419 -0
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +68 -1
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +34 -12
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +94 -2
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +14 -15
- package/crates/team-agent/src/lifecycle/tests/restart.rs +12 -153
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +27 -5
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +59 -10
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +47 -6
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +3 -1374
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +27 -10
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +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 +254 -2
- 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 +38 -39
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +51 -88
- package/crates/team-agent/src/lifecycle/tests.rs +3 -4
- package/crates/team-agent/src/lifecycle/types.rs +18 -5
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +43 -50
- package/crates/team-agent/src/mcp_server/readiness.rs +130 -149
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +86 -109
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +21 -31
- package/crates/team-agent/src/mcp_server/tests/send.rs +72 -107
- package/crates/team-agent/src/mcp_server/tests/tools.rs +10 -12
- package/crates/team-agent/src/mcp_server/tools.rs +70 -196
- package/crates/team-agent/src/messaging/delivery.rs +143 -253
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- package/crates/team-agent/src/messaging/helpers.rs +1 -19
- package/crates/team-agent/src/messaging/mod.rs +1 -0
- package/crates/team-agent/src/messaging/reminders.rs +316 -0
- package/crates/team-agent/src/messaging/scheduler.rs +7 -1
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +255 -150
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/messaging/tests/runtime.rs +9 -115
- package/crates/team-agent/src/messaging/tests/spine.rs +44 -24
- package/crates/team-agent/src/messaging/tests/wave2.rs +13 -20
- package/crates/team-agent/src/messaging/types.rs +1 -0
- package/crates/team-agent/src/provider/adapter.rs +208 -254
- package/crates/team-agent/src/provider/adapters/claude.rs +78 -0
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +131 -0
- package/crates/team-agent/src/provider/adapters/mod.rs +7 -7
- package/crates/team-agent/src/provider/adapters/pi.rs +106 -0
- package/crates/team-agent/src/provider/classify.rs +1 -66
- package/crates/team-agent/src/provider/model_catalog.rs +201 -13
- package/crates/team-agent/src/provider/session/capture.rs +111 -111
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +123 -0
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +10 -18
- package/crates/team-agent/src/provider/session/context_fork.rs +87 -74
- package/crates/team-agent/src/provider/session/mod.rs +2 -3
- package/crates/team-agent/src/provider/session_scan/claude.rs +523 -0
- package/crates/team-agent/src/provider/session_scan/common.rs +47 -47
- package/crates/team-agent/src/provider/session_scan/pi.rs +34 -1
- package/crates/team-agent/src/provider/session_scan.rs +13 -13
- package/crates/team-agent/src/provider/tests/adapter.rs +127 -121
- package/crates/team-agent/src/provider/tests/classify.rs +0 -53
- package/crates/team-agent/src/provider/tests/command_helpers.rs +11 -19
- package/crates/team-agent/src/provider/tests/idle.rs +13 -19
- package/crates/team-agent/src/provider/types.rs +0 -4
- package/crates/team-agent/src/provider/wire.rs +34 -20
- 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/projection.rs +1 -1
- package/crates/team-agent/src/state/repository/tests.rs +2 -2
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +144 -0
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -151
- package/crates/team-agent/src/tmux_backend.rs +9 -43
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +7 -8
- package/skills/team-agent/command-coverage.json +15 -1
- package/skills/team-agent/docs/reference/team-agent-operator.md +5 -3
- package/skills/team-agent/references/team-agent-operator.md +5 -3
- package/crates/team-agent/src/lifecycle/launch/grok_per_seat.rs +0 -260
- package/crates/team-agent/src/lifecycle/tests/codex_weak_window_attribution_red.rs +0 -683
- package/crates/team-agent/src/lifecycle/tests/grok_effort_argv_red.rs +0 -247
- package/crates/team-agent/src/lifecycle/tests/grok_mcp_overlay_red.rs +0 -507
- package/crates/team-agent/src/lifecycle/tests/grok_restart_resume_red.rs +0 -300
- package/crates/team-agent/src/provider/adapters/codex.rs +0 -101
- package/crates/team-agent/src/provider/adapters/grok.rs +0 -67
- package/crates/team-agent/src/provider/session/context_fork/codex.rs +0 -514
- package/crates/team-agent/src/provider/session_scan/codex.rs +0 -326
- package/crates/team-agent/src/provider/session_scan/grok.rs +0 -288
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
//! #264 behavioral diff regression contracts (
|
|
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
|
-
//! (
|
|
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, &
|
|
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, &
|
|
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
|
|
|
@@ -270,13 +136,12 @@ fn d6_compiled_system_prompt_first_section_is_identity() {
|
|
|
270
136
|
&TeamFixture {
|
|
271
137
|
name: "d6team",
|
|
272
138
|
provider: "codex",
|
|
273
|
-
fast: false,
|
|
274
139
|
agents: &[AgentDoc {
|
|
275
140
|
id: "worker_a",
|
|
276
141
|
role: "Prompt Order Worker",
|
|
277
|
-
provider: "
|
|
142
|
+
provider: "copilot",
|
|
278
143
|
auth_mode: "subscription",
|
|
279
|
-
model:
|
|
144
|
+
model: None,
|
|
280
145
|
profile: None,
|
|
281
146
|
tools: &["mcp_team"],
|
|
282
147
|
body: "ROLE BODY SENTINEL for prompt ordering.",
|
|
@@ -287,15 +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
|
|
155
|
+
.expect("quick-start should spawn the copilot worker");
|
|
291
156
|
let spawn = transport.single_spawn();
|
|
292
|
-
//
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
.
|
|
296
|
-
.
|
|
297
|
-
.expect("
|
|
298
|
-
|
|
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");
|
|
299
165
|
|
|
300
166
|
let identity = "You are Team Agent worker `worker_a` with role `Prompt Order Worker`. \
|
|
301
167
|
When asked about your role or identity, answer with this Team Agent worker identity first, \
|
|
@@ -315,32 +181,6 @@ chunks=[identity, TEAMMATE_SYSTEM_PROMPT, ...]; live ps confirms identity-first)
|
|
|
315
181
|
);
|
|
316
182
|
}
|
|
317
183
|
|
|
318
|
-
/// D7: launch/core.py:235-237 — runtime.fast + provider==codex must toggle codex fast mode
|
|
319
|
-
/// after spawn by sending `/fast` + Enter to the worker pane (tmux_prompt.py:124-129).
|
|
320
|
-
#[test]
|
|
321
|
-
#[serial(env)]
|
|
322
|
-
fn d7_runtime_fast_sends_codex_fast_mode_toggle() {
|
|
323
|
-
let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("behavioral-d7-fast-mode");
|
|
324
|
-
let _ancestry = EnvGuard::set(&[(ANCESTRY_KEY, NEUTRAL_ANCESTRY)]);
|
|
325
|
-
let ws = tmp_dir("d7-fast-mode");
|
|
326
|
-
let mut fixture = simple_codex_team("d7team", "worker_a", "Fast Worker");
|
|
327
|
-
fixture.fast = true;
|
|
328
|
-
let team_dir = write_team(&ws, &fixture);
|
|
329
|
-
seed_healthy_coordinator(&ws);
|
|
330
|
-
let transport = RecordingTransport::new();
|
|
331
|
-
|
|
332
|
-
quick_start_with_transport_in_workspace(&ws, &team_dir, None, true, Some("d7team"), &transport)
|
|
333
|
-
.expect("quick-start should spawn the codex worker");
|
|
334
|
-
transport.single_spawn();
|
|
335
|
-
let sent = transport.sent_text();
|
|
336
|
-
assert!(
|
|
337
|
-
sent.iter().any(|text| text.contains("/fast")),
|
|
338
|
-
"D7: TEAM.md `fast: true` (compiled to runtime.fast) must send the `/fast` toggle to the \
|
|
339
|
-
codex worker after spawn (Python launch/core.py:235-237 + tmux_prompt.py:124-129); recorded \
|
|
340
|
-
keystrokes/injections={sent:?}"
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
184
|
/// D8: launch/core.py:56 — when the spec carries no runtime.session_name, the session falls
|
|
345
185
|
/// back to `team-{team.name}`, never a fixed constant.
|
|
346
186
|
#[test]
|
|
@@ -350,7 +190,7 @@ fn d8_launch_session_name_fallback_derives_from_team_name() {
|
|
|
350
190
|
let ws = tmp_dir("d8-session-name");
|
|
351
191
|
let team_dir = write_team(
|
|
352
192
|
&ws,
|
|
353
|
-
&
|
|
193
|
+
&simple_fake_team("d8team", "worker_a", "Session Worker"),
|
|
354
194
|
);
|
|
355
195
|
let spec = team_agent::compiler::compile_team(&team_dir).expect("compile fixture team");
|
|
356
196
|
let spec_text = team_agent::model::yaml::dumps(&spec);
|
|
@@ -378,8 +218,8 @@ not a constant; argv={:?}",
|
|
|
378
218
|
);
|
|
379
219
|
}
|
|
380
220
|
|
|
381
|
-
/// D9: provider_env.py:82-90 + providers.py:142-145 — profile env_unset keys (
|
|
382
|
-
/// compatible_api →
|
|
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
|
|
383
223
|
/// shell line (Python sources the env file whose first lines are `unset <KEY>`), because the
|
|
384
224
|
/// tmux server environment can still carry stale values that plain map-removal cannot clear.
|
|
385
225
|
#[test]
|
|
@@ -387,7 +227,7 @@ not a constant; argv={:?}",
|
|
|
387
227
|
fn d9_profile_env_unset_reaches_worker_shell_line() {
|
|
388
228
|
let _guard = EnvGuard::set(&[
|
|
389
229
|
(ANCESTRY_KEY, NEUTRAL_ANCESTRY),
|
|
390
|
-
("
|
|
230
|
+
("GEMINI_API_KEY", "stale-parent-key"),
|
|
391
231
|
]);
|
|
392
232
|
let ws = tmp_dir("d9-env-unset");
|
|
393
233
|
let team_dir = write_team(
|
|
@@ -395,20 +235,19 @@ fn d9_profile_env_unset_reaches_worker_shell_line() {
|
|
|
395
235
|
&TeamFixture {
|
|
396
236
|
name: "d9team",
|
|
397
237
|
provider: "codex",
|
|
398
|
-
fast: false,
|
|
399
238
|
agents: &[AgentDoc {
|
|
400
239
|
id: "worker_a",
|
|
401
240
|
role: "Unset Worker",
|
|
402
|
-
provider: "
|
|
241
|
+
provider: "gemini_cli",
|
|
403
242
|
auth_mode: "compatible_api",
|
|
404
|
-
model: Some("
|
|
243
|
+
model: Some("gemini-2.5-pro"),
|
|
405
244
|
profile: Some("relay-nokey"),
|
|
406
245
|
tools: &["mcp_team"],
|
|
407
246
|
body: "Unset worker.",
|
|
408
247
|
}],
|
|
409
248
|
},
|
|
410
249
|
);
|
|
411
|
-
// No API_KEY on purpose:
|
|
250
|
+
// No API_KEY on purpose: GEMINI_API_KEY lands in env_unset (provider_env.py:51-52) and is
|
|
412
251
|
// never re-exported, so the stale tmux-server/parent value leaks unless the shell really
|
|
413
252
|
// unsets it. (With API_KEY present the overlay re-export would mask the missing unset.)
|
|
414
253
|
let profiles = team_dir.join("profiles");
|
|
@@ -442,17 +281,17 @@ fn d9_profile_env_unset_reaches_worker_shell_line() {
|
|
|
442
281
|
let env_file = ws.join(".team/runtime/provider-env/worker_a.env");
|
|
443
282
|
let mut failures = Vec::new();
|
|
444
283
|
let env_file_text = std::fs::read_to_string(&env_file).unwrap_or_default();
|
|
445
|
-
if !env_file_text.contains("unset
|
|
284
|
+
if !env_file_text.contains("unset GEMINI_API_KEY") {
|
|
446
285
|
failures.push(format!(
|
|
447
|
-
"D9: provider env file must contain `unset
|
|
286
|
+
"D9: provider env file must contain `unset GEMINI_API_KEY` (Python provider_env.py:86); path={} content={env_file_text:?}",
|
|
448
287
|
env_file.display()
|
|
449
288
|
));
|
|
450
289
|
}
|
|
451
|
-
let unsets_inline = shell_line.contains("unset
|
|
290
|
+
let unsets_inline = shell_line.contains("unset GEMINI_API_KEY");
|
|
452
291
|
let sources_env_file = shell_line.contains(&*env_file.to_string_lossy());
|
|
453
292
|
if !(unsets_inline || sources_env_file) {
|
|
454
293
|
failures.push(format!(
|
|
455
|
-
"D9: worker shell line must really unset
|
|
294
|
+
"D9: worker shell line must really unset GEMINI_API_KEY — either inline `unset GEMINI_API_KEY` \
|
|
456
295
|
or by sourcing the env file `{}` before exec (Python providers.py:142-145); shell_line={shell_line:?}",
|
|
457
296
|
env_file.display()
|
|
458
297
|
));
|
|
@@ -471,7 +310,6 @@ or by sourcing the env file `{}` before exec (Python providers.py:142-145); shel
|
|
|
471
310
|
struct TeamFixture<'a> {
|
|
472
311
|
name: &'a str,
|
|
473
312
|
provider: &'a str,
|
|
474
|
-
fast: bool,
|
|
475
313
|
agents: &'a [AgentDoc<'a>],
|
|
476
314
|
}
|
|
477
315
|
|
|
@@ -486,7 +324,7 @@ struct AgentDoc<'a> {
|
|
|
486
324
|
body: &'a str,
|
|
487
325
|
}
|
|
488
326
|
|
|
489
|
-
fn
|
|
327
|
+
fn simple_fake_team(
|
|
490
328
|
name: &'static str,
|
|
491
329
|
agent: &'static str,
|
|
492
330
|
role: &'static str,
|
|
@@ -494,9 +332,9 @@ fn simple_codex_team(
|
|
|
494
332
|
let agents: &'static [AgentDoc<'static>] = Box::leak(Box::new([AgentDoc {
|
|
495
333
|
id: agent,
|
|
496
334
|
role,
|
|
497
|
-
provider: "
|
|
335
|
+
provider: "fake",
|
|
498
336
|
auth_mode: "subscription",
|
|
499
|
-
model: Some("
|
|
337
|
+
model: Some("fake"),
|
|
500
338
|
profile: None,
|
|
501
339
|
tools: &["mcp_team"],
|
|
502
340
|
body: Box::leak(format!("{role}.").into_boxed_str()),
|
|
@@ -504,7 +342,6 @@ fn simple_codex_team(
|
|
|
504
342
|
TeamFixture {
|
|
505
343
|
name,
|
|
506
344
|
provider: "codex",
|
|
507
|
-
fast: false,
|
|
508
345
|
agents,
|
|
509
346
|
}
|
|
510
347
|
}
|
|
@@ -512,11 +349,10 @@ fn simple_codex_team(
|
|
|
512
349
|
fn write_team(workspace: &Path, fixture: &TeamFixture<'_>) -> PathBuf {
|
|
513
350
|
let team = workspace.join(fixture.name);
|
|
514
351
|
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
515
|
-
let fast = if fixture.fast { "fast: true\n" } else { "" };
|
|
516
352
|
std::fs::write(
|
|
517
353
|
team.join("TEAM.md"),
|
|
518
354
|
format!(
|
|
519
|
-
"---\nname: {}\nobjective: 264 behavioral diff fixture.\nprovider: {}\n
|
|
355
|
+
"---\nname: {}\nobjective: 264 behavioral diff fixture.\nprovider: {}\n---\n\nTeam fixture.\n",
|
|
520
356
|
fixture.name, fixture.provider
|
|
521
357
|
),
|
|
522
358
|
)
|
|
@@ -547,24 +383,6 @@ fn write_team(workspace: &Path, fixture: &TeamFixture<'_>) -> PathBuf {
|
|
|
547
383
|
team
|
|
548
384
|
}
|
|
549
385
|
|
|
550
|
-
/// Profile values mirror the Python golden run: provider_env.py:62-79 turns these into
|
|
551
|
-
/// codex_profile=relay-fast plus the five `-c` codex_config items asserted in D3.
|
|
552
|
-
fn write_relay_profile(team_dir: &Path) {
|
|
553
|
-
let profiles = team_dir.join("profiles");
|
|
554
|
-
std::fs::create_dir_all(&profiles).unwrap();
|
|
555
|
-
std::fs::write(
|
|
556
|
-
profiles.join("relay.env"),
|
|
557
|
-
"AUTH_MODE=compatible_api\n\
|
|
558
|
-
BASE_URL=https://relay.example/v1\n\
|
|
559
|
-
API_KEY=sk-relay-264\n\
|
|
560
|
-
MODEL_PROVIDER=relay\n\
|
|
561
|
-
WIRE_API=chat\n\
|
|
562
|
-
PROVIDER_NAME=Relay\n\
|
|
563
|
-
CODEX_PROFILE=relay-fast\n",
|
|
564
|
-
)
|
|
565
|
-
.unwrap();
|
|
566
|
-
}
|
|
567
|
-
|
|
568
386
|
fn seed_healthy_coordinator(workspace: &Path) {
|
|
569
387
|
let workspace = team_agent::coordinator::WorkspacePath::new(workspace.to_path_buf());
|
|
570
388
|
let pid = team_agent::coordinator::Pid::new(std::process::id());
|
|
@@ -599,11 +417,6 @@ fn tmp_dir(tag: &str) -> PathBuf {
|
|
|
599
417
|
std::fs::canonicalize(dir).unwrap()
|
|
600
418
|
}
|
|
601
419
|
|
|
602
|
-
fn flag_value(argv: &[String], flag: &str) -> Option<String> {
|
|
603
|
-
argv.windows(2)
|
|
604
|
-
.find_map(|pair| (pair[0] == flag).then(|| pair[1].clone()))
|
|
605
|
-
}
|
|
606
|
-
|
|
607
420
|
struct EnvGuard {
|
|
608
421
|
previous: Vec<(&'static str, Option<String>)>,
|
|
609
422
|
}
|
|
@@ -633,7 +446,7 @@ impl Drop for EnvGuard {
|
|
|
633
446
|
}
|
|
634
447
|
|
|
635
448
|
// ---------------------------------------------------------------------------
|
|
636
|
-
// recording transport (argv + env + cwd + session
|
|
449
|
+
// recording transport (argv + env + cwd + session)
|
|
637
450
|
// ---------------------------------------------------------------------------
|
|
638
451
|
|
|
639
452
|
#[derive(Debug, Clone)]
|
|
@@ -647,7 +460,6 @@ struct RecordedSpawn {
|
|
|
647
460
|
#[derive(Default)]
|
|
648
461
|
struct RecordingTransport {
|
|
649
462
|
spawns: Mutex<Vec<RecordedSpawn>>,
|
|
650
|
-
sent_text: Mutex<Vec<String>>,
|
|
651
463
|
session_present: Mutex<bool>,
|
|
652
464
|
}
|
|
653
465
|
|
|
@@ -666,10 +478,6 @@ impl RecordingTransport {
|
|
|
666
478
|
spawns[0].clone()
|
|
667
479
|
}
|
|
668
480
|
|
|
669
|
-
fn sent_text(&self) -> Vec<String> {
|
|
670
|
-
self.sent_text.lock().unwrap().clone()
|
|
671
|
-
}
|
|
672
|
-
|
|
673
481
|
fn record_spawn(
|
|
674
482
|
&self,
|
|
675
483
|
session: &SessionName,
|
|
@@ -725,13 +533,10 @@ impl Transport for RecordingTransport {
|
|
|
725
533
|
fn inject(
|
|
726
534
|
&self,
|
|
727
535
|
_target: &Target,
|
|
728
|
-
|
|
536
|
+
_payload: &InjectPayload,
|
|
729
537
|
_submit: Key,
|
|
730
538
|
_bracketed: bool,
|
|
731
539
|
) -> Result<InjectReport, TransportError> {
|
|
732
|
-
if let Some(text) = payload.text() {
|
|
733
|
-
self.sent_text.lock().unwrap().push(text.to_string());
|
|
734
|
-
}
|
|
735
540
|
Ok(InjectReport {
|
|
736
541
|
stage_reached: InjectStage::Submit,
|
|
737
542
|
inject_verification: InjectVerification::CaptureContainsToken,
|
|
@@ -742,16 +547,7 @@ impl Transport for RecordingTransport {
|
|
|
742
547
|
})
|
|
743
548
|
}
|
|
744
549
|
|
|
745
|
-
fn send_keys(&self, _target: &Target,
|
|
746
|
-
let text: String = keys
|
|
747
|
-
.iter()
|
|
748
|
-
.map(|key| match key {
|
|
749
|
-
Key::Char(c) => *c,
|
|
750
|
-
Key::Enter => '\n',
|
|
751
|
-
_ => '\u{FFFD}',
|
|
752
|
-
})
|
|
753
|
-
.collect();
|
|
754
|
-
self.sent_text.lock().unwrap().push(text);
|
|
550
|
+
fn send_keys(&self, _target: &Target, _keys: &[Key]) -> Result<(), TransportError> {
|
|
755
551
|
Ok(())
|
|
756
552
|
}
|
|
757
553
|
|
|
@@ -760,8 +556,9 @@ impl Transport for RecordingTransport {
|
|
|
760
556
|
_target: &Target,
|
|
761
557
|
range: CaptureRange,
|
|
762
558
|
) -> Result<CapturedText, TransportError> {
|
|
559
|
+
// A ready Copilot screen ends the D6 startup-trust poll immediately.
|
|
763
560
|
Ok(CapturedText {
|
|
764
|
-
text:
|
|
561
|
+
text: team_agent::provider::COPILOT_READY_MARKER.to_string(),
|
|
765
562
|
range,
|
|
766
563
|
})
|
|
767
564
|
}
|