Phase-2 "integrate handoff into the run lifecycle" (docs/plan.md): hand off a run
to a new assignee with preserved ownership, artifacts, and audit history.
- POST /api/agent-os/runs/:runId/handoff (handoffRun -> markHandoffRun):
validates target agent (exists, health, task-intent support), rejects terminal
runs, reassigns assigneeAgentId while PRESERVING state/artifacts/approvals/
history, and records the from->to handoff in run.metadata.lastHandoff.
- New first-class 'handoff' RunEventType + 'recoder.run.handoff' CloudEvent type;
the handoff emits a durable run event + outbox CloudEvent (not a generic log).
Builds on the run-history/cockpit handoff visibility already shipped, completing
the handoff loop: detect (work signal) -> see (history/summary) -> act (handoff).
Verified: agent-os + agent-events check-types 0; docker-backend tsc 0; controller
test +2 handoff cases (5/5); contracts 10/10; evals 7/7; outbox/event-bridge 5/5.
Refs: docs/plan.md Phase 2 (handoff lifecycle)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>