fix(agents): stabilize sessions_spawn e2e suite

This commit is contained in:
Peter Steinberger
2026-02-15 22:39:40 +00:00
parent a948212ca7
commit 6b4590be06
4 changed files with 188 additions and 204 deletions

View File

@@ -271,7 +271,9 @@ describe("openclaw-tools: subagents (sessions_spawn model + thinking)", () => {
modelApplied: true,
});
const patchCall = calls.find((call) => call.method === "sessions.patch");
const patchCall = calls.find(
(call) => call.method === "sessions.patch" && (call.params as { model?: string })?.model,
);
expect(patchCall?.params).toMatchObject({
model: "opencode/claude",
});
@@ -287,7 +289,11 @@ describe("openclaw-tools: subagents (sessions_spawn model + thinking)", () => {
const request = opts as { method?: string; params?: unknown };
calls.push(request);
if (request.method === "sessions.patch") {
throw new Error("invalid model: bad-model");
const params = request.params as { model?: unknown } | undefined;
if (typeof params?.model === "string" && params.model.trim()) {
throw new Error("invalid model: bad-model");
}
return { ok: true };
}
if (request.method === "agent") {
agentCallCount += 1;