|
1 | 1 | import type { OpenClawConfig } from "../../config/types.openclaw.js"; |
| 2 | +import { createSubsystemLogger } from "../../logging/subsystem.js"; |
2 | 3 | import { normalizeProviderId } from "../provider-id.js"; |
3 | 4 | import { resolveProviderRequestHeaders } from "../provider-request-config.js"; |
4 | 5 | import { logAuthProfileFailureStateChange } from "./state-observation.js"; |
| 6 | + |
| 7 | +const authProfileUsageLog = createSubsystemLogger("agent/embedded"); |
5 | 8 | import { saveAuthProfileStore, updateAuthProfileStoreWithLock } from "./store.js"; |
6 | 9 | import type { |
7 | 10 | AuthProfileBlockedSource, |
@@ -728,8 +731,13 @@ export async function markAuthProfileFailure(params: {
|
728 | 731 | } |
729 | 732 | try { |
730 | 733 | onAuthProfileFailureHook?.(); |
731 | | -} catch { |
732 | | -// hook errors must not break failure recording |
| 734 | +} catch (err) { |
| 735 | +// Hook errors must not break failure recording; log and continue. |
| 736 | +authProfileUsageLog.warn("auth profile failure hook threw", { |
| 737 | +event: "auth_profile_failure_hook_error", |
| 738 | +tags: ["error_handling", "auth_profiles"], |
| 739 | +error: err instanceof Error ? err.message : String(err), |
| 740 | +}); |
733 | 741 | } |
734 | 742 | return; |
735 | 743 | } |
@@ -774,8 +782,13 @@ export async function markAuthProfileFailure(params: {
|
774 | 782 | }); |
775 | 783 | try { |
776 | 784 | onAuthProfileFailureHook?.(); |
777 | | -} catch { |
778 | | -// hook errors must not break failure recording |
| 785 | +} catch (err) { |
| 786 | +// Hook errors must not break failure recording; log and continue. |
| 787 | +authProfileUsageLog.warn("auth profile failure hook threw", { |
| 788 | +event: "auth_profile_failure_hook_error", |
| 789 | +tags: ["error_handling", "auth_profiles"], |
| 790 | +error: err instanceof Error ? err.message : String(err), |
| 791 | +}); |
779 | 792 | } |
780 | 793 | } |
781 | 794 | |
|