Skip to content

refactor(agents): reuse auth profile listing - #132919

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/reuse-auth-profile-list
Aug 30, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/reuse-auth-profile-list

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Provider auth resolution maintained a second copy of the canonical provider-profile enumeration logic. The implementations were identical, so future alias or ordering changes could drift between model-config secret resolution and the shared auth-profile owner.

Why This Change Was Made

Both model-config consumers now import the lightweight canonical listProfilesForProvider helper directly. The duplicate exported helper and its unused alias resolver import are removed; the specialized auth ordering path remains unchanged.

This is the best fix because auth-profiles/profile-list.ts already owns the exact side-effect-free invariant. Keeping an alias or another wrapper would preserve duplicate policy without a compatibility requirement.

User Impact

No user-visible behavior changes. Provider aliases and profile insertion order resolve exactly as before, with one canonical implementation instead of two.

Evidence

  • Production LOC: +4/-12 (net -8). Tests: +0/-0.
  • Direct comparison on current main confirmed the removed helper was byte-identical apart from its name.
  • node scripts/run-vitest.mjs src/agents/models-config.providers.auth-provenance.test.ts src/agents/models-config.providers.normalize-keys.test.ts src/agents/provider-auth-aliases.test.ts src/agents/auth-profiles/order.test.ts: 67 passed.
  • pnpm exec oxfmt --check on both changed files: passed.
  • pnpm exec oxlint on both changed files: passed.
  • pnpm tsgo:core: passed.
  • Mandatory local autoreview with gpt-5.6-sol at high reasoning: clean, patch correctness confidence 0.98.

@clawsweeper

clawsweeper Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@vincentkoc vincentkoc self-assigned this Aug 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Aug 29, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 29, 2026 23:49
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 29, 2026
@clawsweeper

clawsweeper Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 7:55 PM ET / 23:55 UTC.

ClawSweeper review

What this changes

The PR removes a duplicate provider-auth profile-listing helper and makes API-key and full-auth resolution use the shared auth-profile listing helper.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for normal maintainer merge review. The introduced substitutions preserve the exact provider-alias matching and insertion-order behavior while removing duplicate policy; the MEMBER authorship and maintainer label require human handling rather than automated cleanup.

Priority: P3
Reviewed head: fa75bd8fc6fa2c798b9947cebc6d604ae3087ff6
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused net-negative refactor with source-proven behavioral equivalence and no actionable correctness or security finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored internal refactor is outside the external-contributor real-behavior-proof gate; its supplied focused test results are supplemental validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored internal refactor is outside the external-contributor real-behavior-proof gate; its supplied focused test results are supplemental validation.
Evidence reviewed 5 items Canonical implementation: The shared helper normalizes the requested and stored provider IDs, filters matching profiles, and preserves object insertion order; this is the behavior previously duplicated by the removed helper.
API-key caller: The API-key profile resolver now obtains IDs from the shared helper before retaining its existing first-usable-credential loop.
OAuth caller: The full provider-auth resolver uses the same shared list before its unchanged API-key-over-OAuth preference logic.
Findings None None.
Security None None.

How this fits together

Model configuration looks up stored credentials by provider, resolves compatible profile IDs, and then selects API-key, token, or OAuth authentication for provider discovery and execution.

flowchart LR
  A[Provider request] --> B[Alias resolution]
  B --> C[Auth profile store]
  C --> D[Shared profile listing]
  D --> E[Credential selection]
  E --> F[Provider authentication]
Loading

Decision needed

Question Recommendation
Should this maintainer-labeled refactor be approved once the exact-head required checks are green? Approve after checks: Approve the small canonicalization refactor after the exact head satisfies required GitHub checks.

Why: The patch appears behavior-preserving, but MEMBER-authored and maintainer-labeled items require explicit human merge judgment.

Before merge

  • Complete next step (P2) - The remaining action is normal human review of a maintainer-labeled PR, not an automated repair.
Agent review details

Security

None.

PR surface

Source -8. Total -8 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 4 12 -8
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 4 12 -8

Review metrics

Metric Value Why it matters
Production versus test delta production +4/-12 (net -8); tests +0/-0 The refactor reduces duplicate production logic without adding a new test surface.

Technical review

Best possible solution:

Land the canonical-helper refactor once a maintainer approves the exact head and required checks complete.

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

Not applicable: this PR is an internal refactor, not a report of failing user behavior.

Is this the best way to solve the issue?

Yes. The shared helper exactly implements the deleted provider-alias matching logic, while the two callers retain their distinct credential-selection policies.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4db43443acc1.

Labels

Label changes:

  • add P3: This is a small internal deduplication change with no observable behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored internal refactor is outside the external-contributor real-behavior-proof gate; its supplied focused test results are supplemental validation.

Label justifications:

  • P3: This is a small internal deduplication change with no observable behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored internal refactor is outside the external-contributor real-behavior-proof gate; its supplied focused test results are supplemental validation.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@vincentkoc

Copy link
Copy Markdown
Member Author

Before-merge resolution:

The listed human-review Before merge item is resolved.

@vincentkoc
vincentkoc merged commit 671c6e7 into main Aug 30, 2026
306 checks passed
@vincentkoc
vincentkoc deleted the refactor/reuse-auth-profile-list branch August 30, 2026 00:01
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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