refactor: centralize agent timeout defaults
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
resolveModelRefFromString,
|
||||
resolveThinkingDefault,
|
||||
} from "../agents/model-selection.js";
|
||||
import { resolveAgentTimeoutMs } from "../agents/timeout.js";
|
||||
import {
|
||||
abortEmbeddedPiRun,
|
||||
isEmbeddedPiRunActive,
|
||||
@@ -927,14 +928,10 @@ export function createBridgeHandlers(ctx: BridgeHandlersContext) {
|
||||
const { cfg, storePath, store, entry } = loadSessionEntry(
|
||||
p.sessionKey,
|
||||
);
|
||||
const defaultTimeoutMs = Math.max(
|
||||
Math.floor((cfg.agent?.timeoutSeconds ?? 600) * 1000),
|
||||
0,
|
||||
);
|
||||
const timeoutMs =
|
||||
typeof p.timeoutMs === "number" && Number.isFinite(p.timeoutMs)
|
||||
? Math.max(0, Math.floor(p.timeoutMs))
|
||||
: defaultTimeoutMs;
|
||||
const timeoutMs = resolveAgentTimeoutMs({
|
||||
cfg,
|
||||
overrideMs: p.timeoutMs,
|
||||
});
|
||||
const now = Date.now();
|
||||
const sessionId = entry?.sessionId ?? randomUUID();
|
||||
const sessionEntry: SessionEntry = {
|
||||
|
||||
Reference in New Issue
Block a user