authHintForAttempt method
The auth hint for the provider the failure came from. When the
message identifies an adapter different from the believed binding,
the hint is computed for THAT provider alone — mixing the copilot
verdict with the session's z.ai key slot and endpoint produced one
fused copilot + z.ai + endpoint instruction (gh-1226 AC2).
Implementation
String authHintForAttempt(String message, String baseUrl) {
final attempted = _attemptedProviderFrom(message);
if (attempted != null && attempted != providerKind) {
// Diagnose the attempted provider against ITS OWN endpoint — the
// session's baseUrl belongs to the believed binding and would mix
// the other provider's key slot back in. The believed custom entry
// is excluded too (consultActiveEntry: false): a catalog adapter
// like copilot has no entry, and the session's z.ai entry slot
// must not leak into the copilot diagnosis (review thread).
final attemptedSpec = resolveCliProviderSpec(
attempted,
honorBuildFilter: true,
);
return _authHintFor(
attempted,
attemptedSpec?.defaultBaseUrl ?? baseUrl,
consultActiveEntry: false,
);
}
return authHint(baseUrl);
}