Merge branch 'main' into persist-model-variant-selection

This commit is contained in:
Marius
2026-08-06 16:17:06 +02:00
committed by GitHub
54 changed files with 1736 additions and 81 deletions
@@ -1,10 +1,10 @@
import { AppNodeBuilder } from "@opencode-ai/core/effect/app-node-builder"
import { describe, expect, test } from "bun:test"
import { Effect, Layer, ManagedRuntime, Queue } from "effect"
import { Effect, Layer, ManagedRuntime, Queue, Schema } from "effect"
import { MessageID, SessionID } from "../../src/session/schema"
import { provideTmpdirInstance } from "../fixture/fixture"
import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner"
import { AgentManagerTool } from "../../src/kilocode/tool/agent-manager"
import { AgentManagerTool, Params } from "../../src/kilocode/tool/agent-manager"
import { AgentManagerEvent, type AgentManagerStart } from "../../src/kilocode/agent-manager/event"
import { AgentManager } from "../../src/kilocode/agent-manager/service"
import { Bus } from "../../src/bus"
@@ -164,8 +164,9 @@ describe("agent_manager tool", () => {
expect(action && typeof action === "object" ? action.description : undefined).toContain("Use list first")
expect(action && typeof action === "object" ? action.description : undefined).toContain("Never edit")
expect(schema.properties?.sessionID).toEqual(
expect.objectContaining({ description: expect.stringContaining("returned by action=list") }),
expect.objectContaining({ description: expect.stringContaining("IDs start with ses_") }),
)
expect(schema.properties?.sessionID).not.toHaveProperty("pattern")
expect(schema.properties?.sectionID).toEqual(
expect.objectContaining({ description: expect.stringContaining("Use null to unassign") }),
)
@@ -186,6 +187,11 @@ describe("agent_manager tool", () => {
])
})
test("keeps session ID validation local", () => {
expect(Schema.is(Params)({ action: "stop", sessionID: "ses_target" })).toBe(true)
expect(Schema.is(Params)({ action: "stop", sessionID: "invalid" })).toBe(false)
})
test("asks for agent_manager permission", async () => {
const tool = await init()
const calls: unknown[] = []
@@ -1,5 +1,7 @@
import { describe, expect, test } from "bun:test"
import { Cause } from "effect"
import { LockTimeoutError, SqlError, UnknownError } from "effect/unstable/sql/SqlError"
import { EffectDrizzleQueryError } from "drizzle-orm/effect-core/errors"
import { busyMessage, isBusy } from "@/kilocode/database/sqlite-error"
describe("SQLite errors", () => {
@@ -27,4 +29,22 @@ describe("SQLite errors", () => {
expect(isBusy(error)).toBe(false)
})
test("recognizes lock timeouts wrapped by Drizzle", () => {
const error = new EffectDrizzleQueryError({
query: "update credential set value = ?",
params: ["<redacted>"],
cause: Cause.fail(
new SqlError({
reason: new LockTimeoutError({
cause: new Error("database is locked"),
message: "Failed to execute statement",
operation: "execute",
}),
}),
),
})
expect(isBusy(error)).toBe(true)
})
})