--- kind: task slug: agent-harness-chat-streaming title: Normalize harness run events for saved agents plan_slug: workspace-communications epic_slug: agent-participation status: ready priority: P1 tenant_id: global owner: unassigned cursor_todo_id: null updated_at: "2026-10-22" --- # Task summary Execute saved-agent jobs through the existing runtime-agnostic harness and normalize progress, tool, approval, failure, cancellation, and completion events for downstream consumers. ## Description A durable job supplies a pinned agent version and requested role or capability. The worker loads that definition, resolves model policy through `ResolvedModel`, selects an execution harness adapter, and emits a normalized event stream such as `run.started`, `text.delta`, `tool.requested`, `approval.required`, `run.failed`, and `run.completed`. OmniRoute remains an inference gateway reachable through provider resolution; it is not the harness. This task owns runtime execution, normalized persisted run/tool/approval events, and recoverable checkpoints; it does not project events into chat, persist the final chat message, or create notifications. ## Subtasks - [ ] Define or extend the harness contract for normalized asynchronous run events. - [ ] Adapt the current OpenCode worker runtime and model-routing flow without chat-specific provider branches. - [ ] Persist normalized run/tool/approval events and recoverable checkpoints behind a consumer-neutral interface. - [ ] Add cancellation, approval, tool authorization, adapter parity, and failure-recovery tests. ## Owner or assignee `unassigned` ## Status `ready` ## Estimation `L` ## Acceptance criteria - [ ] Harness context assembly and each tool call revalidate context/grant/lifecycle authority; same workspace, prior approval or model-requested access cannot bypass private-object restrictions. - [ ] Chat code contains no direct OmniRoute, Anthropic, OpenAI, Google, or Vercel-specific branch. - [ ] The same chat job can run through different harness adapters using one event contract. - [ ] Normalized run/tool/approval events and checkpoints are durable and workspace-scoped. - [ ] Browser connectivity is not part of harness execution and cannot cancel a run implicitly. - [ ] Chat projection, final chat-message persistence, and notifications remain exclusively owned by `Task-agent-chat-run-delivery.md`. - [ ] `pnpm lint && pnpm type-check && pnpm test` pass; `pnpm build` passes for worker changes. ## Links to related Epic / Plan - Epic: `./Epic-agent-participation.md` - Plan: `../Plan-workspace-communications.md`