| 1 | -- A workspace's own agents (Margo, @margo) comment on issues and pull |
| 2 | -- requests, and review pull requests, as themselves, on behalf of a |
| 3 | -- person whose access caps them (src/agent_comments.rs). Such a comment |
| 4 | -- is stored with the agent as its author (author_id is the agent's id, |
| 5 | -- author_name its handle) and these columns beside it: |
| 6 | -- |
| 7 | -- agent_* the agent as it was when it wrote it, for showing it |
| 8 | -- without asking the agents service: id, handle, name |
| 9 | -- and the seed its pixel face is drawn from. |
| 10 | -- acting_for_* the person it acted for: their id and username. They |
| 11 | -- answer for it as its author would (edit, delete). |
| 12 | -- agent_verdict an agent review's verdict: comment, approve or |
| 13 | -- request_changes. Kept apart from `verdict` on purpose: |
| 14 | -- every rule that counts approvals or requests for |
| 15 | -- changes (required approvals, code owners, a person's |
| 16 | -- request for changes, confidence, contributions) reads |
| 17 | -- `verdict`, so an agent's review is advisory by |
| 18 | -- construction and never satisfies or blocks a merge. |
| 19 | ALTER TABLE comments ADD COLUMN agent_id TEXT; |
| 20 | ALTER TABLE comments ADD COLUMN agent_handle TEXT; |
| 21 | ALTER TABLE comments ADD COLUMN agent_name TEXT; |
| 22 | ALTER TABLE comments ADD COLUMN agent_avatar_seed TEXT; |
| 23 | ALTER TABLE comments ADD COLUMN acting_for_id TEXT; |
| 24 | ALTER TABLE comments ADD COLUMN acting_for_name TEXT; |
| 25 | ALTER TABLE comments ADD COLUMN agent_verdict TEXT; |
| 26 | |
| 27 | -- How many times an agent wrote on one issue or pull request lately, for |
| 28 | -- its rate limit. |
| 29 | CREATE INDEX IF NOT EXISTS comments_by_agent ON comments (agent_id, repo_id, number, created_at) |
| 30 | WHERE agent_id IS NOT NULL; |