c111ede3e5
`key_cmd` (#86891) authenticates a provider with a SHORT-LIVED bearer minted by a command — SSO/OIDC brokers, cloud IAM, internal auth proxies. The request path has honoured it since it landed, but the picker resolved probe credentials from `api_key`/`key_env` ONLY, so a key_cmd provider probed `/v1/models` with an EMPTY key. Against an authenticated endpoint the probe 401s, discovery returns nothing, and the provider falls back to its single configured default model. The picker shows ONE model, indistinguishable from an endpoint that genuinely serves one — while inference keeps working, because that path mints correctly. Reproduced against a LiteLLM gateway behind Entra OIDC: 0 models discovered with an empty key, 26 with the minted token. Both picker probe sites already funnel through `_entry_credentials()`, so the fix lands in one place: it now reports a `cmd:<key_cmd>` identity, and each site falls back to `resolve_probe_token()` after api_key/key_env. An explicit static key still wins, so existing configs are unaffected. The identity is keyed on the COMMAND, never the minted token: the token rotates on every refresh, so keying on its value would change the group fingerprint constantly and force a re-probe on every open. Two entries on one URL with different helpers still get distinct rows. `resolve_probe_token()` lives in agent.command_token_source, which already owns key_cmd minting, and shares the CommandTokenSource cache with the request path — a cache read, not a fresh sign-in. Fail-closed: a helper needing an interactive sign-in degrades to today's empty-key behaviour rather than taking down every other provider's row. `_model_flow_named_custom` (the `hermes model` setup flow) is the sibling path — it builds its own `Authorization: Bearer` from the same incomplete resolution — and is fixed the same way, with one ordering constraint: the value persisted to config.yaml is computed BEFORE the mint, so a short-lived bearer can never be written back to shadow the key_cmd meant to re-mint it. Tests drive the real code paths and assert on the credential each probe receives rather than on function source, so a semantics-preserving refactor does not fail them. Verified they fail with the fix reverted.