agent-orchestrator/backend/internal/lifecycle
harshitsinghbhandari 538210844e feat(session): implement Session Manager (spawn/kill/list/get/send/restore/cleanup)
Implements ports.SessionManager against fakes for the outbound ports. The SM is
the explicit-mutation half of the lane: it drives Runtime/Agent/Workspace, seeds
the initial lifecycle, and routes outcomes to the LCM (OnSpawnCompleted /
OnKillRequested). It never derives observed state and is the single producer of
the derived display status (attached on read, never persisted).

- Spawn: Workspace.Create -> Runtime.Create (AO_* identity env) -> Seed ->
  OnSpawnCompleted, with eager rollback of completed steps on failure.
- Kill: OnKillRequested first -> Runtime.Destroy -> Workspace.Destroy, honoring
  the worktree-remove safety (refusal surfaced, never forced).
- List/Get: derive status via DeriveLegacyStatus. Send: via AgentMessenger.
  Restore: re-seed (reopen) + relaunch via GetRestoreCommand. Cleanup: reclaim
  terminal sessions, skip worktrees holding uncommitted work.

Store-contract additions (co-owned with Tom's persistence layer, flagged for
review): LifecycleStore.Seed (explicit create-with-identity; OnSpawnCompleted
requires a seeded record) and LifecycleStore.Get (single record-with-identity
read; Load is lifecycle-only). Lifecycle test fake updated to satisfy both.

Tests route through the real LCM Manager (wrapped to record call order).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 13:43:40 +05:30
..
decide_bridge.go feat(lifecycle): activity resolves detecting + review polish 2026-05-27 01:49:28 +05:30
fakes_test.go feat(session): implement Session Manager (spawn/kill/list/get/send/restore/cleanup) 2026-05-27 13:43:40 +05:30
manager.go fix(lifecycle): kill clears trackers, send-failure budget, inclusive escalation (Copilot review) 2026-05-27 13:11:00 +05:30
manager_test.go feat(lifecycle): ACT layer — reaction table + escalation engine (split B) 2026-05-27 02:17:51 +05:30
reactions.go fix(lifecycle): kill clears trackers, send-failure budget, inclusive escalation (Copilot review) 2026-05-27 13:11:00 +05:30
reactions_test.go fix(lifecycle): kill clears trackers, send-failure budget, inclusive escalation (Copilot review) 2026-05-27 13:11:00 +05:30