feat(task): validate sync delegation spawn depth
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -23,12 +23,19 @@ export async function executeSyncTask(
|
|||||||
fallbackChain?: import("../../shared/model-requirements").FallbackEntry[],
|
fallbackChain?: import("../../shared/model-requirements").FallbackEntry[],
|
||||||
deps: SyncTaskDeps = syncTaskDeps
|
deps: SyncTaskDeps = syncTaskDeps
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const { client, directory, onSyncSessionCreated, syncPollTimeoutMs } = executorCtx
|
const { manager, client, directory, onSyncSessionCreated, syncPollTimeoutMs } = executorCtx
|
||||||
const toastManager = getTaskToastManager()
|
const toastManager = getTaskToastManager()
|
||||||
let taskId: string | undefined
|
let taskId: string | undefined
|
||||||
let syncSessionID: string | undefined
|
let syncSessionID: string | undefined
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const spawnContext = typeof manager?.assertCanSpawn === "function"
|
||||||
|
? await manager.assertCanSpawn(parentContext.sessionID)
|
||||||
|
: {
|
||||||
|
rootSessionID: parentContext.sessionID,
|
||||||
|
parentDepth: 0,
|
||||||
|
childDepth: 1,
|
||||||
|
}
|
||||||
const createSessionResult = await deps.createSyncSession(client, {
|
const createSessionResult = await deps.createSyncSession(client, {
|
||||||
parentSessionID: parentContext.sessionID,
|
parentSessionID: parentContext.sessionID,
|
||||||
agentToUse,
|
agentToUse,
|
||||||
@@ -90,6 +97,7 @@ export async function executeSyncTask(
|
|||||||
run_in_background: args.run_in_background,
|
run_in_background: args.run_in_background,
|
||||||
sessionId: sessionID,
|
sessionId: sessionID,
|
||||||
sync: true,
|
sync: true,
|
||||||
|
spawnDepth: spawnContext.childDepth,
|
||||||
command: args.command,
|
command: args.command,
|
||||||
model: categoryModel ? { providerID: categoryModel.providerID, modelID: categoryModel.modelID } : undefined,
|
model: categoryModel ? { providerID: categoryModel.providerID, modelID: categoryModel.modelID } : undefined,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user