Repository navigation
Commit ea3a63a
feat: subscription auth for Claude and Codex (OAuth token, ChatGPT login, credential refresh) (#60)
* feat(api): add subscription auth methods to ModelConfig
Add anthropic.authMethod (apiKey | oauthToken) and openAI.authMethod
(apiKey | chatGPT) with openAI.accountID and openAI.responsesTransport.
CEL rules require accountID for chatGPT and limit accountID and
responsesTransport to chatGPT. In chatGPT mode baseUrl replaces the
default Codex subscription backend.
Generated CRD manifests follow in a separate commit.
Signed-off-by: James Olds <12104969+oldsj@users.noreply.github.com>
(cherry picked from commit a71c97c)
* feat(claude): support Claude subscription OAuth tokens
With anthropic.authMethod oauthToken, the Claude Harness gets an inert
CLAUDE_CODE_OAUTH_TOKEN placeholder, and the egress gateway injects the
real token from the referenced Secret as an Authorization: Bearer header.
API-key mode is unchanged.
Signed-off-by: James Olds <12104969+oldsj@users.noreply.github.com>
(cherry picked from commit a3fc473)
* feat(codex): support ChatGPT subscription auth
With openAI.authMethod chatGPT, the Codex adapter writes a synthetic
auth.json (inert JWTs, no refresh token) and removes API-key variables,
so the Actor never holds a usable credential. The gateway binds the real
access token to the backend host: chatgpt.com by default, or the
openAI.baseUrl host when set. responsesTransport https selects a custom
provider with WebSockets disabled. The kagent ADK harness rejects
ChatGPT auth. Harness config version moves to 4.
Signed-off-by: James Olds <12104969+oldsj@users.noreply.github.com>
(cherry picked from commit 8878e05)
* feat(controller): refresh ChatGPT credentials through the Codex CLI
When KAGENT_CHATGPT_REFRESH_IMAGE is set, the leader-elected controller
schedules one Job per ChatGPT Secret before the access token expires.
The Job runs the pinned official Codex CLI (app-server account/read with
refreshToken) against a tmpfs CODEX_HOME. It then commits the rotated
auth.json and access token in one version-checked Secret update. Job
RBAC is scoped to that Secret by resourceNames.
A refresh attempt that fails after it may have spent the refresh token
marks the ModelConfig ResolvedRefs=False with ReauthenticationRequired
instead of retrying. Re-seeding the Secret clears it. The Codex image
now ships the kagent-credential-refresh binary.
Signed-off-by: James Olds <12104969+oldsj@users.noreply.github.com>
(cherry picked from commit baaeebf)
* docs: describe subscription credential injection
Document Claude OAuth tokens, Codex ChatGPT mode, including the default
backend, baseUrl override and host binding, and the dedicated-login
seeding and refresh lifecycle.
Signed-off-by: James Olds <12104969+oldsj@users.noreply.github.com>
(cherry picked from commit 7a1513d)
* feat: bootstrap ChatGPT runtime credentials from a seed Secret (#3)
(cherry picked from commit 7e3b3b3)
* Codex harness: report expired auth clearly without leaking upstream error text (#32)
* fix(codex): expose safe native turn failure diagnostics
Signed-off-by: James Olds <12104969+oldsj@users.noreply.github.com>
* test(auth): verify renewal after runtime credential replacement
Signed-off-by: James Olds <12104969+oldsj@users.noreply.github.com>
* fix(codex): restrict public failures to fixed summaries
Signed-off-by: James Olds <12104969+oldsj@users.noreply.github.com>
---------
Signed-off-by: James Olds <12104969+oldsj@users.noreply.github.com>
(cherry picked from commit 656163a)
* feat(helm): gate credential refresh RBAC and move its settings to controller config
Upstream narrowed the controller's roles, so the Job, ServiceAccount,
Role, RoleBinding, NetworkPolicy and Secret-update permissions the
ChatGPT refresh needs get their own role, rendered only when
config.credentialRefresh.chatgptImage enables refresh. The image setting
replaces the KAGENT_CHATGPT_REFRESH_IMAGE environment variable.
The refresh worker now requires the Codex CLI version the Codex Harness
image pins instead of a separate constant. Regenerate the ModelConfig
CRD, update the model discovery expectations, and run the chart unit
tests and the subscription packages in fork CI.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: James Olds <12104969+oldsj@users.noreply.github.com>
---------
Signed-off-by: James Olds <12104969+oldsj@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>1 parent f5c589d commit ea3a63a
40 files changed
Lines changed: 2876 additions & 237 deletions
File tree
- .github/workflows
- docs/architecture
- go
- api
- gen/kagent/config/v1
- v1alpha3
- core
- cmd/credential-refresh
- internal
- controller
- chatgptrefresh
- service/model
- translator
- adkconfig
- claude
- codex
- pkg/app
- harness
- claude/config
- codex
- config
- internal
- adapter
- driver
- helm
- kagent-crds/templates
- kagent
- templates/rbac
- tests
- proto/kagent/config/v1
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
80 | 109 | | |
81 | 110 | | |
82 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
195 | 197 | | |
196 | 198 | | |
197 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
0 commit comments