Repository navigation
feat: bootstrap ChatGPT runtime credentials from a seed Secret - #3
Merged
Merged
Conversation
oldsj
added a commit
that referenced
this pull request
Nov 10, 2026
(cherry picked from commit 7e3b3b3)
oldsj
added a commit
that referenced
this pull request
Nov 10, 2026
…gin, 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When ChatGPT credentials are imported by an external secret operator, an empty runtime Secret currently requires a manual copy before Codex can start. Add an opt-in seed reference so the existing leader-owned credential controller initializes the runtime Secret automatically once valid seed credentials become available.
Use the runtime Secret annotation
kagent.dev/chatgpt-auth-seed-secretto reference a seed Secret in the same namespace. Validate credential consistency, expiry and ModelConfig account/key agreement before an atomic update. Reject ineligible or actively owned destinations and preserve existing credentials and metadata. Subsequent seed changes do not overwrite the runtime credentials; the existing refresher owns rotation after initialization. Missing seeds wait, and failures do not expose credential values.Validation: focused chatgptrefresh Go tests and vet passed; independent Astra review accepted the exact candidate. Fixtures cover delayed seeds, invalid data, account conflicts, ownership, races, metadata preservation and restart behavior. Live Kubernetes/provider acceptance remains a deployment gate.