mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-19 01:51:21 +08:00
Merge branch 'main' into persist-model-variant-selection
This commit is contained in:
@@ -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)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user