Repository navigation
Description
Observed behavior
In an Agent Canvas Docker deployment, an automation-created Codex ACP conversation fails immediately with ACPAuthRequired: [-32000] Authentication required, while a separate interactive Codex conversation using the same profile and ChatGPT account works. The review automation reported its worker run as completed after creating the failed conversation.
The agent server reports OpenHands SDK v1.59.0, with codex-acp 2.2.2. The failed conversation was created on 2026-11-06 at 01:55 UTC and produced the same error on subsequent attempts. Its runtime was no longer available for inspection; the recorded event does not include the underlying provider error.
Credential evidence
The active profile configures CODEX_AUTH_JSON as the Codex auth.json file secret in a per-conversation CODEX_HOME. Without printing credentials, we compared the stored secret and the working interactive conversation's local file:
- Both refer to the same account.
- The stored secret recorded
last_refreshat 02:03 UTC; the conversation-local file recorded 02:15 UTC. - Both the access tokens and refresh tokens differed. The local file is a regular file, not a symlink.
This establishes that the running conversation's credential changed without the credential exposed through the settings secret endpoint converging at the time of inspection. It does not establish whether the failed conversation used that exact stale generation, whether the provider rejected a reused token, or whether concurrent refresh occurred. The UI-visible error is insufficient to distinguish these cases.
Expected behavior
Isolated conversations using one ChatGPT login should receive current credentials after a refresh, and concurrent processes must not race the same rotating refresh token. Alternatively, unsupported concurrent use should be detected and explained. Automation runs should report a failed child conversation as a failure rather than success.
Relevant existing work
- Support concurrent-safe Codex auth refresh in Agent Canvas Docker #4268 describes the same Agent Canvas Docker topology and was closed pending evidence of an incident.
- Phase 1: propagate rotated Codex credentials across sequential ACP conversations #4170 discusses cross-conversation write-back; Phase 2: coordinate concurrent Codex credential refresh across ACP conversations #4171 discusses the distinct concurrency race.
- In current SDK source,
ConversationService._resolve_credential_bindingsactivatesLocalVersionedCredentialBindingonly when the local agent server's secret store has the Codex credential. OtherwiseACPAgent._materialise_file_secretsuses the ordinary per-conversation file-secret path. Please investigate whether the Docker conversation runtime receives a binding or takes that fallback, and whether its rotated credential reaches the authoritative host store.
Suggested investigation
- Reproduce on the affected Docker topology with two isolated conversations and a real or test-controlled token rotation; inspect only sanitized refresh outcomes and credential generations.
- Verify that a new conversation receives the latest credential, including across runtime restart, and that simultaneous refreshes cannot race at the provider.
- Preserve a sanitized underlying authentication reason such as
refresh_token_reusedwhen available; do not log credentials. - Check why the automation worker reported success after its child entered
error.
This report was prepared by an AI assistant on behalf of the user.
OpenHands AI triage
The following comments and acceptance criteria were added by the OpenHands AI agent.
Triage
Scope grounded in this repository (SDK + Agent Server), maintainer precedent on the directly analogous closed issues (#4170, #4171, #4268 — closed not_planned with the caveat that this Docker topology was "unobserved, not disproven"), and the code cited in the report: ConversationService._resolve_credential_bindings (openhands-agent-server/openhands/agent_server/conversation_service.py) activates LocalVersionedCredentialBinding only when the local secret store holds the Codex credential; otherwise ACPAgent._materialise_file_secrets (openhands-sdk/openhands/sdk/agent/acp_agent.py) materializes a plain conversation-local copy of CODEX_AUTH_JSON with no write-back, so a Codex rotation converges on nothing. The binding path is the existing authoritative convergence mechanism for local deployments: it resolves the credential from the server-side store at materialization and performs versioned compare-and-swap write-back (FileSecretsStore.replace_versioned_secret) when Codex rotates, reusing the mechanism confirmed deployed for the SaaS equivalent (#4124/#4198). The reporting path must fail the parent automation run when the child conversation errors.
Acceptance Criteria
- Given an Agent Server (local or Docker topology) whose secret store holds
CODEX_AUTH_JSON, a newly created Codex ACP conversation activates the versioned credential binding (LocalVersionedCredentialBinding) rather than the plain per-conversation file-secret fallback; the activation and the reason any fallback was taken are verifiable from server-side diagnostics. - When Codex rotates credentials in a bound conversation, the successor generation is written back to the agent server's secret store, and a subsequently created Codex conversation materializes the current generation rather than the pre-rotation one.
- The agent server's stored secret reflects the latest rotation after a bound conversation stops, restarts, or is paused and resumed.
- An ACP authentication failure on a Codex conversation surfaces a sanitized underlying reason (e.g.,
refresh_token_reused) in conversation events or server logs, without credentials or tokens in any log, event payload, or error message. - When an automation-created child conversation reaches the
errorexecution status, the parent run reports failure rather than completion. (Observed on the OpenHands/automation side; any SDK/agent-server contribution here is limited to making the child's error status observable through the public conversation API.) - The concurrency race is explicitly out of scope for this issue: simultaneous refreshes across conversations are not fenced in this change (per Phase 2: coordinate concurrent Codex credential refresh across ACP conversations #4171's closed, evidence-based deferral); if unsupported concurrent use is detected during this work, its behavior is documented in the PR but no fencing is required.
Activity