@team-agent/installer 0.5.128 → 0.6.1
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/README.md +4 -4
- package/README.zh.md +1 -1
- package/package.json +4 -8
- package/skills/team-agent/SKILL.md +37 -20
- package/skills/team-agent/command-coverage.json +169 -183
- package/skills/team-agent/docs/reference/team-agent-operator.md +64 -30
- package/skills/team-agent/references/recovery-runbook.md +1 -1
- package/skills/team-agent/references/team-agent-operator.md +64 -30
- package/templates/team_state.md +1 -1
- package/Cargo.lock +0 -1063
- package/Cargo.toml +0 -36
- package/crates/team-agent/Cargo.toml +0 -69
- package/crates/team-agent/src/app_server_test_support.rs +0 -258
- package/crates/team-agent/src/cli/adapters.rs +0 -1288
- package/crates/team-agent/src/cli/arguments.rs +0 -405
- package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
- package/crates/team-agent/src/cli/diagnose.rs +0 -1721
- package/crates/team-agent/src/cli/emit.rs +0 -2930
- package/crates/team-agent/src/cli/grok_slot.rs +0 -384
- package/crates/team-agent/src/cli/helpers.rs +0 -91
- package/crates/team-agent/src/cli/intent/runtime.rs +0 -1216
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -912
- package/crates/team-agent/src/cli/intent/tests.rs +0 -689
- package/crates/team-agent/src/cli/intent.rs +0 -664
- package/crates/team-agent/src/cli/leader.rs +0 -300
- package/crates/team-agent/src/cli/leader_prompt.rs +0 -261
- package/crates/team-agent/src/cli/leaders.rs +0 -418
- package/crates/team-agent/src/cli/mod.rs +0 -6545
- package/crates/team-agent/src/cli/models.rs +0 -1206
- package/crates/team-agent/src/cli/named_address.rs +0 -1651
- package/crates/team-agent/src/cli/profile.rs +0 -342
- package/crates/team-agent/src/cli/route.rs +0 -212
- package/crates/team-agent/src/cli/schedule.rs +0 -175
- package/crates/team-agent/src/cli/send/coordinator.rs +0 -164
- package/crates/team-agent/src/cli/send/mailbox.rs +0 -145
- package/crates/team-agent/src/cli/send/persist.rs +0 -156
- package/crates/team-agent/src/cli/send/presentation.rs +0 -370
- package/crates/team-agent/src/cli/send/resolve.rs +0 -573
- package/crates/team-agent/src/cli/send.rs +0 -199
- package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
- package/crates/team-agent/src/cli/spec.rs +0 -165
- package/crates/team-agent/src/cli/status.rs +0 -280
- package/crates/team-agent/src/cli/status_port/agents.rs +0 -358
- package/crates/team-agent/src/cli/status_port/approvals.rs +0 -79
- package/crates/team-agent/src/cli/status_port/brief.rs +0 -1981
- package/crates/team-agent/src/cli/status_port/compact.rs +0 -240
- package/crates/team-agent/src/cli/status_port/format.rs +0 -146
- package/crates/team-agent/src/cli/status_port/inbox.rs +0 -62
- package/crates/team-agent/src/cli/status_port/runtime.rs +0 -197
- package/crates/team-agent/src/cli/status_port/snapshot.rs +0 -208
- package/crates/team-agent/src/cli/status_port/store.rs +0 -416
- package/crates/team-agent/src/cli/status_port/tests.rs +0 -90
- package/crates/team-agent/src/cli/status_port.rs +0 -92
- package/crates/team-agent/src/cli/tests/base.rs +0 -885
- package/crates/team-agent/src/cli/tests/divergence.rs +0 -518
- package/crates/team-agent/src/cli/tests/lane_c.rs +0 -453
- package/crates/team-agent/src/cli/tests/leader_watch.rs +0 -322
- package/crates/team-agent/src/cli/tests/main_preserved.rs +0 -430
- package/crates/team-agent/src/cli/tests/missing_subcommands.rs +0 -336
- package/crates/team-agent/src/cli/tests/mod.rs +0 -137
- package/crates/team-agent/src/cli/tests/named_address.rs +0 -761
- package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
- package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -484
- package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +0 -2179
- package/crates/team-agent/src/cli/tests/status_brief.rs +0 -1514
- package/crates/team-agent/src/cli/tests/status_send.rs +0 -888
- package/crates/team-agent/src/cli/tests/verb_install_skill.rs +0 -93
- package/crates/team-agent/src/cli/tests/verb_profile.rs +0 -392
- package/crates/team-agent/src/cli/triage.rs +0 -234
- package/crates/team-agent/src/cli/types.rs +0 -591
- package/crates/team-agent/src/codex_app_server.rs +0 -546
- package/crates/team-agent/src/communication_mode/mod.rs +0 -56
- package/crates/team-agent/src/compiler/tests.rs +0 -827
- package/crates/team-agent/src/compiler.rs +0 -890
- package/crates/team-agent/src/conpty/backend.rs +0 -829
- package/crates/team-agent/src/conpty/mod.rs +0 -33
- package/crates/team-agent/src/contract_runtime/backend.rs +0 -1744
- package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
- package/crates/team-agent/src/contract_runtime/config.rs +0 -364
- package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -76
- package/crates/team-agent/src/contract_runtime/discovery.rs +0 -449
- package/crates/team-agent/src/contract_runtime/fork.rs +0 -361
- package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
- package/crates/team-agent/src/contract_runtime/framework.rs +0 -367
- package/crates/team-agent/src/contract_runtime/mcp.rs +0 -394
- package/crates/team-agent/src/contract_runtime/mod.rs +0 -17
- package/crates/team-agent/src/contract_runtime/prompt.rs +0 -216
- package/crates/team-agent/src/contract_runtime/pump.rs +0 -271
- package/crates/team-agent/src/contract_runtime/registry.rs +0 -553
- package/crates/team-agent/src/contract_runtime/workspace.rs +0 -228
- package/crates/team-agent/src/coordinator/backoff.rs +0 -741
- package/crates/team-agent/src/coordinator/conpty_shim.rs +0 -805
- package/crates/team-agent/src/coordinator/health.rs +0 -1185
- package/crates/team-agent/src/coordinator/mod.rs +0 -119
- package/crates/team-agent/src/coordinator/orphan.rs +0 -110
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -798
- package/crates/team-agent/src/coordinator/runtime_observation.rs +0 -84
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +0 -2309
- package/crates/team-agent/src/coordinator/steps/delivery.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/health_sync.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/mod.rs +0 -126
- package/crates/team-agent/src/coordinator/steps/persist.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/runtime_prompts.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/session_gate.rs +0 -16
- package/crates/team-agent/src/coordinator/tests/a0_lostupdate.rs +0 -158
- package/crates/team-agent/src/coordinator/tests/abnormal.rs +0 -312
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +0 -300
- package/crates/team-agent/src/coordinator/tests/basics.rs +0 -211
- package/crates/team-agent/src/coordinator/tests/daemon.rs +0 -514
- package/crates/team-agent/src/coordinator/tests/energy.rs +0 -549
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -503
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +0 -186
- package/crates/team-agent/src/coordinator/tests/mod.rs +0 -295
- package/crates/team-agent/src/coordinator/tests/s3_bounded.rs +0 -207
- package/crates/team-agent/src/coordinator/tests/spine.rs +0 -308
- package/crates/team-agent/src/coordinator/tests/takeover.rs +0 -286
- package/crates/team-agent/src/coordinator/tests/tick_core.rs +0 -237
- package/crates/team-agent/src/coordinator/tick.rs +0 -3024
- package/crates/team-agent/src/coordinator/types.rs +0 -540
- package/crates/team-agent/src/db/agent_health_capture.rs +0 -126
- package/crates/team-agent/src/db/message_store.rs +0 -1527
- package/crates/team-agent/src/db/migration.rs +0 -984
- package/crates/team-agent/src/db/mod.rs +0 -26
- package/crates/team-agent/src/db/schema.rs +0 -663
- package/crates/team-agent/src/diagnose/comms.rs +0 -242
- package/crates/team-agent/src/diagnose/mod.rs +0 -44
- package/crates/team-agent/src/diagnose/orphans.rs +0 -889
- package/crates/team-agent/src/direct_delivery.rs +0 -368
- package/crates/team-agent/src/event_log.rs +0 -502
- package/crates/team-agent/src/fake_worker.rs +0 -303
- package/crates/team-agent/src/inbox_store.rs +0 -169
- package/crates/team-agent/src/kill_audit.rs +0 -106
- package/crates/team-agent/src/layout/manager.rs +0 -248
- package/crates/team-agent/src/layout/mod.rs +0 -36
- package/crates/team-agent/src/layout/overlay.rs +0 -134
- package/crates/team-agent/src/layout/placement.rs +0 -52
- package/crates/team-agent/src/layout/recovery.rs +0 -106
- package/crates/team-agent/src/layout/runtime_sessions.rs +0 -317
- package/crates/team-agent/src/layout/sessions.rs +0 -294
- package/crates/team-agent/src/layout/tmux_endpoint.rs +0 -165
- package/crates/team-agent/src/layout/worker_env.rs +0 -721
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -37
- package/crates/team-agent/src/leader/helpers.rs +0 -178
- package/crates/team-agent/src/leader/incident.rs +0 -6
- package/crates/team-agent/src/leader/lease.rs +0 -3356
- package/crates/team-agent/src/leader/mod.rs +0 -104
- package/crates/team-agent/src/leader/owner_bind.rs +0 -400
- package/crates/team-agent/src/leader/prompt.rs +0 -905
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -247
- package/crates/team-agent/src/leader/rediscover/tests.rs +0 -689
- package/crates/team-agent/src/leader/rediscover.rs +0 -1192
- package/crates/team-agent/src/leader/registry.rs +0 -888
- package/crates/team-agent/src/leader/start.rs +0 -4501
- package/crates/team-agent/src/leader/takeover.rs +0 -65
- package/crates/team-agent/src/leader/tests/basics.rs +0 -337
- package/crates/team-agent/src/leader/tests/byte_findings.rs +0 -355
- package/crates/team-agent/src/leader/tests/claim_leader_mailbox_flush_contract.rs +0 -544
- package/crates/team-agent/src/leader/tests/historical_inventory_upgrade_gate_red.rs +0 -624
- package/crates/team-agent/src/leader/tests/identity.rs +0 -465
- package/crates/team-agent/src/leader/tests/identity_session_names.rs +0 -42
- package/crates/team-agent/src/leader/tests/idle.rs +0 -113
- package/crates/team-agent/src/leader/tests/lease_api.rs +0 -520
- package/crates/team-agent/src/leader/tests/lease_claim.rs +0 -629
- package/crates/team-agent/src/leader/tests/mod.rs +0 -106
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +0 -268
- package/crates/team-agent/src/leader/tests/rediscover.rs +0 -403
- package/crates/team-agent/src/leader/tests/rehomed_env.rs +0 -83
- package/crates/team-agent/src/leader/tests/team_in_team_state_scope_red.rs +0 -1273
- package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs +0 -417
- package/crates/team-agent/src/leader/tests/wake_start_owner.rs +0 -168
- package/crates/team-agent/src/leader/types.rs +0 -534
- package/crates/team-agent/src/lib.rs +0 -147
- package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -881
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -598
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -204
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -107
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -144
- package/crates/team-agent/src/lifecycle/launch/identity.rs +0 -674
- package/crates/team-agent/src/lifecycle/launch/layout.rs +0 -350
- package/crates/team-agent/src/lifecycle/launch/leader_context.rs +0 -589
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +0 -160
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -899
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -225
- package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5200
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +0 -368
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -519
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +0 -287
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -473
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -801
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +0 -624
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -558
- package/crates/team-agent/src/lifecycle/launch.rs +0 -557
- package/crates/team-agent/src/lifecycle/lock.rs +0 -350
- package/crates/team-agent/src/lifecycle/mod.rs +0 -79
- package/crates/team-agent/src/lifecycle/pane_input_lock.rs +0 -239
- package/crates/team-agent/src/lifecycle/profile_launch.rs +0 -1067
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
- package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2199
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1798
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +0 -163
- package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2362
- package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +0 -65
- package/crates/team-agent/src/lifecycle/restart/preflight.rs +0 -113
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +0 -5135
- package/crates/team-agent/src/lifecycle/restart/remove.rs +0 -1504
- package/crates/team-agent/src/lifecycle/restart/selection.rs +0 -559
- package/crates/team-agent/src/lifecycle/restart/team_state.rs +0 -329
- package/crates/team-agent/src/lifecycle/restart.rs +0 -227
- package/crates/team-agent/src/lifecycle/role_config.rs +0 -1230
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +0 -1021
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +0 -1205
- package/crates/team-agent/src/lifecycle/tests/b0_legacy_snapshot_nonauthority_contract.rs +0 -265
- package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +0 -490
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +0 -656
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +0 -447
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1638
- package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +0 -770
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -419
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2035
- package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1327
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +0 -315
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_g0.stdout.txt +0 -222
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_spaced_ids.stdout.txt +0 -9
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +0 -72
- package/crates/team-agent/src/lifecycle/tests/gate_fixtures.rs +0 -562
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +0 -110
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +0 -512
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +0 -921
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +0 -68
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +0 -1851
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +0 -3983
- package/crates/team-agent/src/lifecycle/tests/lifecycle_lock.rs +0 -339
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +0 -596
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +0 -513
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +0 -69
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +0 -824
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +0 -723
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +0 -164
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -200
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -527
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -1062
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1419
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -98
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -550
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -226
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -332
- package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -786
- package/crates/team-agent/src/lifecycle/tests/realmachine_residual_g1_g4_red.rs +0 -648
- package/crates/team-agent/src/lifecycle/tests/restart.rs +0 -185
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +0 -1053
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +0 -679
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1126
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +0 -153
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +0 -431
- package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +0 -1066
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +0 -876
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +0 -1026
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +0 -342
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +0 -543
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +0 -1103
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +0 -1276
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_roster_red.rs +0 -145
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +0 -603
- package/crates/team-agent/src/lifecycle/tests/test_isolation_escape_contract.rs +0 -936
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +0 -970
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +0 -995
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -836
- package/crates/team-agent/src/lifecycle/tests.rs +0 -105
- package/crates/team-agent/src/lifecycle/types.rs +0 -877
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -363
- package/crates/team-agent/src/main.rs +0 -52
- package/crates/team-agent/src/mcp_server/helpers.rs +0 -510
- package/crates/team-agent/src/mcp_server/lifecycle_tools/mod.rs +0 -6
- package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +0 -43
- package/crates/team-agent/src/mcp_server/mod.rs +0 -119
- package/crates/team-agent/src/mcp_server/normalize.rs +0 -485
- package/crates/team-agent/src/mcp_server/readiness.rs +0 -527
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -348
- package/crates/team-agent/src/mcp_server/tests/golden.rs +0 -285
- package/crates/team-agent/src/mcp_server/tests/normalize.rs +0 -247
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +0 -158
- package/crates/team-agent/src/mcp_server/tests/send.rs +0 -353
- package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -341
- package/crates/team-agent/src/mcp_server/tests/wire.rs +0 -254
- package/crates/team-agent/src/mcp_server/tests.rs +0 -43
- package/crates/team-agent/src/mcp_server/tools.rs +0 -889
- package/crates/team-agent/src/mcp_server/types.rs +0 -396
- package/crates/team-agent/src/mcp_server/wire.rs +0 -867
- package/crates/team-agent/src/messaging/activity.rs +0 -461
- package/crates/team-agent/src/messaging/address.rs +0 -87
- package/crates/team-agent/src/messaging/delivery.rs +0 -3727
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +0 -234
- package/crates/team-agent/src/messaging/enter_rescue.rs +0 -362
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +0 -633
- package/crates/team-agent/src/messaging/helpers.rs +0 -336
- package/crates/team-agent/src/messaging/leader_channel.rs +0 -287
- package/crates/team-agent/src/messaging/leader_receiver.rs +0 -786
- package/crates/team-agent/src/messaging/mod.rs +0 -167
- package/crates/team-agent/src/messaging/persist.rs +0 -377
- package/crates/team-agent/src/messaging/presentation.rs +0 -417
- package/crates/team-agent/src/messaging/reminders.rs +0 -316
- package/crates/team-agent/src/messaging/results/collection_tests.rs +0 -719
- package/crates/team-agent/src/messaging/results.rs +0 -1415
- package/crates/team-agent/src/messaging/scheduler.rs +0 -223
- package/crates/team-agent/src/messaging/selftest.rs +0 -315
- package/crates/team-agent/src/messaging/send.rs +0 -981
- package/crates/team-agent/src/messaging/tests/basic.rs +0 -346
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +0 -657
- package/crates/team-agent/src/messaging/tests/e23.rs +0 -49
- package/crates/team-agent/src/messaging/tests/leader_channel.rs +0 -169
- package/crates/team-agent/src/messaging/tests/leader_inject_acceptance.rs +0 -817
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +0 -85
- package/crates/team-agent/src/messaging/tests/mod.rs +0 -306
- package/crates/team-agent/src/messaging/tests/runtime.rs +0 -3549
- package/crates/team-agent/src/messaging/tests/spine.rs +0 -853
- package/crates/team-agent/src/messaging/tests/wave2.rs +0 -381
- package/crates/team-agent/src/messaging/trust.rs +0 -215
- package/crates/team-agent/src/messaging/types.rs +0 -472
- package/crates/team-agent/src/messaging/wait.rs +0 -366
- package/crates/team-agent/src/messaging/watchers.rs +0 -916
- package/crates/team-agent/src/model/enums.rs +0 -356
- package/crates/team-agent/src/model/errors.rs +0 -18
- package/crates/team-agent/src/model/ids.rs +0 -165
- package/crates/team-agent/src/model/mod.rs +0 -29
- package/crates/team-agent/src/model/name_similarity.rs +0 -252
- package/crates/team-agent/src/model/pane_authority_refusal.rs +0 -359
- package/crates/team-agent/src/model/paths.rs +0 -257
- package/crates/team-agent/src/model/routing.rs +0 -387
- package/crates/team-agent/src/model/spec.rs +0 -1184
- package/crates/team-agent/src/model/task_graph.rs +0 -321
- package/crates/team-agent/src/model/testdata/fuzz.golden.yaml +0 -43
- package/crates/team-agent/src/model/testdata/fuzz.yaml +0 -43
- package/crates/team-agent/src/model/testdata/spec_invalid_a.yaml +0 -209
- package/crates/team-agent/src/model/testdata/team.spec.golden.yaml +0 -208
- package/crates/team-agent/src/model/testdata/team.spec.yaml +0 -208
- package/crates/team-agent/src/model/yaml/tests.rs +0 -188
- package/crates/team-agent/src/model/yaml.rs +0 -802
- package/crates/team-agent/src/os_probe.rs +0 -280
- package/crates/team-agent/src/packaging/install.rs +0 -219
- package/crates/team-agent/src/packaging/migrate.rs +0 -38
- package/crates/team-agent/src/packaging/mod.rs +0 -91
- package/crates/team-agent/src/packaging/repair.rs +0 -33
- package/crates/team-agent/src/packaging/tests.rs +0 -822
- package/crates/team-agent/src/packaging/types.rs +0 -417
- package/crates/team-agent/src/platform/argv.rs +0 -331
- package/crates/team-agent/src/platform/errors.rs +0 -104
- package/crates/team-agent/src/platform/file_lock.rs +0 -279
- package/crates/team-agent/src/platform/mod.rs +0 -5
- package/crates/team-agent/src/platform/process.rs +0 -545
- package/crates/team-agent/src/provider/adapter.rs +0 -1150
- package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
- package/crates/team-agent/src/provider/adapters/copilot.rs +0 -75
- package/crates/team-agent/src/provider/adapters/copilot_fork.rs +0 -307
- package/crates/team-agent/src/provider/adapters/fake.rs +0 -18
- package/crates/team-agent/src/provider/adapters/mod.rs +0 -30
- package/crates/team-agent/src/provider/adapters/pi.rs +0 -106
- package/crates/team-agent/src/provider/approvals/mod.rs +0 -3
- package/crates/team-agent/src/provider/approvals/parsing.rs +0 -586
- package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +0 -205
- package/crates/team-agent/src/provider/argv_route.rs +0 -405
- package/crates/team-agent/src/provider/bypass_flags.rs +0 -116
- package/crates/team-agent/src/provider/classify.rs +0 -708
- package/crates/team-agent/src/provider/command_helpers.rs +0 -45
- package/crates/team-agent/src/provider/faults.rs +0 -165
- package/crates/team-agent/src/provider/helpers.rs +0 -52
- package/crates/team-agent/src/provider/mod.rs +0 -78
- package/crates/team-agent/src/provider/model_catalog.rs +0 -910
- package/crates/team-agent/src/provider/session/capture.rs +0 -2731
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -172
- package/crates/team-agent/src/provider/session/context_fork.rs +0 -396
- package/crates/team-agent/src/provider/session/mod.rs +0 -36
- package/crates/team-agent/src/provider/session/resume.rs +0 -269
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/common/tests.rs +0 -316
- package/crates/team-agent/src/provider/session_scan/common.rs +0 -654
- package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
- package/crates/team-agent/src/provider/session_scan/pi.rs +0 -185
- package/crates/team-agent/src/provider/session_scan.rs +0 -71
- package/crates/team-agent/src/provider/startup_prompt.rs +0 -757
- package/crates/team-agent/src/provider/submit_now.rs +0 -71
- package/crates/team-agent/src/provider/testdata/copilot-ready-marker.txt +0 -5
- package/crates/team-agent/src/provider/testdata/copilot-trust-prompt.txt +0 -19
- package/crates/team-agent/src/provider/testdata/grok-models-authenticated.stdout +0 -9
- package/crates/team-agent/src/provider/testdata/grok-models-unauthenticated.stdout +0 -7
- package/crates/team-agent/src/provider/tests/adapter.rs +0 -441
- package/crates/team-agent/src/provider/tests/classify.rs +0 -148
- package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -35
- package/crates/team-agent/src/provider/tests/copilot_fork.rs +0 -191
- package/crates/team-agent/src/provider/tests/faults.rs +0 -200
- package/crates/team-agent/src/provider/tests/idle.rs +0 -177
- package/crates/team-agent/src/provider/tests/wire.rs +0 -213
- package/crates/team-agent/src/provider/tests.rs +0 -32
- package/crates/team-agent/src/provider/types.rs +0 -529
- package/crates/team-agent/src/provider/wire.rs +0 -394
- package/crates/team-agent/src/redaction.rs +0 -259
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +0 -248
- package/crates/team-agent/src/state/abnormal_watch.rs +0 -144
- package/crates/team-agent/src/state/identity.rs +0 -914
- package/crates/team-agent/src/state/identity_keys.rs +0 -132
- package/crates/team-agent/src/state/mod.rs +0 -74
- package/crates/team-agent/src/state/owner_gate.rs +0 -482
- package/crates/team-agent/src/state/ownership.rs +0 -563
- package/crates/team-agent/src/state/paths.rs +0 -395
- package/crates/team-agent/src/state/persist.rs +0 -3811
- package/crates/team-agent/src/state/projection.rs +0 -1508
- package/crates/team-agent/src/state/repository/intent.rs +0 -14
- package/crates/team-agent/src/state/repository/tests.rs +0 -184
- package/crates/team-agent/src/state/repository.rs +0 -866
- package/crates/team-agent/src/state/selector.rs +0 -160
- package/crates/team-agent/src/state/testdata/state-rich.canonical.json +0 -133
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
- package/crates/team-agent/src/tmux_backend/enter_rescue.rs +0 -325
- package/crates/team-agent/src/tmux_backend/enter_rescue_tests.rs +0 -432
- package/crates/team-agent/src/tmux_backend/native_input.rs +0 -513
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +0 -742
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -4103
- package/crates/team-agent/src/tmux_backend.rs +0 -4492
- package/crates/team-agent/src/topology.rs +0 -537
- package/crates/team-agent/src/transport/enter_rescue.rs +0 -166
- package/crates/team-agent/src/transport/native_input.rs +0 -491
- package/crates/team-agent/src/transport/test_support.rs +0 -743
- package/crates/team-agent/src/transport/tests/behavior.rs +0 -326
- package/crates/team-agent/src/transport/tests/mod.rs +0 -194
- package/crates/team-agent/src/transport/tests/wire.rs +0 -574
- package/crates/team-agent/src/transport.rs +0 -1655
- package/crates/team-agent/src/transport_factory.rs +0 -819
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
use super::spine::{message_status, DeliveringTransport};
|
|
2
|
-
use super::*;
|
|
3
|
-
|
|
4
|
-
// ═════════════════════════════════════════════════════════════════════════
|
|
5
|
-
// P0 REGRESSION (root cause pinned) — a per-agent capture/health-check FAILURE must not abort the
|
|
6
|
-
// whole tick. rt-host-a baseline @ ea4ba97: after `stop-agent w1`, `send w2` stays status='accepted'
|
|
7
|
-
// with delivery_attempts=0 while the coordinator stays alive. Root cause: sync_agent_health
|
|
8
|
-
// (tick.rs) does `self.transport.capture(&target, ...)?` per agent — when the stopped w1's window is
|
|
9
|
-
// gone the capture ERRORS and the `?` propagates -> sync_agent_health returns Err -> the tick
|
|
10
|
-
// early-returns Err BEFORE deliver_pending_messages -> the deliver loop never runs for the active w2.
|
|
11
|
-
// Contract: the tick must SWALLOW a per-agent capture/health failure (log + continue) and still run
|
|
12
|
-
// deliver_pending_messages for the other agents. Unit repro: a transport whose capture() ERRORS
|
|
13
|
-
// (window gone) but whose session exists + inject delivers -> the tick must (a) NOT return Err, and
|
|
14
|
-
// (b) still attempt delivery to the active w2 (delivery_attempts +1 / status advances past 'accepted').
|
|
15
|
-
// ═════════════════════════════════════════════════════════════════════════
|
|
16
|
-
fn message_delivery_attempts(dir: &std::path::Path, message_id: &str) -> i64 {
|
|
17
|
-
let store = MessageStore::open(dir).unwrap();
|
|
18
|
-
let conn = crate::db::schema::open_db(store.db_path()).unwrap();
|
|
19
|
-
conn.query_row(
|
|
20
|
-
"select delivery_attempts from messages where message_id = ?1",
|
|
21
|
-
[message_id],
|
|
22
|
-
|r| r.get::<_, i64>(0),
|
|
23
|
-
)
|
|
24
|
-
.unwrap()
|
|
25
|
-
}
|
|
26
|
-
/// A transport that DELIVERS (inject ok, session present) but whose `capture` ALWAYS fails — modelling a
|
|
27
|
-
/// stopped agent whose tmux window is gone. Exercises sync_agent_health's per-agent `capture?`: today the
|
|
28
|
-
/// error propagates and aborts the whole tick; the fix must swallow it and continue to deliver.
|
|
29
|
-
struct CaptureFailsDeliverTransport {
|
|
30
|
-
inner: DeliveringTransport,
|
|
31
|
-
}
|
|
32
|
-
impl CaptureFailsDeliverTransport {
|
|
33
|
-
fn new() -> Self {
|
|
34
|
-
Self {
|
|
35
|
-
inner: DeliveringTransport::new(),
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
impl Transport for CaptureFailsDeliverTransport {
|
|
40
|
-
fn kind(&self) -> BackendKind {
|
|
41
|
-
self.inner.kind()
|
|
42
|
-
}
|
|
43
|
-
fn spawn_first(
|
|
44
|
-
&self,
|
|
45
|
-
s: &SessionName,
|
|
46
|
-
w: &WindowName,
|
|
47
|
-
a: &[String],
|
|
48
|
-
c: &std::path::Path,
|
|
49
|
-
e: &std::collections::BTreeMap<String, String>,
|
|
50
|
-
) -> Result<SpawnResult, TransportError> {
|
|
51
|
-
self.inner.spawn_first(s, w, a, c, e)
|
|
52
|
-
}
|
|
53
|
-
fn spawn_into(
|
|
54
|
-
&self,
|
|
55
|
-
s: &SessionName,
|
|
56
|
-
w: &WindowName,
|
|
57
|
-
a: &[String],
|
|
58
|
-
c: &std::path::Path,
|
|
59
|
-
e: &std::collections::BTreeMap<String, String>,
|
|
60
|
-
) -> Result<SpawnResult, TransportError> {
|
|
61
|
-
self.inner.spawn_into(s, w, a, c, e)
|
|
62
|
-
}
|
|
63
|
-
fn inject(
|
|
64
|
-
&self,
|
|
65
|
-
t: &Target,
|
|
66
|
-
p: &InjectPayload,
|
|
67
|
-
submit: Key,
|
|
68
|
-
bracketed: bool,
|
|
69
|
-
) -> Result<InjectReport, TransportError> {
|
|
70
|
-
self.inner.inject(t, p, submit, bracketed)
|
|
71
|
-
}
|
|
72
|
-
fn send_keys(&self, t: &Target, k: &[Key]) -> Result<(), TransportError> {
|
|
73
|
-
self.inner.send_keys(t, k)
|
|
74
|
-
}
|
|
75
|
-
fn capture(&self, _t: &Target, _r: CaptureRange) -> Result<CapturedText, TransportError> {
|
|
76
|
-
// the agent's window is gone — capture fails (tmux can't find the target).
|
|
77
|
-
Err(TransportError::TargetNotFound {
|
|
78
|
-
target: "window gone (stopped agent)".to_string(),
|
|
79
|
-
})
|
|
80
|
-
}
|
|
81
|
-
fn query(&self, t: &Target, f: PaneField) -> Result<Option<String>, TransportError> {
|
|
82
|
-
self.inner.query(t, f)
|
|
83
|
-
}
|
|
84
|
-
fn liveness(&self, p: &PaneId) -> Result<PaneLiveness, TransportError> {
|
|
85
|
-
self.inner.liveness(p)
|
|
86
|
-
}
|
|
87
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
88
|
-
self.inner.list_targets()
|
|
89
|
-
}
|
|
90
|
-
fn has_session(&self, s: &SessionName) -> Result<bool, TransportError> {
|
|
91
|
-
self.inner.has_session(s)
|
|
92
|
-
}
|
|
93
|
-
fn list_windows(&self, s: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
94
|
-
self.inner.list_windows(s)
|
|
95
|
-
}
|
|
96
|
-
fn set_session_env(
|
|
97
|
-
&self,
|
|
98
|
-
s: &SessionName,
|
|
99
|
-
k: &str,
|
|
100
|
-
v: &str,
|
|
101
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
102
|
-
self.inner.set_session_env(s, k, v)
|
|
103
|
-
}
|
|
104
|
-
fn kill_session(&self, s: &SessionName) -> Result<(), TransportError> {
|
|
105
|
-
self.inner.kill_session(s)
|
|
106
|
-
}
|
|
107
|
-
fn kill_window(&self, t: &Target) -> Result<(), TransportError> {
|
|
108
|
-
self.inner.kill_window(t)
|
|
109
|
-
}
|
|
110
|
-
fn attach_session(&self, s: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
111
|
-
self.inner.attach_session(s)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
#[test]
|
|
115
|
-
fn tick_swallows_capture_failure_and_still_delivers_to_other_agent() {
|
|
116
|
-
let dir = std::env::temp_dir().join(format!(
|
|
117
|
-
"team-agent-coord-stopreg-{}-{}",
|
|
118
|
-
std::process::id(),
|
|
119
|
-
std::time::SystemTime::now()
|
|
120
|
-
.duration_since(std::time::UNIX_EPOCH)
|
|
121
|
-
.unwrap()
|
|
122
|
-
.as_nanos()
|
|
123
|
-
));
|
|
124
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
125
|
-
// w1 STOPPED (window gone -> capture fails), w2 ACTIVE — w2 keeps the tmux session alive.
|
|
126
|
-
crate::state::persist::save_runtime_state(
|
|
127
|
-
&dir,
|
|
128
|
-
&serde_json::json!({
|
|
129
|
-
"session_name": "team-spine",
|
|
130
|
-
"agents": {
|
|
131
|
-
"w1": { "provider": "fake", "status": "stopped", "window": "w1" },
|
|
132
|
-
"w2": { "provider": "fake", "status": "running", "window": "w2" }
|
|
133
|
-
}
|
|
134
|
-
}),
|
|
135
|
-
)
|
|
136
|
-
.unwrap();
|
|
137
|
-
let store = MessageStore::open(&dir).unwrap();
|
|
138
|
-
let mid = store
|
|
139
|
-
.create_message(
|
|
140
|
-
Some("task-1"),
|
|
141
|
-
"leader",
|
|
142
|
-
"w2",
|
|
143
|
-
"after stop",
|
|
144
|
-
None,
|
|
145
|
-
true,
|
|
146
|
-
None,
|
|
147
|
-
)
|
|
148
|
-
.unwrap();
|
|
149
|
-
drop(store);
|
|
150
|
-
assert_eq!(
|
|
151
|
-
message_status(&dir, &mid),
|
|
152
|
-
"accepted",
|
|
153
|
-
"precondition: a fresh message is 'accepted'"
|
|
154
|
-
);
|
|
155
|
-
let ws = WorkspacePath::new(dir.clone());
|
|
156
|
-
let reg: Box<dyn ProviderRegistry> = Box::new(MockRegistry::new(&[], &[]));
|
|
157
|
-
// capture() ERRORS (window gone) but inject delivers + session present.
|
|
158
|
-
let coord = Coordinator::for_test(
|
|
159
|
-
ws,
|
|
160
|
-
reg,
|
|
161
|
-
Box::new(CaptureFailsDeliverTransport::new()),
|
|
162
|
-
None,
|
|
163
|
-
None,
|
|
164
|
-
);
|
|
165
|
-
let result = coord.tick();
|
|
166
|
-
// (a) a per-agent capture failure must NOT abort the whole tick.
|
|
167
|
-
assert!(
|
|
168
|
-
result.is_ok(),
|
|
169
|
-
"P0: sync_agent_health's per-agent `capture?` must be SWALLOWED (log + continue), not propagated — \
|
|
170
|
-
the tick must NOT early-return Err when a stopped agent's window-capture fails; got {result:?}"
|
|
171
|
-
);
|
|
172
|
-
let report = result.unwrap();
|
|
173
|
-
// (b) the deliver loop must still run for the active w2.
|
|
174
|
-
let attempts = message_delivery_attempts(&dir, &mid);
|
|
175
|
-
let delivered_reported = report.delivered.iter().any(|d| d.message_id == mid);
|
|
176
|
-
let advanced = message_status(&dir, &mid) != "accepted";
|
|
177
|
-
assert!(
|
|
178
|
-
attempts >= 1 || delivered_reported || advanced,
|
|
179
|
-
"P0: after swallowing w1's capture failure, the tick MUST still deliver to the active w2 — its \
|
|
180
|
-
message must advance past 'accepted' (delivery_attempts +1 / claimed / delivered). The regression \
|
|
181
|
-
halts before deliver_pending_messages and leaves it at delivery_attempts=0. attempts={attempts} \
|
|
182
|
-
status={} delivered={:?}",
|
|
183
|
-
message_status(&dir, &mid),
|
|
184
|
-
report.delivered
|
|
185
|
-
);
|
|
186
|
-
}
|
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
|
2
|
-
use super::*;
|
|
3
|
-
|
|
4
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
5
|
-
// helpers — concrete golden fixtures (Python v0.2.11 @ 439bef8)
|
|
6
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
7
|
-
|
|
8
|
-
/// `MessageStore.SCHEMA_VERSION == 3` (both Python & Rust db/schema.rs:13). metadata 三元之一。
|
|
9
|
-
const GOLDEN_SCHEMA_VERSION: i64 = 3;
|
|
10
|
-
|
|
11
|
-
fn ws() -> WorkspacePath {
|
|
12
|
-
WorkspacePath::new("/tmp/team-agent-coord-test")
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
fn meta(pid: u32, proto: u32, schema: i64) -> CoordinatorMetadata {
|
|
16
|
-
let identity = current_coordinator_binary_identity();
|
|
17
|
-
CoordinatorMetadata {
|
|
18
|
-
pid: Pid(pid),
|
|
19
|
-
protocol_version: proto,
|
|
20
|
-
message_store_schema_version: schema,
|
|
21
|
-
binary_path: Some(identity.binary_path),
|
|
22
|
-
binary_version: Some(identity.binary_version),
|
|
23
|
-
source: MetadataSource::Boot,
|
|
24
|
-
updated_at: "2026-06-02T00:00:00+00:00".to_string(),
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/// `ProviderRegistry` mock — 记录 provider-client adapter 调用 (MUST-NOT-13 / §84).
|
|
29
|
-
struct MockRegistry {
|
|
30
|
-
adapter_calls: std::cell::Cell<u32>,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
impl MockRegistry {
|
|
34
|
-
fn new(_whitelist: &[&str], _blacklist: &[&str]) -> Self {
|
|
35
|
-
Self {
|
|
36
|
-
adapter_calls: std::cell::Cell::new(0),
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
impl ProviderRegistry for MockRegistry {
|
|
42
|
-
fn adapter_for(&self, _provider: Provider) -> Box<dyn ProviderAdapter> {
|
|
43
|
-
// 任何对它的调用都违反 §84 zero-injection;计数,断言保持 0。
|
|
44
|
-
self.adapter_calls.set(self.adapter_calls.get() + 1);
|
|
45
|
-
crate::provider::get_adapter(_provider)
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/// in-memory `MarkerStore` —— durable marker 落盘探针。
|
|
50
|
-
struct MapMarkerStore {
|
|
51
|
-
markers: std::collections::BTreeMap<String, Value>,
|
|
52
|
-
fail: bool,
|
|
53
|
-
}
|
|
54
|
-
impl MapMarkerStore {
|
|
55
|
-
fn ok() -> Self {
|
|
56
|
-
Self {
|
|
57
|
-
markers: Default::default(),
|
|
58
|
-
fail: false,
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
fn failing() -> Self {
|
|
62
|
-
Self {
|
|
63
|
-
markers: Default::default(),
|
|
64
|
-
fail: true,
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
impl MarkerStore for MapMarkerStore {
|
|
69
|
-
fn set_marker(&mut self, name: &str, value: Value) -> bool {
|
|
70
|
-
if self.fail {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
self.markers.insert(name.to_string(), value);
|
|
74
|
-
true
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
79
|
-
// Mock `Transport` — records every method call (name) + returns canned values.
|
|
80
|
-
// The §84/no-tmux/no-panic tick contracts inject THIS so a Coordinator can be
|
|
81
|
-
// constructed in tests. `has_session` answer drives the tmux-session-missing gate.
|
|
82
|
-
// Recorded `calls` let a future tick-order test assert which control-plane probes
|
|
83
|
-
// ran. capture/query return canned text so tick's readonly detectors stay
|
|
84
|
-
// provider-neutral (no real subprocess, no provider client). MUST-NOT-13: this
|
|
85
|
-
// mock NEVER reaches a provider client crate.
|
|
86
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
87
|
-
use crate::transport::{
|
|
88
|
-
test_support::OfflineTransport, AttachOutcome, BackendKind, CaptureRange, CapturedText,
|
|
89
|
-
InjectPayload, InjectReport, Key, PaneField, PaneId, PaneInfo, PaneLiveness, SessionName,
|
|
90
|
-
SetEnvOutcome, SpawnResult, Target, Transport, TransportError, WindowName,
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
struct MockTransport {
|
|
94
|
-
inner: OfflineTransport,
|
|
95
|
-
calls: std::sync::Arc<std::sync::Mutex<Vec<&'static str>>>,
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
impl MockTransport {
|
|
99
|
-
fn new(session_present: bool) -> Self {
|
|
100
|
-
Self {
|
|
101
|
-
inner: OfflineTransport::new().with_session_present(session_present),
|
|
102
|
-
calls: std::sync::Arc::new(std::sync::Mutex::new(Vec::new())),
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
fn record(&self, name: &'static str) {
|
|
106
|
-
self.calls.lock().unwrap().push(name);
|
|
107
|
-
}
|
|
108
|
-
fn calls(&self) -> Vec<&'static str> {
|
|
109
|
-
self.calls.lock().unwrap().clone()
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
impl Transport for MockTransport {
|
|
114
|
-
fn kind(&self) -> BackendKind {
|
|
115
|
-
self.inner.kind()
|
|
116
|
-
}
|
|
117
|
-
fn spawn_first(
|
|
118
|
-
&self,
|
|
119
|
-
s: &SessionName,
|
|
120
|
-
w: &WindowName,
|
|
121
|
-
argv: &[String],
|
|
122
|
-
cwd: &std::path::Path,
|
|
123
|
-
env: &std::collections::BTreeMap<String, String>,
|
|
124
|
-
) -> Result<SpawnResult, TransportError> {
|
|
125
|
-
self.record("spawn_first");
|
|
126
|
-
self.inner.spawn_first(s, w, argv, cwd, env)
|
|
127
|
-
}
|
|
128
|
-
fn spawn_into(
|
|
129
|
-
&self,
|
|
130
|
-
s: &SessionName,
|
|
131
|
-
w: &WindowName,
|
|
132
|
-
argv: &[String],
|
|
133
|
-
cwd: &std::path::Path,
|
|
134
|
-
env: &std::collections::BTreeMap<String, String>,
|
|
135
|
-
) -> Result<SpawnResult, TransportError> {
|
|
136
|
-
self.record("spawn_into");
|
|
137
|
-
self.inner.spawn_into(s, w, argv, cwd, env)
|
|
138
|
-
}
|
|
139
|
-
fn inject(
|
|
140
|
-
&self,
|
|
141
|
-
t: &Target,
|
|
142
|
-
p: &InjectPayload,
|
|
143
|
-
submit: Key,
|
|
144
|
-
bracketed: bool,
|
|
145
|
-
) -> Result<InjectReport, TransportError> {
|
|
146
|
-
self.record("inject");
|
|
147
|
-
self.inner.inject(t, p, submit, bracketed)
|
|
148
|
-
}
|
|
149
|
-
fn send_keys(&self, t: &Target, keys: &[Key]) -> Result<(), TransportError> {
|
|
150
|
-
self.record("send_keys");
|
|
151
|
-
self.inner.send_keys(t, keys)
|
|
152
|
-
}
|
|
153
|
-
fn capture(&self, t: &Target, range: CaptureRange) -> Result<CapturedText, TransportError> {
|
|
154
|
-
self.record("capture");
|
|
155
|
-
self.inner.capture(t, range)
|
|
156
|
-
}
|
|
157
|
-
fn query(&self, t: &Target, f: PaneField) -> Result<Option<String>, TransportError> {
|
|
158
|
-
self.record("query");
|
|
159
|
-
self.inner.query(t, f)
|
|
160
|
-
}
|
|
161
|
-
fn liveness(&self, pane: &PaneId) -> Result<PaneLiveness, TransportError> {
|
|
162
|
-
self.record("liveness");
|
|
163
|
-
self.inner.liveness(pane)
|
|
164
|
-
}
|
|
165
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
166
|
-
self.record("list_targets");
|
|
167
|
-
self.inner.list_targets()
|
|
168
|
-
}
|
|
169
|
-
fn has_session(&self, s: &SessionName) -> Result<bool, TransportError> {
|
|
170
|
-
self.record("has_session");
|
|
171
|
-
self.inner.has_session(s)
|
|
172
|
-
}
|
|
173
|
-
fn list_windows(&self, s: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
174
|
-
self.record("list_windows");
|
|
175
|
-
self.inner.list_windows(s)
|
|
176
|
-
}
|
|
177
|
-
fn set_session_env(
|
|
178
|
-
&self,
|
|
179
|
-
s: &SessionName,
|
|
180
|
-
k: &str,
|
|
181
|
-
v: &str,
|
|
182
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
183
|
-
self.record("set_session_env");
|
|
184
|
-
self.inner.set_session_env(s, k, v)
|
|
185
|
-
}
|
|
186
|
-
fn kill_session(&self, s: &SessionName) -> Result<(), TransportError> {
|
|
187
|
-
self.record("kill_session");
|
|
188
|
-
self.inner.kill_session(s)
|
|
189
|
-
}
|
|
190
|
-
fn kill_window(&self, t: &Target) -> Result<(), TransportError> {
|
|
191
|
-
self.record("kill_window");
|
|
192
|
-
self.inner.kill_window(t)
|
|
193
|
-
}
|
|
194
|
-
fn attach_session(&self, s: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
195
|
-
self.record("attach_session");
|
|
196
|
-
self.inner.attach_session(s)
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/// Construct a `Coordinator` over a fresh temp workspace with injected mocks.
|
|
201
|
-
/// Returns `(coord, transport_calls_handle)` so tick tests can assert control-plane
|
|
202
|
-
/// call order and that `inject` (an exploratory prompt) never fired (§84).
|
|
203
|
-
/// `session_present` drives the tmux-session-missing gate; `save_hook` injects a
|
|
204
|
-
/// forced save failure (bug-084); `recorder` captures tick side-effect ORDER.
|
|
205
|
-
fn coord_for_test(
|
|
206
|
-
session_present: bool,
|
|
207
|
-
save_hook: Option<SaveHook>,
|
|
208
|
-
recorder: Option<OrderRecorder>,
|
|
209
|
-
) -> (
|
|
210
|
-
Coordinator,
|
|
211
|
-
std::sync::Arc<std::sync::Mutex<Vec<&'static str>>>,
|
|
212
|
-
) {
|
|
213
|
-
let dir = std::env::temp_dir().join(format!(
|
|
214
|
-
"team-agent-coord-tick-{}-{}",
|
|
215
|
-
std::process::id(),
|
|
216
|
-
std::time::SystemTime::now()
|
|
217
|
-
.duration_since(std::time::UNIX_EPOCH)
|
|
218
|
-
.unwrap()
|
|
219
|
-
.as_nanos()
|
|
220
|
-
));
|
|
221
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
222
|
-
let ws = WorkspacePath::new(dir);
|
|
223
|
-
let reg: Box<dyn ProviderRegistry> = Box::new(MockRegistry::new(&[], &[]));
|
|
224
|
-
let transport = MockTransport::new(session_present);
|
|
225
|
-
let calls = std::sync::Arc::clone(&transport.calls);
|
|
226
|
-
let coord = Coordinator::for_test(ws, reg, Box::new(transport), save_hook, recorder);
|
|
227
|
-
(coord, calls)
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/// Like [`coord_for_test`] but seeds a TRUTHY `session_name` into the workspace
|
|
231
|
-
/// state.json first, so the tmux-session gate actually runs. The session-missing
|
|
232
|
-
/// STOP path requires a truthy session_name (Python lifecycle.py:276
|
|
233
|
-
/// `if session_name and not _tmux_session_exists(...)`); a null/empty name skips
|
|
234
|
-
/// the gate entirely (see `p2_tick_skips_tmux_gate_when_session_name_absent`).
|
|
235
|
-
fn coord_for_test_with_session(
|
|
236
|
-
session_present: bool,
|
|
237
|
-
session_name: &str,
|
|
238
|
-
) -> (
|
|
239
|
-
Coordinator,
|
|
240
|
-
std::sync::Arc<std::sync::Mutex<Vec<&'static str>>>,
|
|
241
|
-
) {
|
|
242
|
-
let dir = std::env::temp_dir().join(format!(
|
|
243
|
-
"team-agent-coord-tick-sess-{}-{}",
|
|
244
|
-
std::process::id(),
|
|
245
|
-
std::time::SystemTime::now()
|
|
246
|
-
.duration_since(std::time::UNIX_EPOCH)
|
|
247
|
-
.unwrap()
|
|
248
|
-
.as_nanos()
|
|
249
|
-
));
|
|
250
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
251
|
-
crate::state::persist::save_runtime_state(
|
|
252
|
-
&dir,
|
|
253
|
-
&serde_json::json!({ "session_name": session_name }),
|
|
254
|
-
)
|
|
255
|
-
.unwrap();
|
|
256
|
-
let ws = WorkspacePath::new(dir);
|
|
257
|
-
let reg: Box<dyn ProviderRegistry> = Box::new(MockRegistry::new(&[], &[]));
|
|
258
|
-
let transport = MockTransport::new(session_present);
|
|
259
|
-
let calls = std::sync::Arc::clone(&transport.calls);
|
|
260
|
-
let coord = Coordinator::for_test(ws, reg, Box::new(transport), None, None);
|
|
261
|
-
(coord, calls)
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/// A save hook that always fails (bug-084 forced persistence failure).
|
|
265
|
-
fn failing_save_hook() -> SaveHook {
|
|
266
|
-
Box::new(|_ws, _state| {
|
|
267
|
-
Err(crate::state::StateError::SaveFailed(
|
|
268
|
-
"injected tick-end save failure".to_string(),
|
|
269
|
-
))
|
|
270
|
-
})
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
fn read_event_log_dir(dir: &std::path::Path) -> Vec<serde_json::Value> {
|
|
274
|
-
let path = crate::model::paths::logs_dir(dir).join("events.jsonl");
|
|
275
|
-
match std::fs::read_to_string(&path) {
|
|
276
|
-
Ok(text) => text
|
|
277
|
-
.lines()
|
|
278
|
-
.filter_map(|l| serde_json::from_str(l).ok())
|
|
279
|
-
.collect(),
|
|
280
|
-
Err(_) => Vec::new(),
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
mod a0_lostupdate;
|
|
285
|
-
mod s3_bounded;
|
|
286
|
-
mod abnormal;
|
|
287
|
-
mod api_error_recovery;
|
|
288
|
-
mod basics;
|
|
289
|
-
mod daemon;
|
|
290
|
-
mod energy;
|
|
291
|
-
mod health_sync;
|
|
292
|
-
mod main_preserved;
|
|
293
|
-
mod spine;
|
|
294
|
-
mod takeover;
|
|
295
|
-
mod tick_core;
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
use super::*;
|
|
2
|
-
use serde_json::json;
|
|
3
|
-
use std::io::{BufRead, Write};
|
|
4
|
-
use std::path::{Path, PathBuf};
|
|
5
|
-
use std::process::{Child, Command, Stdio};
|
|
6
|
-
use crate::state::repository::{StateRepository, StateWriteIntent};
|
|
7
|
-
|
|
8
|
-
const WORKER: &str = "coordinator::tests::s3_bounded::s3_process_worker";
|
|
9
|
-
|
|
10
|
-
fn isolated(name: &str, check: impl FnOnce(&Path)) {
|
|
11
|
-
if std::env::var("TA_S3_CASE").as_deref() == Ok(name) {
|
|
12
|
-
check(&std::env::current_dir().unwrap());
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
let dir = std::env::temp_dir().join(format!("ta-s3-{name}-{}", std::process::id()));
|
|
16
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
17
|
-
let output = Command::new(std::env::current_exe().unwrap())
|
|
18
|
-
.args(["--exact", &format!("coordinator::tests::s3_bounded::{name}"), "--nocapture"])
|
|
19
|
-
.env_clear().env("HOME", dir.join("home")).env("TA_S3_CASE", name)
|
|
20
|
-
.current_dir(&dir).output().unwrap();
|
|
21
|
-
print!("{}", String::from_utf8_lossy(&output.stdout));
|
|
22
|
-
assert!(output.status.success(), "{}", String::from_utf8_lossy(&output.stderr));
|
|
23
|
-
std::fs::remove_dir_all(dir).unwrap();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
fn disk(dir: &Path) -> Value {
|
|
27
|
-
serde_json::from_str(&std::fs::read_to_string(crate::state::persist::runtime_state_path(dir)).unwrap()).unwrap()
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
fn seed(dir: &Path, legacy: bool) {
|
|
31
|
-
std::fs::create_dir_all(dir).unwrap();
|
|
32
|
-
let team = |key: &str| {
|
|
33
|
-
let spec = dir.join(".team/runtime").join(key).join("team.spec.yaml");
|
|
34
|
-
std::fs::create_dir_all(spec.parent().unwrap()).unwrap();
|
|
35
|
-
std::fs::write(&spec, format!("name: {key}\nagents: []\ntasks: []\n")).unwrap();
|
|
36
|
-
json!({
|
|
37
|
-
"session_name": key, "team_dir": dir.join(".team").join(key), "spec_path": spec,
|
|
38
|
-
"agents": {"w1": {"agent_id": "w1", "provider": "fake", "status": "running",
|
|
39
|
-
"window": "w1", "pane_id": "%11", "spawn_epoch": 1,
|
|
40
|
-
"session_id": "fixture-session", "startup_prompts": "handled"}},
|
|
41
|
-
"tasks": [{"id": "original", "title": "Original task", "assignee": "w1", "status": "pending"}],
|
|
42
|
-
"notes": ["original note"]
|
|
43
|
-
})
|
|
44
|
-
};
|
|
45
|
-
let mut state = team("T1");
|
|
46
|
-
state["active_team_key"] = json!("T1");
|
|
47
|
-
if !legacy { state["teams"] = json!({"T1": state.clone(), "T2": team("T2")}); }
|
|
48
|
-
crate::state::persist::save_runtime_state(dir, &state).unwrap();
|
|
49
|
-
MessageStore::open(dir).unwrap();
|
|
50
|
-
std::fs::write(dir.join("result.json"), json!({
|
|
51
|
-
"schema_version": "result_envelope_v1", "result_id": "result-original",
|
|
52
|
-
"task_id": "original", "agent_id": "w1", "status": "success", "summary": "done",
|
|
53
|
-
"artifacts": [], "changes": [], "tests": [], "risks": [], "next_actions": []
|
|
54
|
-
}).to_string()).unwrap();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
fn task(id: &str) -> Value { json!({"id": id, "title": id, "assignee": "w1"}) }
|
|
58
|
-
|
|
59
|
-
fn start_writer(dir: &Path, action: &str, team: Option<&str>, payload: Value, pause: bool) -> Child {
|
|
60
|
-
let mut child = Command::new(std::env::current_exe().unwrap())
|
|
61
|
-
.args(["--exact", WORKER, "--ignored", "--nocapture"])
|
|
62
|
-
.env_clear().env("HOME", dir.join("home"))
|
|
63
|
-
.env("TA_S3_ACTION", action).env("TA_S3_TEAM", team.unwrap_or(""))
|
|
64
|
-
.env("TA_S3_PAYLOAD", payload.to_string()).env("TA_S3_PAUSE", if pause { "1" } else { "0" })
|
|
65
|
-
.current_dir(dir).stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::piped())
|
|
66
|
-
.spawn().unwrap();
|
|
67
|
-
if pause {
|
|
68
|
-
let mut reader = std::io::BufReader::new(child.stdout.take().unwrap());
|
|
69
|
-
loop {
|
|
70
|
-
let mut line = String::new();
|
|
71
|
-
assert!(reader.read_line(&mut line).unwrap() > 0, "writer exited before barrier");
|
|
72
|
-
print!("{line}");
|
|
73
|
-
if line.contains("S3_READY") { break; }
|
|
74
|
-
}
|
|
75
|
-
child.stdout = Some(reader.into_inner());
|
|
76
|
-
}
|
|
77
|
-
child
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
fn finish(mut child: Child, paused: bool) {
|
|
81
|
-
if paused { child.stdin.take().unwrap().write_all(b"commit\n").unwrap(); }
|
|
82
|
-
let output = child.wait_with_output().unwrap();
|
|
83
|
-
print!("{}", String::from_utf8_lossy(&output.stdout));
|
|
84
|
-
assert!(output.status.success(), "{}", String::from_utf8_lossy(&output.stderr));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
fn write(dir: &Path, action: &str, team: Option<&str>, payload: Value) {
|
|
88
|
-
finish(start_writer(dir, action, team, payload, false), false);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
#[test]
|
|
92
|
-
#[ignore = "hermetic subprocess entry; parent contracts invoke this exact test"]
|
|
93
|
-
fn s3_process_worker() {
|
|
94
|
-
let dir = std::env::current_dir().unwrap();
|
|
95
|
-
let action = std::env::var("TA_S3_ACTION").unwrap();
|
|
96
|
-
let team = std::env::var("TA_S3_TEAM").unwrap();
|
|
97
|
-
let team = (!team.is_empty()).then_some(team.as_str());
|
|
98
|
-
let payload: Value = serde_json::from_str(&std::env::var("TA_S3_PAYLOAD").unwrap()).unwrap();
|
|
99
|
-
if std::env::var("TA_S3_PAUSE").as_deref() == Ok("1") {
|
|
100
|
-
crate::state::repository::test_support::set_before_commit(|| {
|
|
101
|
-
println!("S3_READY");
|
|
102
|
-
std::io::stdout().flush().unwrap();
|
|
103
|
-
let mut line = String::new();
|
|
104
|
-
std::io::stdin().read_line(&mut line).unwrap();
|
|
105
|
-
assert_eq!(line.trim(), "commit");
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
match action.as_str() {
|
|
109
|
-
"collect" => {
|
|
110
|
-
let output = crate::messaging::results::collect_for_team(&dir, Some(&dir.join("result.json")), false, team).unwrap();
|
|
111
|
-
assert_eq!(output["ok"], true);
|
|
112
|
-
println!("S3 collect={output}");
|
|
113
|
-
}
|
|
114
|
-
"sibling" => {
|
|
115
|
-
let mut state = StateRepository::new(&dir).load_workspace().unwrap();
|
|
116
|
-
state["teams"]["T3"] = json!({"session_name": "T3", "tasks": [task("third")], "notes": ["third"]});
|
|
117
|
-
StateRepository::new(&dir).save(StateWriteIntent::LaunchTeam { team_key: "T3" }, &state).unwrap();
|
|
118
|
-
}
|
|
119
|
-
"topology" => {
|
|
120
|
-
let mut state = StateRepository::new(&dir).load_team(Some("T1")).unwrap();
|
|
121
|
-
state["agents"]["w1"]["pane_id"] = json!("%22");
|
|
122
|
-
state["agents"]["w1"]["spawn_epoch"] = json!(2);
|
|
123
|
-
// A concurrent restart owns topology for this agent. StartAgent's
|
|
124
|
-
// add-only tail intentionally carries no existing-agent authority.
|
|
125
|
-
StateRepository::new(&dir).save(StateWriteIntent::RestartTeam {
|
|
126
|
-
team_key: "T1", topology_authority_agent_ids: &["w1"],
|
|
127
|
-
skip_capture_backfill_agent_ids: &[],
|
|
128
|
-
}, &state).unwrap();
|
|
129
|
-
assert_eq!(disk(&dir)["teams"]["T1"]["agents"]["w1"]["pane_id"], "%22");
|
|
130
|
-
}
|
|
131
|
-
_ => panic!("unexpected test action"),
|
|
132
|
-
}
|
|
133
|
-
println!("S3_COMMITTED {action}");
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
fn coordinator(dir: &Path, hook: SaveHook) -> Coordinator {
|
|
137
|
-
let transport = OfflineTransport::new().with_session_present(true)
|
|
138
|
-
.with_windows(vec![WindowName::new("live-peer")]);
|
|
139
|
-
Coordinator::for_test(WorkspacePath::new(dir.to_path_buf()),
|
|
140
|
-
Box::new(MockRegistry::new(&[], &[])), Box::new(transport), None, None)
|
|
141
|
-
.with_before_save_hook(hook)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
#[test]
|
|
145
|
-
fn s3_tick_preserves_tasks_notes_and_siblings() {
|
|
146
|
-
isolated("s3_tick_preserves_tasks_notes_and_siblings", |dir| {
|
|
147
|
-
seed(dir, false);
|
|
148
|
-
let hook: SaveHook = Box::new(|ws, observed| {
|
|
149
|
-
assert_eq!(observed["agents"]["w1"]["worker_state"], "DEAD", "tick must produce a real observation delta");
|
|
150
|
-
write(ws.as_path(), "collect", Some("T1"), Value::Null);
|
|
151
|
-
write(ws.as_path(), "sibling", None, Value::Null);
|
|
152
|
-
let latest = disk(ws.as_path());
|
|
153
|
-
assert_eq!(latest["teams"]["T1"]["agents"]["w1"]["pane_id"], observed["agents"]["w1"]["pane_id"]);
|
|
154
|
-
println!("S3 before tick save topology unchanged; committed business={}", latest["teams"]);
|
|
155
|
-
Ok(())
|
|
156
|
-
});
|
|
157
|
-
let report = coordinator(dir, hook).tick().unwrap();
|
|
158
|
-
assert!(report.ok, "tick must save its observation: {report:?}");
|
|
159
|
-
let state = disk(dir);
|
|
160
|
-
let team = &state["teams"]["T1"];
|
|
161
|
-
assert_eq!(team["tasks"][0]["id"], "original");
|
|
162
|
-
assert_eq!(team["tasks"][0]["accepted_result_id"], "result-original");
|
|
163
|
-
assert_eq!(team["notes"], json!(["original note"]));
|
|
164
|
-
assert_eq!(team["agents"]["w1"]["worker_state"], "DEAD");
|
|
165
|
-
assert_eq!(state["teams"]["T2"]["notes"], json!(["original note"]));
|
|
166
|
-
assert_eq!(state["teams"]["T3"]["notes"], json!(["third"]));
|
|
167
|
-
assert_eq!(state["tasks"], team["tasks"]);
|
|
168
|
-
assert_eq!(StateRepository::new(dir).load_team(Some("T1")).unwrap()["tasks"], team["tasks"]);
|
|
169
|
-
println!("S3 after tick save={state}");
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
#[test]
|
|
174
|
-
fn s3_result_collection_commit_preserves_concurrent_sibling() {
|
|
175
|
-
isolated("s3_result_collection_commit_preserves_concurrent_sibling", |dir| {
|
|
176
|
-
seed(dir, false);
|
|
177
|
-
let waiting = start_writer(&dir, "collect", Some("T1"), Value::Null, true);
|
|
178
|
-
write(&dir, "sibling", None, Value::Null);
|
|
179
|
-
finish(waiting, true);
|
|
180
|
-
let state = disk(&dir);
|
|
181
|
-
assert_eq!(state["teams"]["T1"]["tasks"][0]["accepted_result_id"], "result-original");
|
|
182
|
-
assert_eq!(state["teams"]["T3"]["notes"], json!(["third"]));
|
|
183
|
-
assert_eq!(state["teams"]["T2"]["notes"], json!(["original note"]));
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
#[test]
|
|
188
|
-
fn s3_legacy_result_collection_preserves_root_shape() {
|
|
189
|
-
isolated("s3_legacy_result_collection_preserves_root_shape", |dir| {
|
|
190
|
-
seed(dir, true);
|
|
191
|
-
write(dir, "collect", None, Value::Null);
|
|
192
|
-
let state = disk(dir);
|
|
193
|
-
assert_eq!(state["tasks"][0]["accepted_result_id"], "result-original");
|
|
194
|
-
assert!(state.get("teams").is_none(), "legacy single Team shape remains valid");
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
#[test]
|
|
199
|
-
fn s3_observation_keeps_live_topology_conflict() {
|
|
200
|
-
isolated("s3_observation_keeps_live_topology_conflict", |dir| {
|
|
201
|
-
seed(dir, false);
|
|
202
|
-
let hook: SaveHook = Box::new(|ws, _| { write(ws.as_path(), "topology", Some("T1"), Value::Null); Ok(()) });
|
|
203
|
-
let report = coordinator(dir, hook).tick().unwrap();
|
|
204
|
-
assert_eq!(report.reason, Some(TickStopReason::PersistenceDegraded));
|
|
205
|
-
assert_eq!(disk(dir)["teams"]["T1"]["agents"]["w1"]["pane_id"], "%22");
|
|
206
|
-
});
|
|
207
|
-
}
|