refactor(background-agent): normalize task ID field naming
Rename BackgroundTask and attempt ID fields to camelCase across background-agent consumers while moving BackgroundManager construction to a single config object. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -9,7 +9,7 @@ describe("executeBackgroundContinuation - subagent metadata", () => {
|
||||
description: "oracle consultation",
|
||||
agent: "oracle",
|
||||
status: "running",
|
||||
sessionID: "ses_resumed_123",
|
||||
sessionId: "ses_resumed_123",
|
||||
}),
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ describe("executeBackgroundContinuation - subagent metadata", () => {
|
||||
description: "unknown task",
|
||||
agent: undefined,
|
||||
status: "running",
|
||||
sessionID: "ses_resumed_456",
|
||||
sessionId: "ses_resumed_456",
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ export async function executeBackgroundContinuation(
|
||||
const task = await manager.resume({
|
||||
sessionId: taskID,
|
||||
prompt: effectivePrompt,
|
||||
parentSessionID: parentContext.sessionID,
|
||||
parentMessageID: parentContext.messageID,
|
||||
parentSessionId: parentContext.sessionID,
|
||||
parentMessageId: parentContext.messageID,
|
||||
parentModel: parentContext.model,
|
||||
parentAgent: parentContext.agent,
|
||||
parentTools: getSessionTools(parentContext.sessionID),
|
||||
})
|
||||
const sessionId = task.sessionID
|
||||
const sessionId = task.sessionId
|
||||
const backgroundTaskId = task.id
|
||||
const resolvedModel = resolveMetadataModel(task.model, parentContext.model)
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
const manager = {
|
||||
launch: async () => ({
|
||||
id: "bg_unresolved",
|
||||
sessionID: undefined,
|
||||
sessionId: undefined,
|
||||
description: "Unresolved session",
|
||||
agent: "explore",
|
||||
status: "running",
|
||||
@@ -72,12 +72,12 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
const manager = {
|
||||
launch: async () => ({
|
||||
id: "bg_resolved",
|
||||
sessionID: "ses_sub_123",
|
||||
sessionId: "ses_sub_123",
|
||||
description: "Resolved session",
|
||||
agent: "explore",
|
||||
status: "running",
|
||||
}),
|
||||
getTask: () => ({ sessionID: "ses_sub_123" }),
|
||||
getTask: () => ({ sessionId: "ses_sub_123" }),
|
||||
}
|
||||
|
||||
const result = await executeBackgroundTask(
|
||||
@@ -121,14 +121,14 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
const manager = {
|
||||
launch: async () => ({
|
||||
id: "bg_late",
|
||||
sessionID: undefined,
|
||||
sessionId: undefined,
|
||||
description: "Late session",
|
||||
agent: "explore",
|
||||
status: "running",
|
||||
}),
|
||||
getTask: () => {
|
||||
reads += 1
|
||||
return reads >= 2 ? { sessionID: "ses_late_123" } : undefined
|
||||
return reads >= 2 ? { sessionId: "ses_late_123" } : undefined
|
||||
},
|
||||
}
|
||||
|
||||
@@ -171,13 +171,13 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
launchCalls.push(input)
|
||||
return {
|
||||
id: "bg_permission",
|
||||
sessionID: "ses_permission_123",
|
||||
sessionId: "ses_permission_123",
|
||||
description: "Permission session",
|
||||
agent: "explore",
|
||||
status: "running",
|
||||
}
|
||||
},
|
||||
getTask: () => ({ sessionID: "ses_permission_123" }),
|
||||
getTask: () => ({ sessionId: "ses_permission_123" }),
|
||||
}
|
||||
|
||||
//#when
|
||||
@@ -217,13 +217,13 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
launchCalls.push(input)
|
||||
return {
|
||||
id: "bg_clean_agent",
|
||||
sessionID: "ses_clean_agent",
|
||||
sessionId: "ses_clean_agent",
|
||||
description: "Clean agent",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
}
|
||||
},
|
||||
getTask: () => ({ sessionID: "ses_clean_agent" }),
|
||||
getTask: () => ({ sessionId: "ses_clean_agent" }),
|
||||
}
|
||||
|
||||
//#when
|
||||
@@ -260,14 +260,14 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
const manager = {
|
||||
launch: async () => ({
|
||||
id: "bg_abort_after_launch",
|
||||
sessionID: undefined,
|
||||
sessionId: undefined,
|
||||
description: "Abort after launch",
|
||||
agent: "explore",
|
||||
status: "pending",
|
||||
}),
|
||||
getTask: () => {
|
||||
abortController.abort()
|
||||
return { sessionID: undefined, status: "pending" }
|
||||
return { sessionId: undefined, status: "pending" }
|
||||
},
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
const manager = {
|
||||
launch: async () => ({
|
||||
id: "bg_abort_category",
|
||||
sessionID: undefined,
|
||||
sessionId: undefined,
|
||||
description: "Abort category",
|
||||
agent: "explore",
|
||||
status: "pending",
|
||||
@@ -317,8 +317,8 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
getTask: () => {
|
||||
reads += 1
|
||||
return reads >= 2
|
||||
? { sessionID: "ses_abort_category", status: "running" }
|
||||
: { sessionID: undefined, status: "pending" }
|
||||
? { sessionId: "ses_abort_category", status: "running" }
|
||||
: { sessionId: undefined, status: "pending" }
|
||||
},
|
||||
}
|
||||
|
||||
@@ -359,12 +359,12 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
const manager = {
|
||||
launch: async () => ({
|
||||
id: "bg_abort_terminal",
|
||||
sessionID: undefined,
|
||||
sessionId: undefined,
|
||||
description: "Abort terminal",
|
||||
agent: "explore",
|
||||
status: "pending",
|
||||
}),
|
||||
getTask: () => ({ sessionID: undefined, status: "interrupt" }),
|
||||
getTask: () => ({ sessionId: undefined, status: "interrupt" }),
|
||||
}
|
||||
|
||||
//#when
|
||||
@@ -401,7 +401,7 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
const manager = {
|
||||
launch: async () => ({
|
||||
id: "bg_crash_before_prompt",
|
||||
sessionID: undefined,
|
||||
sessionId: undefined,
|
||||
description: "Crash before prompt",
|
||||
agent: "explore",
|
||||
status: "pending",
|
||||
@@ -409,9 +409,9 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
getTask: () => {
|
||||
reads += 1
|
||||
if (reads >= 2) {
|
||||
return { sessionID: "ses_orphan", status: "error", error: "crash between session creation and prompt send" }
|
||||
return { sessionId: "ses_orphan", status: "error", error: "crash between session creation and prompt send" }
|
||||
}
|
||||
return { sessionID: undefined, status: "pending" }
|
||||
return { sessionId: undefined, status: "pending" }
|
||||
},
|
||||
}
|
||||
|
||||
@@ -447,16 +447,16 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
const firstAbortController = new AbortController()
|
||||
const secondAbortController = new AbortController()
|
||||
const states = new Map([
|
||||
["bg_first", { reads: 0, abortOnFirstRead: true, sessionID: "ses_first" }],
|
||||
["bg_second", { reads: 0, abortOnFirstRead: false, sessionID: "ses_second" }],
|
||||
["bg_first", { reads: 0, abortOnFirstRead: true, sessionId: "ses_first" }],
|
||||
["bg_second", { reads: 0, abortOnFirstRead: false, sessionId: "ses_second" }],
|
||||
])
|
||||
let launchCount = 0
|
||||
const manager = {
|
||||
launch: async () => {
|
||||
launchCount += 1
|
||||
return launchCount === 1
|
||||
? { id: "bg_first", sessionID: undefined, description: "First", agent: "explore", status: "pending" }
|
||||
: { id: "bg_second", sessionID: undefined, description: "Second", agent: "explore", status: "pending" }
|
||||
? { id: "bg_first", sessionId: undefined, description: "First", agent: "explore", status: "pending" }
|
||||
: { id: "bg_second", sessionId: undefined, description: "Second", agent: "explore", status: "pending" }
|
||||
},
|
||||
getTask: (taskID: string) => {
|
||||
const state = states.get(taskID)
|
||||
@@ -466,8 +466,8 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
firstAbortController.abort()
|
||||
}
|
||||
return state.reads >= 2
|
||||
? { sessionID: state.sessionID, status: "running" }
|
||||
: { sessionID: undefined, status: "pending" }
|
||||
? { sessionId: state.sessionId, status: "running" }
|
||||
: { sessionId: undefined, status: "pending" }
|
||||
},
|
||||
}
|
||||
|
||||
@@ -531,13 +531,13 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
|
||||
launchCalls.push(input)
|
||||
return {
|
||||
id: "bg_legacy_zwsp",
|
||||
sessionID: "ses_legacy_zwsp",
|
||||
sessionId: "ses_legacy_zwsp",
|
||||
description: "Legacy ZWSP",
|
||||
agent: "Hephaestus - Deep Agent",
|
||||
status: "running",
|
||||
}
|
||||
},
|
||||
getTask: () => ({ sessionID: "ses_legacy_zwsp" }),
|
||||
getTask: () => ({ sessionId: "ses_legacy_zwsp" }),
|
||||
}
|
||||
|
||||
//#when
|
||||
|
||||
@@ -48,7 +48,7 @@ function continueSessionSetup(args: {
|
||||
return
|
||||
}
|
||||
|
||||
const sessionId = updated.sessionID
|
||||
const sessionId = updated.sessionId
|
||||
if (!sessionId) {
|
||||
continue
|
||||
}
|
||||
@@ -81,7 +81,7 @@ async function waitForBackgroundSessionStart(args: {
|
||||
return undefined
|
||||
}
|
||||
|
||||
sessionId = updated?.sessionID
|
||||
sessionId = updated?.sessionId
|
||||
if (sessionId) {
|
||||
return sessionId
|
||||
}
|
||||
@@ -117,8 +117,8 @@ export async function executeBackgroundTask(
|
||||
description: args.description,
|
||||
prompt: effectivePrompt,
|
||||
agent: normalizedAgent,
|
||||
parentSessionID: parentContext.sessionID,
|
||||
parentMessageID: parentContext.messageID,
|
||||
parentSessionId: parentContext.sessionID,
|
||||
parentMessageId: parentContext.messageID,
|
||||
parentModel: parentContext.model,
|
||||
parentAgent: parentContext.agent,
|
||||
parentTools: getSessionTools(parentContext.sessionID),
|
||||
@@ -137,7 +137,7 @@ export async function executeBackgroundTask(
|
||||
const timing = getTimingConfig()
|
||||
let sessionId = await waitForBackgroundSessionStart({
|
||||
taskId: task.id,
|
||||
initialSessionId: task.sessionID,
|
||||
initialSessionId: task.sessionId,
|
||||
manager,
|
||||
timing,
|
||||
abortSignal: ctx.abort,
|
||||
|
||||
@@ -36,7 +36,7 @@ describe("task tool metadata awaiting", () => {
|
||||
prompt: "Do something",
|
||||
agent: "explore",
|
||||
status: "pending",
|
||||
sessionID: "ses_child",
|
||||
sessionId: "ses_child",
|
||||
}),
|
||||
getTask: () => undefined,
|
||||
},
|
||||
|
||||
@@ -67,7 +67,7 @@ describe("metadata model unification", () => {
|
||||
manager: {
|
||||
launch: async () => ({
|
||||
id: "bg_1", description: "test", agent: "explore",
|
||||
status: "pending", sessionID: "ses_bg", model: MODEL,
|
||||
status: "pending", sessionId: "ses_bg", model: MODEL,
|
||||
}),
|
||||
getTask: () => undefined,
|
||||
},
|
||||
@@ -88,7 +88,7 @@ describe("metadata model unification", () => {
|
||||
|
||||
const launchedTask = {
|
||||
id: "bg_unstable", description: "test", agent: "explore",
|
||||
status: "completed", sessionID: "ses_unstable", model: MODEL,
|
||||
status: "completed", sessionId: "ses_unstable", model: MODEL,
|
||||
}
|
||||
await executeUnstableAgentTask(
|
||||
args, ctx,
|
||||
@@ -130,7 +130,7 @@ describe("metadata model unification", () => {
|
||||
manager: {
|
||||
resume: async () => ({
|
||||
id: "bg_2", description: "continue", agent: "explore",
|
||||
status: "running", sessionID: "ses_resumed", model: MODEL,
|
||||
status: "running", sessionId: "ses_resumed", model: MODEL,
|
||||
}),
|
||||
},
|
||||
} as any, parentContext)
|
||||
@@ -210,7 +210,7 @@ describe("metadata model unification", () => {
|
||||
manager: {
|
||||
launch: async () => ({
|
||||
id: "bg_1", description: "test", agent: "explore",
|
||||
status: "pending", sessionID: "ses_bg",
|
||||
status: "pending", sessionId: "ses_bg",
|
||||
}),
|
||||
getTask: () => undefined,
|
||||
},
|
||||
@@ -231,7 +231,7 @@ describe("metadata model unification", () => {
|
||||
|
||||
const launchedTask = {
|
||||
id: "bg_unstable", description: "test", agent: "explore",
|
||||
status: "completed", sessionID: "ses_unstable",
|
||||
status: "completed", sessionId: "ses_unstable",
|
||||
}
|
||||
|
||||
await executeUnstableAgentTask(
|
||||
@@ -274,7 +274,7 @@ describe("metadata model unification", () => {
|
||||
manager: {
|
||||
resume: async () => ({
|
||||
id: "bg_2", description: "continue", agent: "explore",
|
||||
status: "running", sessionID: "ses_resumed",
|
||||
status: "running", sessionId: "ses_resumed",
|
||||
}),
|
||||
},
|
||||
} as any, parentContext)
|
||||
@@ -385,7 +385,7 @@ describe("metadata model unification", () => {
|
||||
manager: {
|
||||
launch: async () => ({
|
||||
id: "bg_variant", description: "test", agent: "explore",
|
||||
status: "pending", sessionID: "ses_bg_variant", model: MODEL_WITH_VARIANT,
|
||||
status: "pending", sessionId: "ses_bg_variant", model: MODEL_WITH_VARIANT,
|
||||
}),
|
||||
getTask: () => undefined,
|
||||
},
|
||||
@@ -406,7 +406,7 @@ describe("metadata model unification", () => {
|
||||
|
||||
const launchedTask = {
|
||||
id: "bg_unstable_variant", description: "test", agent: "explore",
|
||||
status: "completed", sessionID: "ses_unstable_variant", model: MODEL_WITH_VARIANT,
|
||||
status: "completed", sessionId: "ses_unstable_variant", model: MODEL_WITH_VARIANT,
|
||||
}
|
||||
|
||||
await executeUnstableAgentTask(
|
||||
@@ -449,7 +449,7 @@ describe("metadata model unification", () => {
|
||||
manager: {
|
||||
resume: async () => ({
|
||||
id: "bg_resume_variant", description: "continue", agent: "explore",
|
||||
status: "running", sessionID: "ses_resumed_variant", model: MODEL_WITH_VARIANT,
|
||||
status: "running", sessionId: "ses_resumed_variant", model: MODEL_WITH_VARIANT,
|
||||
}),
|
||||
},
|
||||
} as any, parentContext)
|
||||
|
||||
@@ -68,7 +68,7 @@ describe("taskId and backgroundTaskId metadata consistency", () => {
|
||||
manager: {
|
||||
launch: async () => ({
|
||||
id: "bg_abc123", description: "test", agent: "explore",
|
||||
status: "pending", sessionID: "ses_xyz789",
|
||||
status: "pending", sessionId: "ses_xyz789",
|
||||
}),
|
||||
getTask: () => undefined,
|
||||
},
|
||||
@@ -93,7 +93,7 @@ describe("taskId and backgroundTaskId metadata consistency", () => {
|
||||
|
||||
const launchedTask = {
|
||||
id: "bg_unstable_abc", description: "test", agent: "explore",
|
||||
status: "completed", sessionID: "ses_unstable_xyz",
|
||||
status: "completed", sessionId: "ses_unstable_xyz",
|
||||
}
|
||||
|
||||
await executeUnstableAgentTask(
|
||||
@@ -140,7 +140,7 @@ describe("taskId and backgroundTaskId metadata consistency", () => {
|
||||
manager: {
|
||||
resume: async () => ({
|
||||
id: "bg_resumed_y", description: "continue", agent: "explore",
|
||||
status: "running", sessionID: "ses_resumed_x", model: MODEL,
|
||||
status: "running", sessionId: "ses_resumed_x", model: MODEL,
|
||||
}),
|
||||
},
|
||||
} as any, parentContext)
|
||||
@@ -164,7 +164,7 @@ describe("taskId and backgroundTaskId metadata consistency", () => {
|
||||
manager: {
|
||||
resume: async () => ({
|
||||
id: "bg_resumed_y", description: "continue", agent: "explore",
|
||||
status: "running", sessionID: "ses_resumed_x", model: MODEL, category: "deep",
|
||||
status: "running", sessionId: "ses_resumed_x", model: MODEL, category: "deep",
|
||||
}),
|
||||
},
|
||||
} as any, parentContext)
|
||||
@@ -191,7 +191,7 @@ describe("taskId and backgroundTaskId metadata consistency", () => {
|
||||
manager: {
|
||||
resume: async () => ({
|
||||
id: "bg_resumed_y", description: "continue", agent: "explore",
|
||||
status: "running", sessionID: "ses_resumed_x", model: MODEL,
|
||||
status: "running", sessionId: "ses_resumed_x", model: MODEL,
|
||||
}),
|
||||
},
|
||||
} as any, parentContext)
|
||||
@@ -372,7 +372,7 @@ describe("taskId and backgroundTaskId metadata consistency", () => {
|
||||
manager: {
|
||||
launch: async () => ({
|
||||
id: "bg_abc123", description: "test", agent: "Sisyphus-Junior",
|
||||
status: "pending", sessionID: "ses_xyz789",
|
||||
status: "pending", sessionId: "ses_xyz789",
|
||||
}),
|
||||
getTask: () => undefined,
|
||||
},
|
||||
@@ -397,7 +397,7 @@ describe("taskId and backgroundTaskId metadata consistency", () => {
|
||||
|
||||
const launchedTask = {
|
||||
id: "bg_unstable_abc", description: "test", agent: "Sisyphus-Junior",
|
||||
status: "completed", sessionID: "ses_unstable_xyz",
|
||||
status: "completed", sessionId: "ses_unstable_xyz",
|
||||
}
|
||||
|
||||
await executeUnstableAgentTask(
|
||||
@@ -436,7 +436,7 @@ describe("taskId and backgroundTaskId metadata consistency", () => {
|
||||
const manager = {
|
||||
getTask: (id: string) => ({
|
||||
id,
|
||||
sessionID: "ses_bg_session",
|
||||
sessionId: "ses_bg_session",
|
||||
agent: "explore",
|
||||
category: "deep",
|
||||
description: "test",
|
||||
|
||||
@@ -131,7 +131,7 @@ describe("delegate-task Oracle gap closure", () => {
|
||||
description: "existing",
|
||||
agent: "explore",
|
||||
status: "running",
|
||||
sessionID: "ses_bg_category",
|
||||
sessionId: "ses_bg_category",
|
||||
category: "deep",
|
||||
model: MODEL,
|
||||
}),
|
||||
@@ -163,7 +163,7 @@ describe("delegate-task Oracle gap closure", () => {
|
||||
description: "old desc",
|
||||
agent: "explore",
|
||||
status: "running",
|
||||
sessionID: "ses_bg_title",
|
||||
sessionId: "ses_bg_title",
|
||||
model: MODEL,
|
||||
}),
|
||||
},
|
||||
@@ -221,7 +221,7 @@ describe("delegate-task Oracle gap closure", () => {
|
||||
description: "existing",
|
||||
agent: "explore",
|
||||
status: "running",
|
||||
sessionID: "ses_bg_skills",
|
||||
sessionId: "ses_bg_skills",
|
||||
model: MODEL,
|
||||
}
|
||||
},
|
||||
|
||||
@@ -161,8 +161,8 @@ describe("syncPollTimeoutMs threading", () => {
|
||||
}
|
||||
|
||||
const mockManager = {
|
||||
launch: async () => ({ id: "task_001", sessionID: "ses_unstable", status: "running" }),
|
||||
getTask: () => ({ id: "task_001", sessionID: "ses_unstable", status: "running" }),
|
||||
launch: async () => ({ id: "task_001", sessionId: "ses_unstable", status: "running" }),
|
||||
getTask: () => ({ id: "task_001", sessionId: "ses_unstable", status: "running" }),
|
||||
}
|
||||
|
||||
const result = await executeUnstableAgentTask(
|
||||
|
||||
@@ -141,4 +141,4 @@ describe("fetchSyncResult", () => {
|
||||
expect(result.ok).toBe(false)
|
||||
expect(result.error).toContain("No assistant response found")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -578,7 +578,7 @@ describe("sisyphus-task", () => {
|
||||
// given a mock client with no model in config
|
||||
const { createDelegateTask } = require("./tools")
|
||||
|
||||
const mockManager = { launch: async () => ({ id: "task-123", status: "pending", description: "Test task", agent: "sisyphus-junior", sessionID: "test-session" }) }
|
||||
const mockManager = { launch: async () => ({ id: "task-123", status: "pending", description: "Test task", agent: "sisyphus-junior", sessionId: "test-session" }) }
|
||||
const mockClient = {
|
||||
app: { agents: async () => ({ data: [] }) },
|
||||
config: { get: async () => ({}) }, // No model configured
|
||||
@@ -687,7 +687,7 @@ describe("sisyphus-task", () => {
|
||||
const task = { id: "bg_1", status: "pending", description: "Test task", agent: "explore" }
|
||||
tasks.set(task.id, task)
|
||||
setTimeout(() => {
|
||||
tasks.set(task.id, { ...task, status: "running", sessionID: "ses_child" })
|
||||
tasks.set(task.id, { ...task, status: "running", sessionId: "ses_child" })
|
||||
}, 20)
|
||||
return task
|
||||
},
|
||||
@@ -1363,7 +1363,7 @@ describe("sisyphus-task", () => {
|
||||
test("#given task_id without run_in_background #when executing #then throws required parameter error", async () => {
|
||||
// given
|
||||
const { createDelegateTask } = require("./tools")
|
||||
const mockManager = { resume: async () => ({ id: "task-1", sessionID: "ses_1", status: "running" }) }
|
||||
const mockManager = { resume: async () => ({ id: "task-1", sessionId: "ses_1", status: "running" }) }
|
||||
const mockClient = {
|
||||
app: { agents: async () => ({ data: [] }) },
|
||||
config: { get: async () => ({ data: { model: SYSTEM_DEFAULT_MODEL } }) },
|
||||
@@ -1596,7 +1596,7 @@ describe("sisyphus-task", () => {
|
||||
launchCalled = true
|
||||
return {
|
||||
id: "bg_explicit_true",
|
||||
sessionID: "ses_bg_explicit_true",
|
||||
sessionId: "ses_bg_explicit_true",
|
||||
description: "Explicit true",
|
||||
agent: "Sisyphus-Junior",
|
||||
status: "running",
|
||||
@@ -1639,8 +1639,8 @@ describe("sisyphus-task", () => {
|
||||
const firstAbortController = new AbortController()
|
||||
const secondAbortController = new AbortController()
|
||||
const taskStates = new Map([
|
||||
["bg_tool_first", { reads: 0, abortOnFirstRead: true, sessionID: "ses_tool_first" }],
|
||||
["bg_tool_second", { reads: 0, abortOnFirstRead: false, sessionID: "ses_tool_second" }],
|
||||
["bg_tool_first", { reads: 0, abortOnFirstRead: true, sessionId: "ses_tool_first" }],
|
||||
["bg_tool_second", { reads: 0, abortOnFirstRead: false, sessionId: "ses_tool_second" }],
|
||||
])
|
||||
let launchCount = 0
|
||||
const mockManager = {
|
||||
@@ -1649,14 +1649,14 @@ describe("sisyphus-task", () => {
|
||||
return launchCount === 1
|
||||
? {
|
||||
id: "bg_tool_first",
|
||||
sessionID: undefined,
|
||||
sessionId: undefined,
|
||||
description: "Tool first",
|
||||
agent: "Sisyphus-Junior",
|
||||
status: "running",
|
||||
}
|
||||
: {
|
||||
id: "bg_tool_second",
|
||||
sessionID: undefined,
|
||||
sessionId: undefined,
|
||||
description: "Tool second",
|
||||
agent: "Sisyphus-Junior",
|
||||
status: "running",
|
||||
@@ -1670,8 +1670,8 @@ describe("sisyphus-task", () => {
|
||||
firstAbortController.abort()
|
||||
}
|
||||
return state.reads >= 2
|
||||
? { sessionID: state.sessionID, status: "running" }
|
||||
: { sessionID: undefined, status: "pending" }
|
||||
? { sessionId: state.sessionId, status: "running" }
|
||||
: { sessionId: undefined, status: "pending" }
|
||||
},
|
||||
}
|
||||
const mockClient = {
|
||||
@@ -1728,7 +1728,7 @@ describe("sisyphus-task", () => {
|
||||
|
||||
const mockTask = {
|
||||
id: "task-123",
|
||||
sessionID: "ses_continue_test",
|
||||
sessionId: "ses_continue_test",
|
||||
description: "Continued task",
|
||||
agent: "explore",
|
||||
status: "running",
|
||||
@@ -1890,7 +1890,7 @@ describe("sisyphus-task", () => {
|
||||
}
|
||||
|
||||
const tool = createDelegateTask({
|
||||
manager: { resume: async () => ({ id: "task-var", sessionID: "ses_var_test", description: "Variant test", agent: "sisyphus-junior", status: "running" }) },
|
||||
manager: { resume: async () => ({ id: "task-var", sessionId: "ses_var_test", description: "Variant test", agent: "sisyphus-junior", status: "running" }) },
|
||||
client: mockClient,
|
||||
})
|
||||
|
||||
@@ -1927,7 +1927,7 @@ describe("sisyphus-task", () => {
|
||||
|
||||
const mockTask = {
|
||||
id: "task-456",
|
||||
sessionID: "ses_bg_continue",
|
||||
sessionId: "ses_bg_continue",
|
||||
description: "Background continued task",
|
||||
agent: "explore",
|
||||
status: "running",
|
||||
@@ -2223,7 +2223,7 @@ describe("sisyphus-task", () => {
|
||||
|
||||
const launchedTask = {
|
||||
id: "task-unstable",
|
||||
sessionID: "ses_unstable_gemini",
|
||||
sessionId: "ses_unstable_gemini",
|
||||
description: "Unstable gemini task",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
@@ -2294,7 +2294,7 @@ describe("sisyphus-task", () => {
|
||||
launchCalled = true
|
||||
return {
|
||||
id: "task-normal-bg",
|
||||
sessionID: "ses_normal_bg",
|
||||
sessionId: "ses_normal_bg",
|
||||
description: "Normal background task",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
@@ -2350,7 +2350,7 @@ describe("sisyphus-task", () => {
|
||||
|
||||
const launchedTask = {
|
||||
id: "task-unstable-minimax",
|
||||
sessionID: "ses_unstable_minimax",
|
||||
sessionId: "ses_unstable_minimax",
|
||||
description: "Unstable minimax task",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
@@ -2424,7 +2424,7 @@ describe("sisyphus-task", () => {
|
||||
const mockManager = {
|
||||
launch: async () => {
|
||||
launchCalled = true
|
||||
return { id: "should-not-be-called", sessionID: "x", description: "x", agent: "x", status: "running" }
|
||||
return { id: "should-not-be-called", sessionId: "x", description: "x", agent: "x", status: "running" }
|
||||
},
|
||||
}
|
||||
|
||||
@@ -2486,7 +2486,7 @@ describe("sisyphus-task", () => {
|
||||
|
||||
const launchedTask = {
|
||||
id: "task-artistry",
|
||||
sessionID: "ses_artistry_gemini",
|
||||
sessionId: "ses_artistry_gemini",
|
||||
description: "Artistry gemini task",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
@@ -2569,7 +2569,7 @@ describe("sisyphus-task", () => {
|
||||
const mockManager = {
|
||||
launch: async () => {
|
||||
launchCalled = true
|
||||
return { id: "should-not-be-called", sessionID: "x", description: "x", agent: "x", status: "running" }
|
||||
return { id: "should-not-be-called", sessionId: "x", description: "x", agent: "x", status: "running" }
|
||||
},
|
||||
}
|
||||
|
||||
@@ -2630,7 +2630,7 @@ describe("sisyphus-task", () => {
|
||||
|
||||
const launchedTask = {
|
||||
id: "task-custom-unstable",
|
||||
sessionID: "ses_custom_unstable",
|
||||
sessionId: "ses_custom_unstable",
|
||||
description: "Custom unstable task",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
@@ -2711,7 +2711,7 @@ describe("sisyphus-task", () => {
|
||||
launchInput = input
|
||||
return {
|
||||
id: "task-fallback",
|
||||
sessionID: "ses_fallback_test",
|
||||
sessionId: "ses_fallback_test",
|
||||
description: "Fallback test task",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
@@ -2775,7 +2775,7 @@ describe("sisyphus-task", () => {
|
||||
launchInput = input
|
||||
return {
|
||||
id: "task-ui-model",
|
||||
sessionID: "ses_ui_model_test",
|
||||
sessionId: "ses_ui_model_test",
|
||||
description: "UI model inheritance test",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
@@ -2839,7 +2839,7 @@ describe("sisyphus-task", () => {
|
||||
launchInput = input
|
||||
return {
|
||||
id: "task-override",
|
||||
sessionID: "ses_override_test",
|
||||
sessionId: "ses_override_test",
|
||||
description: "Override precedence test",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
@@ -2900,7 +2900,7 @@ describe("sisyphus-task", () => {
|
||||
launchInput = input
|
||||
return {
|
||||
id: "task-category-precedence",
|
||||
sessionID: "ses_category_precedence_test",
|
||||
sessionId: "ses_category_precedence_test",
|
||||
description: "Category precedence test",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
@@ -2965,7 +2965,7 @@ describe("sisyphus-task", () => {
|
||||
launchInput = input
|
||||
return {
|
||||
id: "task-1295-quick",
|
||||
sessionID: "ses_1295_quick",
|
||||
sessionId: "ses_1295_quick",
|
||||
description: "Issue 1295 regression",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
@@ -3027,7 +3027,7 @@ describe("sisyphus-task", () => {
|
||||
launchInput = input
|
||||
return {
|
||||
id: "task-1295-custom",
|
||||
sessionID: "ses_1295_custom",
|
||||
sessionId: "ses_1295_custom",
|
||||
description: "Issue 1295 custom category",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
@@ -3737,7 +3737,7 @@ describe("sisyphus-task", () => {
|
||||
launchInput = input
|
||||
return {
|
||||
id: "task-explore",
|
||||
sessionID: "ses_explore_model",
|
||||
sessionId: "ses_explore_model",
|
||||
description: "Explore task",
|
||||
agent: "explore",
|
||||
status: "running",
|
||||
@@ -4369,7 +4369,7 @@ describe("sisyphus-task", () => {
|
||||
const mockManager = {
|
||||
launch: async () => ({
|
||||
id: "bg_meta_test",
|
||||
sessionID: "ses_bg_metadata",
|
||||
sessionId: "ses_bg_metadata",
|
||||
description: "Background metadata test",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
|
||||
@@ -59,8 +59,8 @@ describe("executeUnstableAgentTask cleanup", () => {
|
||||
const cancelCalls: Array<{ taskId: string; options?: Record<string, unknown> }> = []
|
||||
|
||||
const mockManager = {
|
||||
launch: async () => ({ id: "bg_abort_monitoring", sessionID: "ses_abort_monitoring", status: "running" }),
|
||||
getTask: () => ({ id: "bg_abort_monitoring", sessionID: "ses_abort_monitoring", status: "running" }),
|
||||
launch: async () => ({ id: "bg_abort_monitoring", sessionId: "ses_abort_monitoring", status: "running" }),
|
||||
getTask: () => ({ id: "bg_abort_monitoring", sessionId: "ses_abort_monitoring", status: "running" }),
|
||||
cancelTask: async (taskId: string, options?: Record<string, unknown>) => {
|
||||
cancelCalls.push({ taskId, options })
|
||||
return true
|
||||
@@ -99,8 +99,8 @@ describe("executeUnstableAgentTask cleanup", () => {
|
||||
const cancelCalls: Array<{ taskId: string; options?: Record<string, unknown> }> = []
|
||||
|
||||
const mockManager = {
|
||||
launch: async () => ({ id: "bg_timeout_cleanup", sessionID: "ses_timeout_cleanup", status: "running" }),
|
||||
getTask: () => ({ id: "bg_timeout_cleanup", sessionID: "ses_timeout_cleanup", status: "running" }),
|
||||
launch: async () => ({ id: "bg_timeout_cleanup", sessionId: "ses_timeout_cleanup", status: "running" }),
|
||||
getTask: () => ({ id: "bg_timeout_cleanup", sessionId: "ses_timeout_cleanup", status: "running" }),
|
||||
cancelTask: async (taskId: string, options?: Record<string, unknown>) => {
|
||||
cancelCalls.push({ taskId, options })
|
||||
return true
|
||||
|
||||
@@ -11,7 +11,7 @@ describe("executeUnstableAgentTask session permission", () => {
|
||||
launchCalls.push(input)
|
||||
return {
|
||||
id: "bg_unstable_permission",
|
||||
sessionID: "ses_unstable_permission",
|
||||
sessionId: "ses_unstable_permission",
|
||||
description: "test task",
|
||||
agent: "sisyphus-junior",
|
||||
status: "running",
|
||||
@@ -19,7 +19,7 @@ describe("executeUnstableAgentTask session permission", () => {
|
||||
},
|
||||
getTask: () => ({
|
||||
id: "bg_unstable_permission",
|
||||
sessionID: "ses_unstable_permission",
|
||||
sessionId: "ses_unstable_permission",
|
||||
status: "interrupt",
|
||||
description: "test task",
|
||||
agent: "sisyphus-junior",
|
||||
|
||||
@@ -25,7 +25,7 @@ describe("executeUnstableAgentTask - interrupt detection", () => {
|
||||
//#given - a background task that gets interrupted on first poll check
|
||||
const taskState = {
|
||||
id: "bg_test_interrupt",
|
||||
sessionID: "ses_test_interrupt",
|
||||
sessionId: "ses_test_interrupt",
|
||||
status: "interrupt" as string,
|
||||
description: "test interrupted task",
|
||||
prompt: "test prompt",
|
||||
@@ -42,7 +42,7 @@ describe("executeUnstableAgentTask - interrupt detection", () => {
|
||||
|
||||
const mockClient = {
|
||||
session: {
|
||||
status: async () => ({ data: { [taskState.sessionID!]: { type: "idle" } } }),
|
||||
status: async () => ({ data: { [taskState.sessionId!]: { type: "idle" } } }),
|
||||
messages: async () => ({ data: [] }),
|
||||
},
|
||||
}
|
||||
@@ -92,7 +92,7 @@ describe("executeUnstableAgentTask - interrupt detection", () => {
|
||||
//#given - a background task that is already errored when poll checks
|
||||
const taskState = {
|
||||
id: "bg_test_error",
|
||||
sessionID: "ses_test_error",
|
||||
sessionId: "ses_test_error",
|
||||
status: "error" as string,
|
||||
description: "test error task",
|
||||
prompt: "test prompt",
|
||||
@@ -109,7 +109,7 @@ describe("executeUnstableAgentTask - interrupt detection", () => {
|
||||
|
||||
const mockClient = {
|
||||
session: {
|
||||
status: async () => ({ data: { [taskState.sessionID!]: { type: "idle" } } }),
|
||||
status: async () => ({ data: { [taskState.sessionId!]: { type: "idle" } } }),
|
||||
messages: async () => ({ data: [] }),
|
||||
},
|
||||
}
|
||||
@@ -159,7 +159,7 @@ describe("executeUnstableAgentTask - interrupt detection", () => {
|
||||
//#given - a background task that is already cancelled when poll checks
|
||||
const taskState = {
|
||||
id: "bg_test_cancel",
|
||||
sessionID: "ses_test_cancel",
|
||||
sessionId: "ses_test_cancel",
|
||||
status: "cancelled" as string,
|
||||
description: "test cancelled task",
|
||||
prompt: "test prompt",
|
||||
@@ -176,7 +176,7 @@ describe("executeUnstableAgentTask - interrupt detection", () => {
|
||||
|
||||
const mockClient = {
|
||||
session: {
|
||||
status: async () => ({ data: { [taskState.sessionID!]: { type: "idle" } } }),
|
||||
status: async () => ({ data: { [taskState.sessionId!]: { type: "idle" } } }),
|
||||
messages: async () => ({ data: [] }),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ export async function executeUnstableAgentTask(
|
||||
description: args.description,
|
||||
prompt: effectivePrompt,
|
||||
agent: agentToUse,
|
||||
parentSessionID: parentContext.sessionID,
|
||||
parentMessageID: parentContext.messageID,
|
||||
parentSessionId: parentContext.sessionID,
|
||||
parentMessageId: parentContext.messageID,
|
||||
parentModel: parentContext.model,
|
||||
parentAgent: parentContext.agent,
|
||||
parentTools: getSessionTools(parentContext.sessionID),
|
||||
@@ -48,7 +48,7 @@ export async function executeUnstableAgentTask(
|
||||
|
||||
const timing = getTimingConfig()
|
||||
const waitStart = Date.now()
|
||||
let sessionID = task.sessionID
|
||||
let sessionID = task.sessionId
|
||||
while (!sessionID && Date.now() - waitStart < timing.WAIT_FOR_SESSION_TIMEOUT_MS) {
|
||||
if (ctx.abort?.aborted) {
|
||||
cleanupReason = "Parent aborted while waiting for unstable task session start"
|
||||
@@ -56,7 +56,7 @@ export async function executeUnstableAgentTask(
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, timing.WAIT_FOR_SESSION_INTERVAL_MS))
|
||||
const updated = manager.getTask(task.id)
|
||||
sessionID = updated?.sessionID
|
||||
sessionID = updated?.sessionId
|
||||
}
|
||||
if (!sessionID) {
|
||||
cleanupReason = "Unstable task session start timed out before session became available"
|
||||
|
||||
@@ -22,8 +22,8 @@ describe("executeUnstableAgentTask timeout handling", () => {
|
||||
const { executeUnstableAgentTask } = require("./unstable-agent-task")
|
||||
|
||||
const mockManager = {
|
||||
launch: async () => ({ id: "task_001", sessionID: "ses_timeout", status: "running" }),
|
||||
getTask: () => ({ id: "task_001", sessionID: "ses_timeout", status: "running" }),
|
||||
launch: async () => ({ id: "task_001", sessionId: "ses_timeout", status: "running" }),
|
||||
getTask: () => ({ id: "task_001", sessionId: "ses_timeout", status: "running" }),
|
||||
}
|
||||
|
||||
const mockClient = {
|
||||
|
||||
Reference in New Issue
Block a user