fix(secrets): skip gateway RPC for non-gateway exec SecretRefs (#96653)#97445
fix(secrets): skip gateway RPC for non-gateway exec SecretRefs (#96653)#97445jiahjian wants to merge 1 commit into
Conversation
482ff9f to
b3a1ee0
Compare
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: this PR targets a valid SecretRef log-noise bug, but the open canonical PR is the safer landing path and preserves no-local-exec plus active-target safeguards this branch drops. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this branch and keep review focused on #96661; keep #96653 open until that canonical fix lands or is rejected. So I’m closing this here and keeping the remaining discussion on #96661 and #96653. Review detailsBest possible solution: Close this branch and keep review focused on #96661; keep #96653 open until that canonical fix lands or is rejected. Do we have a high-confidence way to reproduce the issue? Yes at source level: queued replies call Is this the best way to solve the issue? No for this branch: it is a plausible shortcut but not the best landing path because it drops no-local-exec and active-target safeguards. The safer solution is the canonical open PR with those guards and stronger proof. Security review: Security review cleared: No new dependency, workflow, lifecycle hook, or supply-chain concern was found; the SecretRef execution-routing concern is captured as functional merge risk. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 8d168c836af3. |
…law#96653) Every agent reply turn calls resolveCommandSecretRefsViaGateway, which issues a gateway secrets.resolve RPC. For model-provider exec SecretRefs (e.g. models.providers.*.apiKey), the gateway cannot resolve exec refs in command-path context and always fails with UNAVAILABLE. The client catches this and falls back to local resolution (which succeeds), but the round-trip produces ~1 noisy UNAVAILABLE log line per turn. The existing skip covers gateway credential exec refs (gateway.* paths) but not model-provider paths. Add a preemptive check: if any configured target ref uses exec source whose path does NOT start with "gateway.", skip the gateway RPC and resolve locally. Co-Authored-By: Claude <[email protected]>
b3a1ee0 to
0503bbc
Compare
What Problem This Solves
Fixes P2 issue #96653: Every agent reply turn calls
resolveCommandSecretRefsViaGateway, which issues a gatewaysecrets.resolveRPC. For model-provider exec SecretRefs (e.g.models.providers.*.apiKeywithsource: "exec"), the gateway cannot resolve exec refs in command-path context and always fails withUNAVAILABLE. The client catches this, falls back to local resolution (which succeeds), but produces ~1 noisy UNAVAILABLE log line per turn:Over time this accumulates to thousands of misleading log lines. The secret always works (local fallback succeeds), but operators have no way to tell a real failure from this benign noise.
Why This Change Was Made
Root cause: The existing skip in
resolveCommandSecretRefsViaGatewayonly covers gateway credential paths (gateway.auth.*,gateway.remote.*) viacollectActiveGatewayExecSecretRefCredentialPaths. Model-provider/agent-runtime exec refs (models.providers.*.apiKey) are not inALL_GATEWAY_SECRET_INPUT_PATHS, so they fall through to the always-failing gateway RPC.Fix: Add a preemptive check before the gateway RPC: iterate the configured target ref paths and detect any exec SecretRef whose path does NOT start with
"gateway.". These are model-provider/agent-runtime exec refs that the gateway cannot resolve. Skip the RPC and resolve locally.This mirrors the existing safe-path fallback pattern used for gateway-credential exec refs at line 938-953.
User Impact
UNAVAILABLElines for model-provider exec SecretRefsgateway.auth.*) continue to use the existing skipEvidence
Real behavior proof (
npx tsx scripts/proof-issue-96653.ts)Test results
command-secret-gateway.test.ts: existing tests passgit diff --check: passedtsc --noEmit: no errors in changed fileoxlint: no errors in changed fileChanged files (2 files, +187/-0)
src/cli/command-secret-gateway.ts— preemptive RPC skip (+34 lines)scripts/proof-issue-96653.ts— proof script with 4 scenarios🤖 Generated with Claude Code