fix(opencode): preserve external_dir and deny parent permissions in task child sessions (#23290)

This commit is contained in:
Tommy D. Rossi 2026-04-30 05:06:29 +02:00 committed by GitHub
parent c49bf0b402
commit d7701dbfb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -64,12 +64,16 @@ export const TaskTool = Tool.define(
const session = taskID
? yield* sessions.get(SessionID.make(taskID)).pipe(Effect.catchCause(() => Effect.succeed(undefined)))
: undefined
const parent = yield* sessions.get(ctx.sessionID)
const nextSession =
session ??
(yield* sessions.create({
parentID: ctx.sessionID,
title: params.description + ` (@${next.name} subagent)`,
permission: [
...(parent.permission ?? []).filter(
(rule) => rule.permission === "external_directory" || rule.action === "deny",
),
...(canTodo
? []
: [