From 98e24baef0c205826ae0bdc06268ac5bdf1e84e8 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sun, 8 Mar 2026 02:22:22 +0900 Subject: [PATCH] feat(task): validate sync delegation spawn depth Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- src/tools/delegate-task/sync-task.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tools/delegate-task/sync-task.ts b/src/tools/delegate-task/sync-task.ts index 115d2c57d..07f080c48 100644 --- a/src/tools/delegate-task/sync-task.ts +++ b/src/tools/delegate-task/sync-task.ts @@ -23,12 +23,19 @@ export async function executeSyncTask( fallbackChain?: import("../../shared/model-requirements").FallbackEntry[], deps: SyncTaskDeps = syncTaskDeps ): Promise { - const { client, directory, onSyncSessionCreated, syncPollTimeoutMs } = executorCtx + const { manager, client, directory, onSyncSessionCreated, syncPollTimeoutMs } = executorCtx const toastManager = getTaskToastManager() let taskId: string | undefined let syncSessionID: string | undefined 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, { parentSessionID: parentContext.sessionID, agentToUse, @@ -90,6 +97,7 @@ export async function executeSyncTask( run_in_background: args.run_in_background, sessionId: sessionID, sync: true, + spawnDepth: spawnContext.childDepth, command: args.command, model: categoryModel ? { providerID: categoryModel.providerID, modelID: categoryModel.modelID } : undefined, },