Repository navigation
feat: add CLI commands to manage AI Gateway keys - #25689
Conversation
d80b484 to
a3c0764
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
@pawbana if this is a WIP can you make it a draft PR? |
ba4650a to
1eea0de
Compare
a3c0764 to
dea0ea0
Compare
1eea0de to
226a1b6
Compare
dea0ea0 to
ab30aa1
Compare
226a1b6 to
3140926
Compare
ab30aa1 to
fd90423
Compare
3140926 to
e929815
Compare
Docs preview📖 View docs preview for |
fd90423 to
e6f1f5e
Compare
e929815 to
2da5a54
Compare
e6f1f5e to
f6f84b1
Compare
c4c363c to
e953487
Compare
9b40bf8 to
432c1ea
Compare
e953487 to
ac72698
Compare
432c1ea to
bf3f6a7
Compare
6188504 to
1ed0e5c
Compare
d365992 to
2f6ac7f
Compare
e58391e to
f039577
Compare
188d365 to
f694bee
Compare
|
/coder-agents-review |
|
Chat: Review posted | View chat Review history
deep-review v0.7.1 | Round 2 | Last posted: Round 2, 9 findings (5 P3, 4 Nit), COMMENT. Review Finding inventoryFindings
| CRF-12 | Nit | Open | enterprise/cli/aigateway.go:18 | Parent Round logRound 1Panel (15 reviewers + Netero). Netero clean. 1 P2, 5 P3, 2 Nit posted. 2 Nit dropped, 1 Note dropped. Reviewed against b9c3eea..f694bee. Round 2Panel (6 reviewers + Netero). CRF-1 through CRF-8 verified fixed. 2 Nit posted, 3 Nit dropped. Reviewed against 9f2d88f..3d29d0d. About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
There was a problem hiding this comment.
Clean CLI surface for AI Gateway key management. Good test density (56.5%), proper use of shared CLI primitives, and the enterprise command list alphabetization is a nice touch.
Severity count: 1 P2, 5 P3, 2 Nit.
The dominant finding (10 of 15 reviewers flagged it): the PR description promises delete <name | id> but the code only accepts UUID. The code is internally consistent; the description is the outlier. This needs either a description fix or a name-lookup implementation.
Secondary theme: the ai / aibridge namespace split. Both gate on FeatureAIBridge, both manage the same product area, and both appear side by side in coder --help with no cross-reference. This is a product decision, but it's now user-visible.
"A user who creates a key with
coder ai gateway keys create my-keyand then triescoder ai gateway keys delete my-keywill get:parse AI Gateway key ID "my-key": invalid UUID length: 6. That error message doesn't explain what they should do instead." (Pariston)
🤖 This review was automatically generated with Coder Agents.
f694bee to
3820e9b
Compare
3820e9b to
492e149
Compare
492e149 to
3d29d0d
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
All 8 findings from round 1 verified fixed in the current code. The aiGatewayKeyByNameOrID resolution is well-structured, with name-first priority and a collision test that creates a key whose name is another key's UUID. The test restructuring (extracted helpers, table-driven MemberForbidden, table output assertions, secret key validation) significantly improved test quality.
Severity count: 0 P2, 0 P3, 2 Nit new. CRF-1 through CRF-8 all confirmed resolved.
"The collision test is the real gem: it creates a key whose name is another key's ID, then proves delete resolves by name first. That's not a box-checking test; that's someone thinking about what would actually break." (Bisky)
🤖 This review was automatically generated with Coder Agents.
c1264a0 to
6419b65
Compare
dannykopping
left a comment
There was a problem hiding this comment.
LGTM, couple non-blocking nits based on my own taste.
| require.Contains(t, stdout, "Successfully created AI Gateway key "+name) | ||
|
|
||
| // The one-time secret key must be rendered as KeyLength alphanumerics. | ||
| require.Contains(t, stdout, "Save this authentication token") |
There was a problem hiding this comment.
Nit: I don't see much value in testing for this TBH.
| require.Contains(t, stdout, "Save this authentication token") | ||
| require.Len(t, aiGatewayKeyRe.FindStringSubmatch(stdout), 2, "expected secret key in create output") | ||
|
|
||
| matches := aiGatewayCreateRe.FindStringSubmatch(stdout) |
There was a problem hiding this comment.
Nit: this is flimsy. I'd prefer that we mocked the key creation so we know exactly what is being returned, and then ensure the output contains that key.
There was a problem hiding this comment.
By using real endpoints this test is more E2E like. With mocks it could only check CLI rendering which I think would be a bit lacking.

Adds
coder ai-gateway keyscommands:create <name>creates key with given namelistlists existing keys (aliasls)delete <name | id>removes key matching by name or key id, name has priority (aliasrm)