mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 12:41:12 +00:00
fix: detect Ollama "prompt too long" as context overflow error (#34019)
Merged via squash.
Prepared head SHA: 825a402f0f
Co-authored-by: lishuaigit <7495165+lishuaigit@users.noreply.github.com>
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Reviewed-by: @jalehman
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
resolveOwningPluginIdsForProvider,
|
||||
resolvePluginProviders,
|
||||
} from "./providers.js";
|
||||
import { resolvePluginCacheInputs } from "./roots.js";
|
||||
import type {
|
||||
ProviderAuthDoctorHintContext,
|
||||
ProviderAugmentModelCatalogContext,
|
||||
@@ -76,8 +77,16 @@ function resolveHookProviderCacheBucket(params: {
|
||||
return bucket;
|
||||
}
|
||||
|
||||
function buildHookProviderCacheKey(params: { workspaceDir?: string; onlyPluginIds?: string[] }) {
|
||||
return `${params.workspaceDir ?? ""}::${JSON.stringify(params.onlyPluginIds ?? [])}`;
|
||||
function buildHookProviderCacheKey(params: {
|
||||
workspaceDir?: string;
|
||||
onlyPluginIds?: string[];
|
||||
env?: NodeJS.ProcessEnv;
|
||||
}) {
|
||||
const { roots } = resolvePluginCacheInputs({
|
||||
workspaceDir: params.workspaceDir,
|
||||
env: params.env,
|
||||
});
|
||||
return `${roots.workspace ?? ""}::${roots.global}::${roots.stock ?? ""}::${JSON.stringify(params.onlyPluginIds ?? [])}`;
|
||||
}
|
||||
|
||||
export function resetProviderRuntimeHookCacheForTest(): void {
|
||||
@@ -105,6 +114,7 @@ function resolveProviderPluginsForHooks(params: {
|
||||
const cacheKey = buildHookProviderCacheKey({
|
||||
workspaceDir: params.workspaceDir,
|
||||
onlyPluginIds: params.onlyPluginIds,
|
||||
env,
|
||||
});
|
||||
const cached = cacheBucket.get(cacheKey);
|
||||
if (cached) {
|
||||
|
||||
@@ -153,9 +153,7 @@ describe("stageBundledPluginRuntime", () => {
|
||||
description: string;
|
||||
acceptsArgs: boolean;
|
||||
}>;
|
||||
matchPluginCommand: (
|
||||
commandBody: string,
|
||||
) => {
|
||||
matchPluginCommand: (commandBody: string) => {
|
||||
command: { handler: ({ args }: { args?: string }) => Promise<{ text: string }> };
|
||||
args?: string;
|
||||
} | null;
|
||||
|
||||
Reference in New Issue
Block a user