b0c570e054
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
28 lines
829 B
TypeScript
28 lines
829 B
TypeScript
import type { PluginInput } from "@opencode-ai/plugin"
|
|
import { log, getAgentToolRestrictions } from "../../shared"
|
|
|
|
export async function promptSubagentSession(
|
|
ctx: PluginInput,
|
|
options: { sessionID: string; agent: string; prompt: string },
|
|
): Promise<{ ok: true } | { ok: false; error: string }> {
|
|
try {
|
|
await ctx.client.session.promptAsync({
|
|
path: { id: options.sessionID },
|
|
body: {
|
|
agent: options.agent,
|
|
tools: {
|
|
...getAgentToolRestrictions(options.agent),
|
|
task: false,
|
|
question: false,
|
|
},
|
|
parts: [{ type: "text", text: options.prompt }],
|
|
},
|
|
})
|
|
return { ok: true }
|
|
} catch (error) {
|
|
const errorMessage = error instanceof Error ? error.message : String(error)
|
|
log("[call_omo_agent] Prompt error", { error: errorMessage })
|
|
return { ok: false, error: errorMessage }
|
|
}
|
|
}
|