Skip to content

fix(agents): align plugin tool auth with provider runtime - #103852

Merged
steipete merged 3 commits into
openclaw:mainfrom
lonexreb:fix/103828-plugin-tool-auth-gate
Jul 29, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
lonexreb:fix/103828-plugin-tool-auth-gate

Conversation

@lonexreb

@lonexreb lonexreb commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #103828

What Problem This Solves

Fixes an issue where provider-auth-gated plugin tools could be hidden even though the current agent run could resolve a valid environment, configured SecretRef, managed-secret, or custom-provider credential. The old gate counted only ordered auth profiles, so provider execution and tool availability disagreed.

Why This Change Was Made

The maintainer rewrite aligns both halves of the contract. When the run supplies its authoritative auth store, plugin-tool availability uses a prepared config/workspace-aware runtime lookup plus that store. Execution keeps the existing ordered-profile precedence and falls back to canonical runtime/config credential resolution only when no ordered profile yields a key.

No-store callers remain ungated and never discover persistent auth state. Provider metadata is prepared once for availability rather than rediscovered per manifest signal. This preserves tenant/billing identity when both a profile and environment key exist.

User Impact

Plugin tools can now use the same supported auth sources as provider execution, including process-environment credentials injected by service management and configured provider SecretRefs. Explicit profile order remains authoritative, missing credentials still hide the tool, and no new config or migration is required.

Evidence

  • Exact prepared head: 8d7db671530d0e201007e85ee0597eec1badfff2
  • Focused proof: 173 tests passed across plugin composition, canonical provider auth, manifest gating, the broad image-tool suite, xAI execution auth, environment-only fallback, mixed profile/environment precedence, and no-store behavior.
  • Full changed gate: Blacksmith Testbox run 30408917483 passed core/test types, dependency and boundary guards, dead-code/cycle checks, formatting, and targeted lint.
  • Live provider proof: real xAI x_search passed 1/1 in 3.3s with content and citations using an environment-only credential loaded through the approved secret path; the value was never printed or persisted.
  • Live Gateway substitution: Testbox did not have XAI_API_KEY, so a credential-bearing remote Gateway turn was not possible without widening secret scope. The changed plugin composition/execution boundary is covered with environment-only production tests, and the same xAI tool executed a real provider request locally through the approved secret path.
  • Exact-head CI: run 30409356315 attempt 2 passed, including the formerly failing auth/media shard and aggregate gate 90446298919. The only rerun was an unrelated local Gateway-connect timeout in large-3.
  • Fresh isolated Codex autoreview at P1 depth found and fixed one profile-precedence regression; the branch rerun is clean at confidence 0.87 and the final CI-fix delta is clean at 0.88.
  • Direct owner/dependency inspection covered the canonical provider resolver, runtime auth lookup, manifest availability, and xAI tool auth/execution paths.

Contributor credit is preserved with Co-authored-by: Shubhankar Tripathy <[email protected]> on the prepared commit.

…h gating (openclaw#103828)

The plugin-tool availability gate (hasAuthForProvider) consulted only the
auth profile store, so tools like image analysis rejected providers whose
API key arrives via the process environment (including keys injected
through OPENCLAW_SERVICE_MANAGED_ENV_KEYS) or config apiKey SecretRefs -
paths chat routing resolves fine via resolveApiKeyForProvider. Route the
gate through the shared hasProviderAuthForTool helper the media model
selection already uses, which layers runtime env, custom-provider
SecretRefs, managed secrets, and the profile store.
@lonexreb
lonexreb requested a review from a team as a code owner July 10, 2026 17:16
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Jul 10, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 10, 2026
@clawsweeper

clawsweeper Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 10, 2026, 2:00 PM ET / 18:00 UTC.

Summary
The PR changes plugin-tool provider-auth availability to count environment, configured SecretRef, managed/runtime, and profile-store credentials through the shared helper, and adds an environment-backed custom-provider regression test.

PR surface: Source +10, Tests +23. Total +33 across 2 files.

Reproducibility: yes. from source with high confidence: current main’s plugin-tool callback counts only auth-profile IDs, while the reported configured environment credential is recognized by the existing shared helper but not that callback. A live NVIDIA gateway reproduction was not independently run.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #103828
Summary: The linked issue is the canonical report and this PR is its direct candidate fix.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Provide a redacted live gateway run showing the affected plugin tool is available and succeeds with only the service-managed environment credential.
  • Refresh the branch against current main and rerun the focused plugin-tool and auth regressions.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR runs the production helper in a regression harness but explicitly does not exercise a live gateway with a service-managed NVIDIA credential, so real behavior proof is still required; post redacted terminal output or logs, update the PR body to trigger a fresh review, or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] The PR is behind current main, so its exact three-way result and focused checks should be refreshed after rebasing.
  • [P1] The supplied verification is test-harness-only and does not demonstrate that a live service-managed environment credential makes the actual plugin tool available and usable.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the shared canonical auth predicate, add or retain focused plugin-tool-boundary coverage, rebase onto current main, and prove the affected tool in a real gateway setup using only a redacted service-managed environment credential.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Ask the contributor for live redacted behavior proof and refresh the behind branch; no separate automated repair is appropriate because automation cannot supply proof from the contributor’s service-managed setup.

Security
Cleared: The focused source-and-test diff adds no dependency, workflow, permission, secret exposure, downloaded code, or other concrete security or supply-chain concern.

Review details

Best possible solution:

Keep the shared canonical auth predicate, add or retain focused plugin-tool-boundary coverage, rebase onto current main, and prove the affected tool in a real gateway setup using only a redacted service-managed environment credential.

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

Yes, from source with high confidence: current main’s plugin-tool callback counts only auth-profile IDs, while the reported configured environment credential is recognized by the existing shared helper but not that callback. A live NVIDIA gateway reproduction was not independently run.

Is this the best way to solve the issue?

Yes in direction: reusing the existing multi-source auth helper is the narrowest maintainable fix and avoids a second provider-auth policy. The proof should additionally observe the plugin-tool boundary and live setup rather than only invoke the helper directly.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: The PR fixes a real provider-auth mismatch that blocks a bounded plugin-tool workflow while an auth-profile workaround remains available.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR runs the production helper in a regression harness but explicitly does not exercise a live gateway with a service-managed NVIDIA credential, so real behavior proof is still required; post redacted terminal output or logs, update the PR body to trigger a fresh review, or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +10, Tests +23. Total +33 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 15 5 +10
Tests 1 23 0 +23
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 38 5 +33

What I checked:

  • Current-main gate: Current main constructs plugin-tool hasAuthForProvider only when an auth store exists and returns true only when resolveAuthProfileOrder yields profile IDs, excluding the reported environment-only credential. (src/agents/openclaw-plugin-tools.ts:95, b597a8d364f2)
  • Canonical shared behavior: hasProviderAuthForTool checks runtime/config-backed provider auth and config-aware environment/profile auth, matching the credential sources the plugin-tool gate needs to recognize. (src/agents/tools/model-config.helpers.ts:128, b597a8d364f2)
  • Manifest caller contract: Plugin manifest availability calls hasAuthForProvider for auth signals and otherwise falls back only to environment variables declared by the owning plugin manifest, so custom/config-driven provider credentials require the callback fix. (src/plugins/manifest-tool-availability.ts:239, b597a8d364f2)
  • Proposed implementation: The PR head routes the plugin-tool callback through hasProviderAuthForTool using current runtime config, agent directory, and the available auth store. (src/agents/openclaw-plugin-tools.ts:93, 35bc23cefb82)
  • Regression scope: The added regression proves the shared helper accepts an environment-backed custom-provider SecretRef, but it does not run the changed plugin-tool resolver or a live gateway/provider setup. (src/agents/tools/image-tool.custom-provider-auth.regression.test.ts:234, 35bc23cefb82)
  • Related issue state: The linked issue is open and its existing Codex review identifies this PR as the direct candidate fix rather than evidence that current main already solved the problem. (3a64889d83af)

Likely related people:

  • Peter Steinberger: Current blame and path history attribute the canonical provider-auth helper and plugin-tool composition in this checkout to the main restoration commit authored by Peter Steinberger. (role: recent area contributor; confidence: medium; commits: 5635d74eccd7; files: src/agents/openclaw-plugin-tools.ts, src/agents/tools/model-config.helpers.ts)
  • Vincent Koc: Shortlog and reachable earlier history show repeated contributions to the central auth/helper paths, though the grafted checkout obscures exact older line provenance. (role: earlier area contributor; confidence: low; commits: e085fa1a3ffd; files: src/agents/openclaw-plugin-tools.ts, src/agents/tools/model-config.helpers.ts, src/plugins/manifest-tool-availability.ts)
  • pgondhi987: Shortlog shows prior contribution to the same plugin-tool/auth availability files, making this NVIDIA-affiliated contributor a plausible domain routing candidate despite limited retained history. (role: adjacent area contributor; confidence: low; files: src/agents/openclaw-plugin-tools.ts, src/agents/tools/model-config.helpers.ts, src/plugins/manifest-tool-availability.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 26, 2026
@steipete steipete self-assigned this Jul 28, 2026
Use prepared runtime/config auth plus the authoritative per-run profile store for plugin tool availability and credential resolution. Preserve profile precedence and no-store behavior while avoiding repeated metadata and store discovery.

Closes openclaw#103828.

Co-authored-by: Shubhankar Tripathy <[email protected]>
@steipete steipete removed the stale Marked as stale due to inactivity label Jul 28, 2026
@steipete steipete changed the title fix(agents): count env/config credentials in plugin tool provider-auth gating (#103828) fix(agents): align plugin tool auth with provider runtime Jul 28, 2026
Keep direct env lookup for callers without a prepared runtime auth lookup while allowing prepared plugin-tool composition to skip redundant metadata discovery.
@steipete
steipete merged commit 2ae5669 into openclaw:main Jul 29, 2026
203 of 205 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
…03852)

* fix(agents): count env/config credentials in plugin tool provider-auth gating (openclaw#103828)

The plugin-tool availability gate (hasAuthForProvider) consulted only the
auth profile store, so tools like image analysis rejected providers whose
API key arrives via the process environment (including keys injected
through OPENCLAW_SERVICE_MANAGED_ENV_KEYS) or config apiKey SecretRefs -
paths chat routing resolves fine via resolveApiKeyForProvider. Route the
gate through the shared hasProviderAuthForTool helper the media model
selection already uses, which layers runtime env, custom-provider
SecretRefs, managed secrets, and the profile store.

* fix(agents): preserve unprepared auth fallback

Keep direct env lookup for callers without a prepared runtime auth lookup while allowing prepared plugin-tool composition to skip redundant metadata discovery.

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: image tool auth resolution does not check OPENCLAW_SERVICE_MANAGED_ENV_KEYS

2 participants