Commit 4a30625
authored
refactor!: simplify identity model; drop acting-user plumbing (#32)
The action creates a Coder Agents chat against a GitHub issue or PR. The chats API binds chat ownership to whoever the `coder-token` authenticates as; there is no owner override. This PR simplifies the action around that contract and pushes trigger policy out to the workflow author.
## What changed
- Drop inputs `github-user-id` and `coder-username`. The chat owner is always the token holder regardless of these inputs, so the action no longer resolves a non-token user.
- Output `coder-username` reports the token holder, read once from `GET /api/v2/users/me`.
- Workflow author defines trigger policy via `if:`; the action does not gate. GitHub's `secrets.*`-on-forks rule already covers the load-bearing case for `pull_request`. README's Security model section ships three patterns for the broader trigger surfaces.
- Drop the per-user reuse label (`coder-agents-chat-action-user`). Chats are reused by `gh-target` plus workflow name; workflows that want per-actor separation pass `idempotency-key: ${{ github.actor }}` themselves.
- Idempotency is stored as the VALUE of a fixed `coder-agents-chat-action-idempotency` label key, not as the key itself. A sanitized `idempotency-key` input can no longer collide with an action-owned label key.
- Validate `github-url` against `github.com` in a shared `parseGithubItemURL` helper. Non-github hosts and malformed paths are refused before any GitHub API call.
- Failure comments wrap `detail.message` and `chat.last_error` in a 4-backtick fenced block. Control bytes are stripped, embedded 4+-backtick runs are downgraded, and the body is capped at `DETAIL_BLOCK_MAX_CHARS` (4000) chars.
- Rewrite the README around the simpler model: one Security model section covering ownership, trigger gating, and indirect prompt injection.
Closes CODAGT-437
Closes CODAGT-394
Closes CODAGT-438
🤖 Authored by Coder Agents.1 parent 7fc11ff commit 4a30625
18 files changed
Lines changed: 784 additions & 3109 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 30 | | |
39 | | - | |
| 31 | + | |
40 | 32 | | |
41 | 33 | | |
42 | 34 | | |
| |||
67 | 59 | | |
68 | 60 | | |
69 | 61 | | |
70 | | - | |
| 62 | + | |
71 | 63 | | |
72 | 64 | | |
73 | 65 | | |
| |||
77 | 69 | | |
78 | 70 | | |
79 | 71 | | |
80 | | - | |
| 72 | + | |
81 | 73 | | |
82 | 74 | | |
83 | 75 | | |
| |||
125 | 117 | | |
126 | 118 | | |
127 | 119 | | |
128 | | - | |
| 120 | + | |
129 | 121 | | |
130 | 122 | | |
131 | 123 | | |
| |||
Large diffs are not rendered by default.
0 commit comments