Skip to content

refactor(auth): bind OAuth queues to native provider owners - #177676

Merged
steipete merged 1 commit into
mainfrom
deslop/z19-83-oauth-native-owners-20261015
Oct 19, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z19-83-oauth-native-owners-20261015

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

OAuth managers carried a private four-operation adapter with one real serving implementation and test-only alternatives.

User Impact

No intended user-visible change. Independent refresh queues, credential authority, cancellation, recovery, persistence, and accepted-work settlement remain. Public runtime refresh and Plugin SDK contracts are unchanged.

Why This Change Was Made

Bind managers directly to the native provider/bootstrap owners. A small provider-operation leaf serves both the manager and the existing public runtime-refresh wrapper without a circular import. The genuine independent-manager constructor stays; this does not replace real queues with a singleton.

Fixtures now control external provider I/O at the actual module boundary while exercising real locks, workers, claims, and store mutation. Only the impossible test that mutates a full credential through a capability query is removed: the native capability API receives provider/config, not credentials. Actual store-replacement and refresh-mutation protections remain covered.

This is an auth-owner area split of the wider cleanup. Net production: 18 lines removed, including all moved operation bodies; test/support: 47 lines added; overall: 29 lines added. No schema, dependency, config, CLI, or protocol changes.

Best-effort tradeoffs accepted

None newly introduced. No current-authority, FIFO, durability, security-effect, or shutdown-settlement guard is removed.

Evidence

  • All 15 source postimages exactly match the independently reviewed candidate, with no intervening changes to those paths on main. Independent P0-P2 review was scoped-clean; ordinary 15-file typed lint, native 17-root types, format, and normal signing passed on those inputs.
  • Retained focused proof covers 121 distinct behavior keepers plus 14 lint-suppression cases across the changed consumers and native provider/bootstrap siblings. No live-provider claim.
  • One original cross-agent observer case timed out. Its fixture had captured the external-CLI namespace before a hoisted module reset; the repair imports the current namespace after the owner starts. The exact failed case then passed, and the complete changed 11-case module passed in order. No production behavior, deadline, assertion, retry, or skip was changed for that repair. The original failure remains disclosed rather than relabeled inherited.
  • Fresh area native 17-root typecheck passed (including the public agent-runtime and Codex auth-bridge consumer roots); runtime and static cycle gates both found zero cycles. No Plugin SDK export or public runtime-refresh signature changes; the removed adapter/reader export had no SDK or plugin consumers. Exact-head hosted CI remains pending.

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 19, 2026 19:55
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling labels Oct 19, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T19:59:26.100180Z 99ceb2c Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 99ceb2c57d410fdfda39821862f4dcb26230b683
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/auth-profiles/effective-oauth.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/oauth-manager.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/oauth-provider-operations.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/oauth.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR binds OAuth managers directly to existing provider and bootstrap operations and moves fixtures to those module boundaries.

Example: Two managers request an expired openai:default credential.

  • Before: Separate queues coordinate through durable refresh fences using an injected production adapter.
  • After: Separate queues retain the same coordination while calling native provider operations directly.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-consistent refactor with retained integration coverage; supplied proof remains harness-based and hosted CI is still pending.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate and does not materially change authority; supplied validation exercises real managers, locks, workers, and stores with mocked provider I/O, without claiming a live-provider run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
Reason: Maintainer direction supports removing the private injection layer; the change reduces production machinery without adding settings or changing public contracts.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored refactor removes a private adapter while preserving independent OAuth queues and credential settlement; no actionable introduced defect was found.

Priority: P3
Reviewed head: 99ceb2c57d410fdfda39821862f4dcb26230b683

Before merge

None.

Findings

None.

Agent review details

How this fits together

The auth-profile resolver accepts selected credentials, coordinates refresh through queues and durable store ownership, and returns validated provider access credentials.

flowchart TD
A[Selected auth profile] --> B[OAuth manager queue]
B --> C[Durable refresh claim]
C --> D[Native provider operations]
D --> E[Provider runtime]
E --> F[Credential settlement]
F --> G[Validated access]
Loading

Technical review

Best possible solution:

Keep the shared provider-operation leaf and independent managers while preserving the existing credential lifecycle owners.

Do we have a high-confidence way to reproduce the issue?

No user bug is claimed; source inspection confirms a private adapter with one production implementation and test alternatives.

Is this the best way to solve the issue?

The extraction is a focused cutover: both production consumers reuse the existing operations, and the constructor continues to provide independent queues.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 648ea4c01433.

Provenance checked

  • Private OAuth manager adapter changes intended behavior with a stated reason (5f2e77a: Centralize canonical OAuth lifecycle ownership, as described in refactor(auth): centralize codex oauth ownership in OpenClaw #68284.)
  • Durable refresh fencing and provider capability checks keeps the original intent (b824b72: Prevent replay and stale settlement of consumed refresh generations through canonical ownership.)
  • Personal credential mutation isolation and acceptance keeps the original intent (f48c19d: Retain personal credential authority through provider preparation and worker settlement.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit f48c19d adds src/agents/auth-profiles/oauth-manager.ts:123 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f48c19db0939; files: src/agents/auth-profiles/oauth-manager.ts)
  • Vincent Koc: Raw commit b824b72 adds src/agents/auth-profiles/oauth-manager.ts:1207 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b824b72ce284; files: src/agents/auth-profiles/oauth-manager.ts)
  • Ayaan Zaidi: Raw commit bc0b247 adds src/agents/auth-profiles/oauth-manager.ts:1258 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: bc0b24713dc8; files: src/agents/auth-profiles/oauth-manager.ts)

PR surface

Source -18, Tests +47. Total +29 across 15 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 4 85 103 -18
Tests 11 237 190 +47
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 322 293 +29

Review metrics

Metric Value Why it matters
Production versus test/support LOC Production +85/-103; tests/support +237/-190 Production shrinks by 18 lines; the 47-line test/support increase replaces adapter injection with shared provider-boundary fixtures and accepted-work cleanup.

Labels

Label changes:

  • add P3: This is a behavior-preserving internal cleanup with no reported user-facing regression.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a behavior-preserving internal cleanup with no reported user-facing regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 19, 2026, 4:11 PM ET / 20:11 UTC.

@steipete
steipete merged commit 143d60d into main Oct 19, 2026
205 of 208 checks passed
@steipete
steipete deleted the deslop/z19-83-oauth-native-owners-20261015 branch October 19, 2026 20:35
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Oct 19, 2026
* commit '08e32fdb4df002c9d4eea158b855d6521dd1e916': (52 commits)
  test(gateway): restore local probe deferred import
  fix(agents): release prompt diagnostics for retired sessions (#177614)
  fix(release): tag restart plugin cohorts consistently (#177725)
  refactor(ui): inline single-caller detail requests (#177705)
  chore(i18n): refresh native locales (#177721)
  refactor(codex): drop unread private runtime reports (#177689)
  refactor(ui): consolidate static artwork registries (#177692)
  refactor(ui): derive settings schema analysis in the view (#177624)
  refactor(media): consolidate capability defaults and compression grids (#177665)
  refactor(auth): bind OAuth managers to native provider operations (#177676)
  refactor(ui): remove redundant component rendering layers (#177607)
  fix(ios): model sign-in is a permanent row under the composer instead of an item in the model menu (#166082)
  fix(agents): report failed secret input prompt delivery (#177688)
  refactor(ui): share chat message render contracts (#177668)
  fix(ui): settle model status after overlapping publication (#177667)
  refactor(gateway): reuse native workspace and lifecycle facts (#177670)
  refactor(runtime): rely on canonical async lifecycle owners (#177635)
  refactor: fold private operation helpers into their callers (#177655)
  refactor(ui): remove unused chat leaf element adapters (#177582)
  perf(talk): use published authority for foreign voice writes (#177533)
  ...
vincentkoc added a commit that referenced this pull request Oct 19, 2026
#167350)

* fix(pr): retain the admitted workflow across maintainer commands

* fix: refresh the reviewed correction baseline

Baseline-Refresh: a89bd166b79d54b343b93ad374f8ebfa4f3d1163

* fix(pr): preserve cold workflow admission and repository identity

* chore(pr): integrate canonical main CI repair

* commit '08e32fdb4df002c9d4eea158b855d6521dd1e916': (52 commits)
  test(gateway): restore local probe deferred import
  fix(agents): release prompt diagnostics for retired sessions (#177614)
  fix(release): tag restart plugin cohorts consistently (#177725)
  refactor(ui): inline single-caller detail requests (#177705)
  chore(i18n): refresh native locales (#177721)
  refactor(codex): drop unread private runtime reports (#177689)
  refactor(ui): consolidate static artwork registries (#177692)
  refactor(ui): derive settings schema analysis in the view (#177624)
  refactor(media): consolidate capability defaults and compression grids (#177665)
  refactor(auth): bind OAuth managers to native provider operations (#177676)
  refactor(ui): remove redundant component rendering layers (#177607)
  fix(ios): model sign-in is a permanent row under the composer instead of an item in the model menu (#166082)
  fix(agents): report failed secret input prompt delivery (#177688)
  refactor(ui): share chat message render contracts (#177668)
  fix(ui): settle model status after overlapping publication (#177667)
  refactor(gateway): reuse native workspace and lifecycle facts (#177670)
  refactor(runtime): rely on canonical async lifecycle owners (#177635)
  refactor: fold private operation helpers into their callers (#177655)
  refactor(ui): remove unused chat leaf element adapters (#177582)
  perf(talk): use published authority for foreign voice writes (#177533)
  ...

Co-authored-by: Vincent Koc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
openclaw#167350)

* fix(pr): retain the admitted workflow across maintainer commands

* fix: refresh the reviewed correction baseline

Baseline-Refresh: a89bd166b79d54b343b93ad374f8ebfa4f3d1163

* fix(pr): preserve cold workflow admission and repository identity

* chore(pr): integrate canonical main CI repair

* commit '4f8617589b6c71d754171052b603fe534901bfa1': (52 commits)
  test(gateway): restore local probe deferred import
  fix(agents): release prompt diagnostics for retired sessions (openclaw#177614)
  fix(release): tag restart plugin cohorts consistently (openclaw#177725)
  refactor(ui): inline single-caller detail requests (openclaw#177705)
  chore(i18n): refresh native locales (openclaw#177721)
  refactor(codex): drop unread private runtime reports (openclaw#177689)
  refactor(ui): consolidate static artwork registries (openclaw#177692)
  refactor(ui): derive settings schema analysis in the view (openclaw#177624)
  refactor(media): consolidate capability defaults and compression grids (openclaw#177665)
  refactor(auth): bind OAuth managers to native provider operations (openclaw#177676)
  refactor(ui): remove redundant component rendering layers (openclaw#177607)
  fix(ios): model sign-in is a permanent row under the composer instead of an item in the model menu (openclaw#166082)
  fix(agents): report failed secret input prompt delivery (openclaw#177688)
  refactor(ui): share chat message render contracts (openclaw#177668)
  fix(ui): settle model status after overlapping publication (openclaw#177667)
  refactor(gateway): reuse native workspace and lifecycle facts (openclaw#177670)
  refactor(runtime): rely on canonical async lifecycle owners (openclaw#177635)
  refactor: fold private operation helpers into their callers (openclaw#177655)
  refactor(ui): remove unused chat leaf element adapters (openclaw#177582)
  perf(talk): use published authority for foreign voice writes (openclaw#177533)
  ...

Co-authored-by: Vincent Koc <[email protected]>
amittell added a commit to amittell/openclaw that referenced this pull request Oct 22, 2026
…uth provider seam

openclaw#177676 made createOAuthManager take no adapter; provider I/O now goes
through oauth-provider-operations. The durable-owner case still passed
an adapter, so tsgo reported TS2554/TS7006 and at runtime the synthetic
refresh never ran: the case waited on providerStarted until Vitest's
120000 ms limit (CI run 39457916748, checks-node-changed-1 and
check-test-types-core-2).

The case now installs the refresh through mockOAuthProviderOperations,
restores those spies after each case, and races provider start against
the run so a run that settles first fails with its own error instead of
a test timeout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant