GeezerVison is showing github.com — fix(provider): restore plugin evidence fixtures after connectivity fa… · tickernelz/opencode-mem@f5f8cb6
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/index.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -454,8 +454,8 @@ export const OpenCodeMemPlugin: Plugin = async (ctx: PluginInput) => { |
454 | 454 | // on the call itself and falls back to the external API. |
455 | 455 | // Use the loader so we hit the same module instance as ensureProviderConnected. |
456 | 456 | if (CONFIG.opencodeProvider) { |
457 | | - const { setConnectedProviders } = await loadOpencodeProvider(); |
458 | | - setConnectedProviders([CONFIG.opencodeProvider]); |
| 457 | + const provider = await loadOpencodeProvider(); |
| 458 | + provider.setConnectedProviders?.([CONFIG.opencodeProvider]); |
459 | 459 | } |
460 | 460 | } |
461 | 461 | }; |
|
Collapse file
Copy file name to clipboardExpand all lines: src/services/capture-tool-evidence.ts +6-1Lines changed: 6 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -49,7 +49,12 @@ export function extractToolOutcome(state: any): Pick<ToolCallInfo, "status" | "o |
49 | 49 | } |
50 | 50 | if (typeof state?.error === "string") parts.push(state.error); |
51 | 51 | else if (typeof state?.error?.message === "string") parts.push(state.error.message); |
52 | | - const text = sanitizeMemoryContent(parts.join("\n")); |
| 52 | + // Bound before sanitizing: multi-megabyte tool logs must not run every |
| 53 | + // credential regex over the full payload. The kept excerpt is only |
| 54 | + // MAX_CAPTURE_TOOL_RESULT_BYTES; a 2× pre-bound leaves headroom so a split |
| 55 | + // UTF-8 / private tag at the cut still fails closed under sanitize. |
| 56 | + const bounded = truncateToMaxBytes(parts.join("\n"), MAX_CAPTURE_TOOL_RESULT_BYTES * 2, ""); |
| 57 | + const text = sanitizeMemoryContent(bounded); |
53 | 58 | return { |
54 | 59 | status: knownStatus, |
55 | 60 | ...(text ? { output: truncateToMaxBytes(text, MAX_CAPTURE_TOOL_RESULT_BYTES, OMITTED) } : {}), |
|
Collapse file
Copy file name to clipboardExpand all lines: tests/fixtures/capture-evidence-plugin.mjs +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -65,6 +65,8 @@ mock.module(u("services/ai/opencode-provider-loader"), () => ({ |
65 | 65 | setV2Client: () => {}, |
66 | 66 | createV2Client: () => ({}), |
67 | 67 | setStructuredOutputTimeoutConfig: () => {}, |
| 68 | + setConnectedProviders: () => {}, |
| 69 | + setProviderCatalog: () => {}, |
68 | 70 | setConnectedProvidersRefresher: () => {}, |
69 | 71 | clearConnectedProvidersRefresher: () => {}, |
70 | 72 | ensureProviderConnected: async () => true, |
|