fix(agents): log warnings instead of swallowing subagent errors (#82943) · openclaw/openclaw@907bc03
SebTardif
·
2026-05-25
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -28,8 +28,42 @@ vi.mock("./provider-model-normalization.runtime.js", () => ({
|
28 | 28 | })); |
29 | 29 | |
30 | 30 | const emptyPluginMetadataSnapshot = vi.hoisted(() => ({ |
| 31 | +policyHash: "model-fallback-probe-test-empty-plugin-policy", |
31 | 32 | configFingerprint: "model-fallback-probe-test-empty-plugin-metadata", |
| 33 | +index: { |
| 34 | +hostContractVersion: "test", |
| 35 | +compatRegistryVersion: "test", |
| 36 | +migrationVersion: 1, |
| 37 | +policyHash: "model-fallback-probe-test-empty-plugin-policy", |
| 38 | +generatedAtMs: 0, |
| 39 | +installRecords: {}, |
| 40 | +plugins: [], |
| 41 | +diagnostics: [], |
| 42 | +}, |
| 43 | +registryDiagnostics: [], |
| 44 | +manifestRegistry: { plugins: [], diagnostics: [] }, |
32 | 45 | plugins: [], |
| 46 | +diagnostics: [], |
| 47 | +byPluginId: new Map(), |
| 48 | +normalizePluginId: (pluginId: string) => pluginId, |
| 49 | +owners: { |
| 50 | +channels: new Map(), |
| 51 | +channelConfigs: new Map(), |
| 52 | +providers: new Map(), |
| 53 | +modelCatalogProviders: new Map(), |
| 54 | +cliBackends: new Map(), |
| 55 | +setupProviders: new Map(), |
| 56 | +commandAliases: new Map(), |
| 57 | +contracts: new Map(), |
| 58 | +}, |
| 59 | +metrics: { |
| 60 | +registrySnapshotMs: 0, |
| 61 | +manifestRegistryMs: 0, |
| 62 | +ownerMapsMs: 0, |
| 63 | +totalMs: 0, |
| 64 | +indexPluginCount: 0, |
| 65 | +manifestPluginCount: 0, |
| 66 | +}, |
33 | 67 | })); |
34 | 68 | |
35 | 69 | vi.mock("../plugins/current-plugin-metadata-snapshot.js", () => ({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,6 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
5 | 5 | import { testing as extraParamsTesting } from "./pi-embedded-runner/extra-params.js"; |
6 | 6 | |
7 | 7 | vi.mock("../plugins/provider-hook-runtime.js", () => ({ |
| 8 | +clearProviderRuntimePluginCacheForTest: vi.fn(), |
8 | 9 | testing: { |
9 | 10 | buildHookProviderCacheKey: () => "test-provider-hook-cache-key", |
10 | 11 | }, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -88,6 +88,7 @@ export function createSanitizeSessionHistoryProviderHookRuntimeMock(
|
88 | 88 | extra: Record<string, unknown> = {}, |
89 | 89 | ) { |
90 | 90 | return { |
| 91 | +clearProviderRuntimePluginCacheForTest: vi.fn(), |
91 | 92 | resolveProviderRuntimePlugin: vi.fn(() => undefined), |
92 | 93 | resolveProviderHookPlugin: vi.fn(() => undefined), |
93 | 94 | resolveProviderPluginsForHooks: vi.fn(() => []), |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -29,6 +29,7 @@ vi.mock("./pi-embedded-helpers.js", async () => ({
|
29 | 29 | })); |
30 | 30 | |
31 | 31 | vi.mock("../plugins/provider-hook-runtime.js", async () => ({ |
| 32 | +clearProviderRuntimePluginCacheForTest: vi.fn(), |
32 | 33 | testing: {}, |
33 | 34 | prepareProviderExtraParams: vi.fn(() => undefined), |
34 | 35 | resolveProviderHookPlugin: vi.fn(() => undefined), |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { createSubsystemLogger } from "../logging/subsystem.js"; |
1 | 2 | import { getGlobalHookRunner } from "../plugins/hook-runner-global.js"; |
2 | 3 | import type { SubagentRunOutcome } from "./subagent-announce-output.js"; |
3 | 4 | import { |
@@ -10,6 +11,8 @@ import {
|
10 | 11 | } from "./subagent-lifecycle-events.js"; |
11 | 12 | import type { SubagentRunRecord } from "./subagent-registry.types.js"; |
12 | 13 | |
| 14 | +const log = createSubsystemLogger("agents/subagent-registry-completion"); |
| 15 | + |
13 | 16 | export function runOutcomesEqual( |
14 | 17 | a: SubagentRunOutcome | undefined, |
15 | 18 | b: SubagentRunOutcome | undefined, |
@@ -113,7 +116,10 @@ export async function emitSubagentEndedHookOnce(params: {
|
113 | 116 | params.entry.endedHookEmittedAt = Date.now(); |
114 | 117 | params.persist(); |
115 | 118 | return true; |
116 | | -} catch { |
| 119 | +} catch (err) { |
| 120 | +log.warn( |
| 121 | +`failed to emit subagent_ended hook for run ${runId}: ${err instanceof Error ? err.message : String(err)}`, |
| 122 | +); |
117 | 123 | return false; |
118 | 124 | } finally { |
119 | 125 | params.inFlightRunIds.delete(runId); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -646,8 +646,10 @@ function restoreSubagentRunsOnce() {
|
646 | 646 | // Cold-start restore path: queue the same recovery pass that restart |
647 | 647 | // startup also uses so resumed children are handled through one seam. |
648 | 648 | scheduleSubagentOrphanRecovery(); |
649 | | -} catch { |
650 | | -// ignore restore failures |
| 649 | +} catch (err) { |
| 650 | +log.warn( |
| 651 | +`failed to restore subagent runs from disk: ${err instanceof Error ? err.message : String(err)}`, |
| 652 | +); |
651 | 653 | } |
652 | 654 | } |
653 | 655 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。