Repository navigation
fix(auth): let agent exec reuse shared OAuth - #143744
sergeseyfetdinov wants to merge 2 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 10, 2026, 1:57 AM ET / 05:57 UTC. ClawSweeper reviewWhat this changesAllows temporary agent exec runs to read shared OAuth credentials in memory and directs shared OAuth refresh writes to the original credential store. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 12 items remain This addresses a current, independently reported OAuth gap, but refresh ownership is incomplete: local profiles can target the shared store, captured credentials can survive deletion, and refresh coordination still follows temporary state. Priority: P2 Review scores
Verification
How this fits togetherAgent exec runs one agent turn with temporary session state while borrowing the operator’s configured credentials. The auth subsystem selects credentials and coordinates refreshes before supplying access tokens to the model runtime. flowchart TD
A[Agent exec request] --> B[Temporary run scope]
C[Configured agent credentials] --> D[Credential selection]
E[Shared OAuth store] --> D
B --> D
D --> F[Refresh ownership and locking]
F --> E
F --> G[Model runtime]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The authority review found that captured shared OAuth can override durable deletion during refresh; no dependency or supply-chain changes were introduced. PR surfaceSource +12, Tests +107, Docs 0. Total +119 across 6 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Carry one explicit credential owner through selection, authoritative reads, refresh locks, peer discovery, and persistence while preserving local overrides and the environment-only opt-out. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main removes shared OAuth before temporary exec resolves credentials, matching the v2026.9.3 report. The introduced refresh defects are source-traceable; no contributor code or tests were executed. Is this the best way to solve the issue? No, not yet: borrowing credentials is appropriate, but changing only visibility and write routing leaves owner resolution, authoritative reads, and refresh coordination inconsistent. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f2539206906a. LabelsLabel justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…orized `openclaw agent exec` runs against a disposable state root, and the MCP OAuth store, its pending-authorization rows, and the refresh lease all resolved through that root. Every OAuth MCP server the operator had signed in to with `openclaw mcp login` therefore failed at run start with `requires OAuth authorization. Run openclaw mcp login <server>`, and following that advice could not help because the login lands in the operator store the run never reads. MCP OAuth sessions are operator credentials, so they now follow the original shared state root exactly like stored auth profiles do: `agent exec` pins the MCP OAuth store to that root for the run, and reads, rotated-token writes, and the cross-process refresh lease resolve there. The temporary state never holds a credential copy and the run never becomes a second refresh owner. `--auth-env-only` keeps disabling stored credential access, MCP sessions included. Related: openclaw#124768, openclaw#143744
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Related: #124768
What Problem This Solves
Fixes an issue where users running
openclaw agent execwith a stored shared OAuth login would see the selected profile as unavailable after the command switched into temporary run state.Why This Change Was Made
The bounded exec scope now exposes shared OAuth as an owner-tagged in-memory read-through alongside portable static credentials. Inherited credentials are never written into the temporary agent store, while OAuth refresh locking and rotated-token persistence remain on the canonical shared SQLite owner.
--auth-env-onlyremains a complete stored-auth opt-out.User Impact
Users can run isolated
agent execturns with their existing shared OAuth login without copying credentials or reauthenticating, and without creating a second refresh-token owner.Evidence
agent-exec.auth, auth publication ownership, and external OAuth ownership suites.node scripts/check-changed.mjs --base upstream/main: passed all selected core, core-test, docs, formatting, lint, typecheck, dead-code, boundary, and policy gates on Node 24.20.0.agent execagainst an existing stored OpenAI OAuth profile returned exactlySOURCE_AGENT_EXEC_OAUTH_OKusingopenai/gpt-5.6-solwith no fallback.--auth-env-onlyisolation.