Fix infer SecretRef resolution for provider-backed commands#82798
Conversation
|
Codex review: found issues before merge. Summary Reproducibility: yes. The linked issue provides a concrete CLI repro, and current main's source shows local web search/fetch read raw runtime config before command SecretRef resolution. Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Carry selected Do we have a high-confidence way to reproduce the issue? Yes. The linked issue provides a concrete CLI repro, and current main's source shows local web search/fetch read raw runtime config before command SecretRef resolution. Is this the best way to solve the issue? No. Resolving SecretRefs before provider construction is the right direction, but this patch scopes paths only after the gateway has resolved and returned broad target assignments. Full review comments:
Overall correctness: patch is incorrect Security concerns:
Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against d1280a3de939. |
c0804a3 to
71e9d05
Compare
091061d to
88560e0
Compare
…#82798) * fix infer secretref resolution * chore changelog for infer secretrefs
…#82798) * fix infer secretref resolution * chore changelog for infer secretrefs
…#82798) * fix infer secretref resolution * chore changelog for infer secretrefs
…#82798) * fix infer secretref resolution * chore changelog for infer secretrefs
…#82798) * fix infer secretref resolution * chore changelog for infer secretrefs
…#82798) * fix infer secretref resolution * chore changelog for infer secretrefs
…#82798) * fix infer secretref resolution * chore changelog for infer secretrefs
…#82798) * fix infer secretref resolution * chore changelog for infer secretrefs
…#82798) * fix infer secretref resolution * chore changelog for infer secretrefs
…#82798) * fix infer secretref resolution * chore changelog for infer secretrefs
…#82798) * fix infer secretref resolution * chore changelog for infer secretrefs
…#82798) * fix infer secretref resolution * chore changelog for infer secretrefs
Summary
inferprovider-backed commands could instantiate providers against raw config before command SecretRefs were resolved.secrets auditbut fail at runtime with unresolved SecretRef errors.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof
Behavior addressed: CLI web search resolves plugin-scoped
webSearch.apiKeySecretRefs before invoking the local provider.Real environment tested: AWS Crabbox Linux, provider
aws, leasecbx_b66e354b1546, runrun_71a9ceeecc03, isolated OpenClaw config and gateway.Exact steps or command run after this patch: configured Tavily plugin
plugins.entries.tavily.config.webSearch.apiKeyas an env SecretRef, started a local gateway, then raninfer web search --provider tavily --query ping --limit 1 --jsonusing a dummyTAVILY_API_KEY.Evidence after fix: AWS proof output showed
ASSERT_UNRESOLVED_SECRETREF=absentandGATEWAY_SECRETS_RESOLVE_SEEN=1; the command reached Tavily and returned401 Unauthorized: missing or invalid API key, which is expected for the dummy key.Observed result after fix: the command crossed the SecretRef resolution boundary and failed only at provider auth with the intentionally fake key.
What was not tested: a successful live Tavily result with a real Tavily API key.
Before evidence: current-main AWS repro on
bea4f0d2f4b48ddd62db45970e513441e9af8f98failed withunresolved SecretRef "env:default:TAVILY_API_KEY"whilesecrets auditreportedunresolved=0.Root Cause
inferpaths read rawgetRuntimeConfig()and constructed providers directly, bypassing the command SecretRef resolver used by other command surfaces.src/cli/capability-cli.ts, and web search runtime could prefer a stale runtime snapshot over the resolved CLI config.Regression Test Plan
src/cli/capability-cli.test.ts,src/cli/command-secret-targets.test.ts,src/web-search/runtime.test.ts,src/cli/command-secret-resolution.coverage.test.ts.infercommands resolve command SecretRefs before provider construction and web search/fetch target only selected-provider credential paths.inferSecretRef bypass.User-visible / Behavior Changes
Local
inferprovider-backed commands can now use command SecretRefs before provider execution. Web search/fetch plugin-scoped credentials work through the selected provider path.Diagram
Security Impact (required)
Yes, explain risk + mitigation: command-scoped SecretRefs are resolved earlier for local provider execution using the existing command resolver and selected-providerallowedPaths, limiting resolution to the relevant credential paths.Repro + Verification
Environment
webSearch.apiKeyas env SecretRefTAVILY_API_KEYSteps
webSearch.apiKeyas an env SecretRef.infer web search --provider tavily --query ping --limit 1 --json.Expected
Actual
secrets.resolveobserved in gateway logs.Evidence
Human Verification (required)
pnpm check:changed, AWS E2E reproduction of the CLI/gateway/provider path.Review Conversations
Compatibility / Migration
Risks and Mitigations
allowedPathsto selected provider credentials and known same-provider fallbacks.