mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:00:43 +00:00
fix(agents): honor embedded ollama timeouts (#66418)
This commit is contained in:
@@ -8,6 +8,7 @@ Docs: https://docs.openclaw.ai
|
||||
|
||||
### Fixes
|
||||
|
||||
- Agents/Ollama: forward the configured embedded-run timeout into the global undici stream timeout tuning so slow local Ollama runs no longer inherit the default stream cutoff instead of the operator-set run timeout. (#63175) Thanks @mindcraftreader and @vincentkoc.
|
||||
- Models/Codex: include `apiKey` in the codex provider catalog output so the Pi ModelRegistry validator no longer rejects the entry and silently drops all custom models from every provider in `models.json`. (#66180) Thanks @hoyyeva.
|
||||
- Slack/interactions: apply the configured global `allowFrom` owner allowlist to channel block-action and modal interactive events, require an expected sender id for cross-verification, and reject ambiguous channel types so interactive triggers can no longer bypass the documented allowlist intent in channels without a `users` list. Open-by-default behavior is preserved when no allowlists are configured. (#66028) Thanks @eleqtrizit.
|
||||
- Media-understanding/attachments: fail closed when a local attachment path cannot be canonically resolved via `realpath`, so a `realpath` error can no longer downgrade the canonical-roots allowlist check to a non-canonical comparison; attachments that also have a URL still fall back to the network fetch path. (#66022) Thanks @eleqtrizit.
|
||||
|
||||
@@ -47,6 +47,8 @@ type AttemptSpawnWorkspaceHoisted = {
|
||||
createAgentSessionMock: UnknownMock;
|
||||
sessionManagerOpenMock: UnknownMock;
|
||||
resolveSandboxContextMock: UnknownMock;
|
||||
ensureGlobalUndiciEnvProxyDispatcherMock: UnknownMock;
|
||||
ensureGlobalUndiciStreamTimeoutsMock: UnknownMock;
|
||||
buildEmbeddedMessageActionDiscoveryInputMock: UnknownMock;
|
||||
subscribeEmbeddedPiSessionMock: Mock<SubscribeEmbeddedPiSessionFn>;
|
||||
acquireSessionWriteLockMock: Mock<AcquireSessionWriteLockFn>;
|
||||
@@ -71,6 +73,8 @@ const hoisted = vi.hoisted((): AttemptSpawnWorkspaceHoisted => {
|
||||
const createAgentSessionMock = vi.fn();
|
||||
const sessionManagerOpenMock = vi.fn();
|
||||
const resolveSandboxContextMock = vi.fn();
|
||||
const ensureGlobalUndiciEnvProxyDispatcherMock = vi.fn();
|
||||
const ensureGlobalUndiciStreamTimeoutsMock = vi.fn();
|
||||
const buildEmbeddedMessageActionDiscoveryInputMock = vi.fn((params: unknown) => params);
|
||||
const installToolResultContextGuardMock = vi.fn(() => () => {});
|
||||
const flushPendingToolResultsAfterIdleMock = vi.fn(async () => {});
|
||||
@@ -135,6 +139,8 @@ const hoisted = vi.hoisted((): AttemptSpawnWorkspaceHoisted => {
|
||||
createAgentSessionMock,
|
||||
sessionManagerOpenMock,
|
||||
resolveSandboxContextMock,
|
||||
ensureGlobalUndiciEnvProxyDispatcherMock,
|
||||
ensureGlobalUndiciStreamTimeoutsMock,
|
||||
buildEmbeddedMessageActionDiscoveryInputMock,
|
||||
subscribeEmbeddedPiSessionMock,
|
||||
acquireSessionWriteLockMock,
|
||||
@@ -209,8 +215,10 @@ vi.mock("../../../infra/machine-name.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../../../infra/net/undici-global-dispatcher.js", () => ({
|
||||
ensureGlobalUndiciEnvProxyDispatcher: () => {},
|
||||
ensureGlobalUndiciStreamTimeouts: () => {},
|
||||
ensureGlobalUndiciEnvProxyDispatcher: (...args: unknown[]) =>
|
||||
hoisted.ensureGlobalUndiciEnvProxyDispatcherMock(...args),
|
||||
ensureGlobalUndiciStreamTimeouts: (...args: unknown[]) =>
|
||||
hoisted.ensureGlobalUndiciStreamTimeoutsMock(...args),
|
||||
}));
|
||||
|
||||
vi.mock("../../bootstrap-files.js", async () => {
|
||||
@@ -683,6 +691,8 @@ export function resetEmbeddedAttemptHarness(
|
||||
hoisted.createAgentSessionMock.mockReset();
|
||||
hoisted.sessionManagerOpenMock.mockReset().mockReturnValue(hoisted.sessionManager);
|
||||
hoisted.resolveSandboxContextMock.mockReset();
|
||||
hoisted.ensureGlobalUndiciEnvProxyDispatcherMock.mockReset();
|
||||
hoisted.ensureGlobalUndiciStreamTimeoutsMock.mockReset();
|
||||
hoisted.buildEmbeddedMessageActionDiscoveryInputMock
|
||||
.mockReset()
|
||||
.mockImplementation((params) => params);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import {
|
||||
cleanupTempPaths,
|
||||
createContextEngineAttemptRunner,
|
||||
getHoisted,
|
||||
resetEmbeddedAttemptHarness,
|
||||
} from "./attempt.spawn-workspace.test-support.js";
|
||||
|
||||
const hoisted = getHoisted();
|
||||
|
||||
describe("runEmbeddedAttempt undici timeout wiring", () => {
|
||||
const tempPaths: string[] = [];
|
||||
|
||||
beforeEach(() => {
|
||||
resetEmbeddedAttemptHarness();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await cleanupTempPaths(tempPaths);
|
||||
});
|
||||
|
||||
it("forwards the configured run timeout into global undici stream tuning", async () => {
|
||||
await createContextEngineAttemptRunner({
|
||||
sessionKey: "agent:main:ollama-timeout-test",
|
||||
tempPaths,
|
||||
contextEngine: {
|
||||
assemble: async ({ messages }) => ({
|
||||
messages,
|
||||
estimatedTokens: 1,
|
||||
}),
|
||||
},
|
||||
attemptOverrides: {
|
||||
timeoutMs: 123_456,
|
||||
},
|
||||
});
|
||||
|
||||
expect(hoisted.ensureGlobalUndiciEnvProxyDispatcherMock).toHaveBeenCalledOnce();
|
||||
expect(hoisted.ensureGlobalUndiciStreamTimeoutsMock).toHaveBeenCalledWith({
|
||||
timeoutMs: 123_456,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -361,7 +361,7 @@ export async function runEmbeddedAttempt(
|
||||
// Proxy bootstrap must happen before timeout tuning so the timeouts wrap the
|
||||
// active EnvHttpProxyAgent instead of being replaced by a bare proxy dispatcher.
|
||||
ensureGlobalUndiciEnvProxyDispatcher();
|
||||
ensureGlobalUndiciStreamTimeouts();
|
||||
ensureGlobalUndiciStreamTimeouts({ timeoutMs: params.timeoutMs });
|
||||
|
||||
log.debug(
|
||||
`embedded run start: runId=${params.runId} sessionId=${params.sessionId} provider=${params.provider} model=${params.modelId} thinking=${params.thinkLevel} messageChannel=${params.messageChannel ?? params.messageProvider ?? "unknown"}`,
|
||||
|
||||
Reference in New Issue
Block a user