fix(deploy): let --reconnect refresh a revoked harness LLM credential#235
Conversation
Cloud marks a harness credential row `connected` even after its OAuth token is revoked server-side (it never re-validates the token), so `ensureHarnessOauth`/`ensureSubscriptionOauth` short-circuited and a plain redeploy could never refresh a dead credential. `--reconnect` only reached the integrations connect path, never the LLM harness credential — leaving a manual dashboard disconnect as the only recovery. This is the codex/ChatGPT failure mode: re-running `codex login` locally rotates and revokes the refresh token cloud baked into every fire, so the pr-reviewer (and any oauth-harness persona) fails every run with "review harness exited with code 1" (401 token_invalidated) until reconnected. Thread `reconnectProviders` into `ModeLaunchInput` and both harness-oauth paths. When the user passes `--reconnect <provider>` matching the persona's model provider (openai/anthropic) or harness name (codex/claude), force a fresh `connectProvider` flow that overwrites the stored token even when cloud reports it connected. Under --no-prompt it fails with actionable guidance (the connect flow needs a TTY). Recovery is now one flag instead of a dashboard round-trip: agentworkforce deploy ./review/persona.ts --on-exists update --reconnect codex Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdds a ChangesForce-reconnect provider flow
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the deployment process to support forcing a fresh OAuth connect flow for harness LLM credentials using the --reconnect <provider> flag, even when the cloud already reports them as connected. This is particularly useful for refreshing revoked tokens without manual dashboard intervention. The changes include CLI help text updates, passing the reconnectProviders option through the deployment pipeline, implementing the reconnect logic in the cloud launcher, and adding corresponding unit tests. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 866105aa5d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ...(opts.noPrompt ? { noPrompt: true } : {}), | ||
| ...(opts.harnessSource ? { harnessSource: opts.harnessSource } : {}), | ||
| ...(opts.byokKey ? { byokKey: opts.byokKey } : {}), | ||
| ...(opts.reconnectProviders ? { reconnectProviders: opts.reconnectProviders } : {}), |
There was a problem hiding this comment.
Avoid replaying the harness reconnect after subscription setup
When useSubscription:true uses an OAuth provider that does not produce credentialSelections (notably openai/codex with no connected anthropic fallback, where resolveOauthCredentialSelections returns {}), deploy() first calls ensureCloudSubscriptionReady() with reconnectProviders and opens the fresh provider connect flow, but then launches without credentialSelections and still forwards the same reconnect request here. cloudLauncher.launch() treats missing selections as a signal to run ensureHarnessReady(), so it sees the still-connected row plus reconnectProviders and opens the same browser reconnect flow a second time in one deploy.
Useful? React with 👍 / 👎.
|
Findings
Addressed comments
Verification
Notes: the sandbox has Node |
Problem
The
pr-reviewercloud persona (and any oauth-harness persona) was failing every fire across every repo withThe review harness exited with code 1. Root cause traced via Daytona: the baked codex/ChatGPT OAuth token was revoked server-side (401 token_invalidated/refresh_token_invalidated). Each codex session ended in ~3.6s withlast_agent_message: null— the harness never authenticated.This happens whenever you re-run
codex loginlocally on the same ChatGPT account: OpenAI rotates the refresh token and revokes the copy cloud baked into each fire.The gap that made it unrecoverable from the CLI:
status: connectedeven when its stored token is revoked (it never re-validates the token).ensureHarnessOauth/ensureSubscriptionOauthshort-circuit on thatconnectedstatus, so a plain redeploy can never refresh a dead harness credential.--reconnect <provider>only flowed to the integrations connect path (connect.ts), never the LLM harness credential.The only recovery was manually disconnecting the credential in the dashboard.
Fix
Thread
reconnectProvidersintoModeLaunchInputand both harness-oauth paths. When--reconnect <provider>matches the persona's model provider (openai/anthropic) or harness name (codex/claude), force a freshconnectProviderflow that overwrites the stored token even when cloud reports it connected.connectProviderblocks until cloud stores the fresh credential, so the new token is live when deploy proceeds. Under--no-promptit fails with actionable guidance (the connect flow needs a TTY).Recovery is now one flag instead of a dashboard round-trip:
Changes
types.ts—reconnectProvidersonModeLaunchInputdeploy.ts— thread it into the launch input +ensureCloudSubscriptionReadymodes/cloud/index.ts—ensureHarnessOauth+ensureSubscriptionOauthhonor reconnect; newharnessReconnectRequested()(matches provider key or harness name)cli/src/deploy-command.ts— clarify--reconnecthelp to cover the harness LLM credentialmodes/cloud.test.ts— 2 new testsTesting
@agentworkforce/deploy: 202/202 pass (incl. the 2 new reconnect tests); typecheck clean@agentworkforce/cli:deploy-command12/12; typecheck clean🤖 Generated with Claude Code