Files
oh-my-opencode/src/tools/call-omo-agent/subagent-session-creator.test.ts
T
YeonGyu-Kim b0c570e054 fix(subagent): remove permission.question=deny override that caused zombie sessions
Child session creation was injecting permission: { question: 'deny' } which
conflicted with OpenCode's child session permission handling, causing subagent
sessions to hang with 0 messages after creation (zombie state).

Remove the permission override from all session creators (BackgroundManager,
sync-session-creator, call-omo-agent) and rely on prompt-level tool restrictions
(tools.question=false) to maintain the intended policy.

Closes #1711
2026-02-11 13:52:20 +09:00

48 lines
1.3 KiB
TypeScript

import { describe, expect, test } from "bun:test"
import { resolveOrCreateSessionId } from "./subagent-session-creator"
import { _resetForTesting, subagentSessions } from "../../features/claude-code-session-state"
describe("call-omo-agent resolveOrCreateSessionId", () => {
test("tracks newly created child session as subagent session", async () => {
// given
_resetForTesting()
const createCalls: Array<unknown> = []
const ctx = {
directory: "/project",
client: {
session: {
get: async () => ({ data: { directory: "/parent" } }),
create: async (args: unknown) => {
createCalls.push(args)
return { data: { id: "ses_child_sync" } }
},
},
},
}
const args = {
description: "sync test",
prompt: "hello",
subagent_type: "explore",
run_in_background: false,
}
const toolContext = {
sessionID: "ses_parent",
messageID: "msg_parent",
agent: "sisyphus",
abort: new AbortController().signal,
}
// when
const result = await resolveOrCreateSessionId(ctx as any, args as any, toolContext as any)
// then
expect(result).toEqual({ ok: true, sessionID: "ses_child_sync" })
expect(createCalls).toHaveLength(1)
expect(subagentSessions.has("ses_child_sync")).toBe(true)
})
})