refactor(auth): centralize inference-credential routing in CredentialAuthority
One authority answers 'which credential may ride this request': credential_class / manager_for / credential_for / bearer_resolver_for, keyed by (platform, base_url). SessionCredential is an opaque type with no production constructor, so a new call site cannot re-introduce the session-bearer leak. Platform-scoped tests extended across all bearer channels (session, aux, summary, subagent override). Verified: cargo check --workspace --all-targets clean; kigi-shell and kigi-tui suites green (6611+ tests).
This commit is contained in:
1 parent
2d00a4e6e6
commit
48d89c7830
35 files changed
+3158
-1099
No files matched your search
@@ -501,6 +501,19 @@ pub struct MvpAgent {
|
||||
/// only api_key is written here (same for all clients). Per-session base_url
|
||||
/// is resolved at session creation time in `new_session` / `load_session`.
|
||||
pub(crate) sampling_config: RefCell<SamplingConfig>,
|
||||
/// The registry platform [`Self::sampling_config`] was BUILT from, captured
|
||||
/// in the same `ModelsManager::sampling_config()` call that produced it.
|
||||
///
|
||||
/// H-a: the shared config is built ONCE (`Self::with_models`) and never
|
||||
/// rebuilt, but `ModelsManager::current_model_id()` moves on every
|
||||
/// non-Leader model switch and on catalog reselection. Its guards
|
||||
/// (`stamp_session_credential`, `shared_config_takes_house_key`)
|
||||
/// therefore read THIS cell, never the live one: after a switch the live
|
||||
/// cell names a different entry, and re-resolving the config's bare slug
|
||||
/// against it fell through to `resolve_catalog_key`'s `.rev()` scan —
|
||||
/// answering the API-key twin, which takes no session credential, so a
|
||||
/// successful `kigi login` silently failed to replace the expired bearer.
|
||||
pub(crate) sampling_config_platform: std::cell::Cell<Option<kigi_models::PlatformId>>,
|
||||
pub(crate) auth_manager: Arc<AuthManager>,
|
||||
pub(crate) models_manager: crate::agent::models::ModelsManager,
|
||||
/// Forwards pasted codes from `handle_auth_submit_code` to the auth flow.
|
||||
|
||||
Reference in new issue
Block a user