Repository navigation
fix(codex): explain unavailable selected auth profiles - #133355
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 12:27 PM ET / 16:27 UTC. ClawSweeper reviewWhat this changesThe PR preserves a selected-auth-profile-unavailable code through Codex auth, failover, replies, and lifecycle output so operators receive bounded credential recovery guidance rather than raw profile diagnostics. Merge readinessKeep open for maintainer review. Current main still collapses the selected-profile condition into generic subscription-auth recovery; the proposed typed code and bounded renderer address that path, but direct Codex contract inspection is unavailable and the linked issue’s closing scope needs confirmation. Priority: P2 Review scores
Verification
How this fits togetherThe Codex app-server bridge resolves an agent’s selected credential before a model turn. Errors then pass through failover and reply/lifecycle projections to Gateway and Control UI users. flowchart LR
A[Selected auth profile] --> B[Codex app-server bridge]
B --> C[Typed unavailable-profile error]
C --> D[Agent failover]
D --> E[Reply and lifecycle projections]
E --> F[Gateway and Control UI]
E --> G[Bounded recovery guidance]
Decision needed
Why: The PR’s behavior proof and its closing reference both rely on facts not independently verifiable in this read-only environment. Before merge
Agent review detailsSecurityNone. PR surfaceSource +17, Tests +515. Total +532 across 17 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the single exact-code renderer and producer-side typed error, after a maintainer verifies the upstream Codex boundary and either confirms the linked issue now tracks this failure or removes the closing reference. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible: configure a selected agent profile, establish the Codex session, then remove that profile before the next turn as the added Gateway scenario does. Current main’s bridge wrapper shows why the typed condition becomes generic recovery. Is this the best way to solve the issue? Unclear: the producer-to-projection repair is a coherent narrow path, but direct verification of the claimed Codex app-server boundary and the linked issue’s scope is still required. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a8c3e4c4ffd7. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
ClawSweeper rank-up and merge-risk dispositions for exact head
Ownership is also satisfied by listed-owner authorship: live team membership shows PR and signed-commit author |
6aa6b47 to
dc3117f
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
ClawSweeper exact-head disposition for
|
|
Merged via squash.
|
Fixes #113169
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Fixes an issue where agents using the Codex app-server bridge could receive generic expired-login guidance when their selected OpenAI auth profile was missing from that agent's OpenClaw credential store.
The original refresh-miss premise in #113169 was retracted after log review. The remaining reproducible defect is the missing selected-profile path identified in the follow-up and ClawSweeper review: the bridge fails before an operational app-server RPC, but the selected-profile condition was collapsed into generic authentication recovery.
Why This Change Was Made
The Codex bridge now emits the generic allowlisted code
selected_auth_profile_unavailablefrom its existing typed status-401 missing/wrong-profile error. The failover controller preserves that code while retainingreason: "auth", so profile rotation, failure bookkeeping, and model fallback behavior stay unchanged.A shared static renderer maps only that exact code to bounded credential-import recovery. Final replies, lifecycle producers, terminal projection, persisted
lastRunError, Control UI, and Gateway chat surfaces use that renderer without exposing the profile ID, raw cause, provider text, or arbitrary plugin copy.Rejected alternatives:
errorCodefield would widen the public protocol for a presentation repair./login codexwould be wrong for an absent agent-scoped credential; existinginvalid_grantand expired-login behavior remains unchanged.User Impact
Operators now receive this bounded recovery guidance:
The failure remains status 401 and participates in the existing auth rotation/bookkeeping path. Detailed profile diagnostics remain available only in the active structured error/cause.
Reported and clarified by @Jeehut. No co-author attribution is added because the reporter did not author the code.
Evidence
Before the lifecycle-owner repair, the focused Control UI and Gateway proof exposed the selected profile and raw cause instead of bounded recovery text. After the repair, the final chat reply, public lifecycle event, persisted
lastRunError,agent.wait, and both Gateway chat projections contain only the static recovery text and exclude the profile ID, raw cause, and login button.The fake Codex app-server correctly receives
initialize, which is process setup. It receives noaccount/login/start,thread/start,thread/resume, orturn/start; the selected-profile failure occurs before operational app-server RPC. A live OpenAI call would not exercise this boundary, so the fake app-server Gateway flow is the correct end-to-end proof.Validation on exact head
dc3117ff7f907dad877156a9e269254ec85b8445, treeb8a4301d2ef7e581e74312c0e739d40696530d2d:pnpm lint: passed.pnpm format:check: passed.check:changedapplicable gates passed; the root-test graph is unavailable in this sparse worktree because tracked Android, QA broker, andui/configinputs are absent.invalid_grantcopy remains covered and unchanged.LOC: production
+51/-34(net+17); tests+524/-9(net+515). No protocol, config, persistence, public API, or dependency change.Codex app-server account/login behavior was checked directly against
openai/codexat5f49aba876922d6f2f55caa153bbb0ed1b46feba:codex-rs/app-server-protocol/src/protocol/v2/account.rs:60-85codex-rs/app-server-protocol/src/protocol/common.rs:1196-1201codex-rs/app-server/src/request_processors/account_processor.rs:327-338codex-rs/app-server/src/request_processors/account_processor.rs:369-378No documentation or changelog change: the existing OpenAI provider documentation already covers credential import/migration, and this PR corrects runtime guidance to match it.