Submatter/plans/Plan-workspace-communications/Epic-agent-participation/Task-agent-identities-and-jobs.md

57 lines
2.2 KiB
Markdown
Raw Normal View History

---
kind: task
slug: agent-identities-and-jobs
title: Add durable chat-agent jobs
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
Turn authorized direct-chat or channel invocations of saved agents into durable, bounded jobs.
## Description
Use workspace-scoped, versioned agent definitions; do not introduce a second agent profile model or fake human users. Resolve an already-authorized direct-chat invocation or channel mention into one idempotent job carrying the workspace, conversation/channel, initiating message, pinned agent version, requested role/capability, budget, and invocation policy. Add claim, retry, cancellation, and audit semantics suitable for horizontal workers. Channel membership and mention authorization are supplied by a separate task.
## Subtasks
- [ ] Add chat-agent job and attempt schemas with generated migration.
- [ ] Define zod contracts for source invocation, pinned agent version, role/capability, policy, budget, and context bounds.
- [ ] Enqueue authorized direct-chat/channel invocations transactionally through the outbox.
- [ ] Add claim/retry/cancel logic and state-machine/idempotency tests.
## Owner or assignee
`unassigned`
## Status
`ready`
## Estimation
`L`
## Acceptance criteria
- [ ] Jobs reference the single registry and pin its immutable version; new job states do not create another agent identity store.
- [ ] Enqueue/claim/execution recheck active agent lifecycle, reviewed grants and workspace AND context AND conversation access. Revocation/disable stops future use; a queued job or old approval cannot confer private-object access.
- [ ] Agent authors are distinguishable from authenticated users in storage and UI contracts.
- [ ] Unauthorized or ambiguous mentions do not enqueue a run.
- [ ] A retried message/event creates at most one agent job per invocation.
- [ ] Jobs include bounded context and workspace policy but no plaintext provider secrets.
- [ ] `pnpm lint && pnpm type-check && pnpm test` pass.
## Links to related Epic / Plan
- Epic: `./Epic-agent-participation.md`
- Plan: `../Plan-workspace-communications.md`