Repository navigation
feat(cloud-worker): mount subscription logins for the run and write refreshed tokens back - #2073
Merged
Merged
Conversation
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.
Summary
agent-relay cloud workernow mounts a workspace's subscription logins (Codex ChatGPT and Grok auth files) for the run, and writes refreshed tokens back. This is the worker half of self-hosted Coding agents (AgentWorkforce/relaycontrol,selfhost/coding-agents-subscription-logins) and mirrors how hosted Cloud mounts~/.codex/auth.jsoninto its sandboxes. Khaliq asked for login credentials to be held server-side the way hosted Cloud does.Flow
cliCredentialsto the assignment payload:{ ref, expiresAt, path: "/api/v1/workers/{workerId}/assignments/<runId>/cli-credentials", credentials: [...] }. The ref is a short-lived, run-scoped reference, not the files. The new field is optional inWorkerWorkflowPayload, and payloads without it behave exactly as before.GET <baseUrl><path>with its worker token plusX-Cli-Credential-Ref./api/paths are accepted, so the reference never leaves the control plane origin.<runDir>/.cli-home/<dir>/<file>, with mode 0600 inside 0700 directories.CODEX_HOMEandGROK_HOMEmay be set, and directory and file names are validated, so a hostile response can't escape the run dir.CODEX_HOME/GROK_HOMEpoint at those directories and win over inherited values.AGENT_RELAY_SUBSCRIPTION_LOGINS=codex,groklets relayflows give the subscription precedence overOPENAI_API_KEY/XAI_API_KEY(fix(core): subscription logins win over API keys for their CLI relayflows#65).PUT .../cli-credentials/<id>.Tests
cloud-worker-cli-credentials.test.ts:homeEnvand a path traversal.On sf-frame:
npm ci,npm run typecheck, the new tests andcloud.test.ts(78 tests) pass, and prettier is clean.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Agent Relay sessions
claudesessiona19e66d9· opened viagh pr create· last active 2026-11-04