Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/opencode/src/cli/cmd/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ export const RunCommand = cmd({

if (event.type === "permission.asked") {
const permission = event.properties
if (permission.sessionID !== sessionID) continue
UI.println(
UI.Style.TEXT_WARNING_BOLD + "!",
UI.Style.TEXT_NORMAL +
Expand Down
5 changes: 3 additions & 2 deletions packages/opencode/src/session/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ export namespace SessionPrompt {
})
}
if (permissions.length > 0) {
session.permission = permissions
await Session.setPermission({ sessionID: session.id, permission: permissions })
const merged = PermissionNext.merge(session.permission ?? [], permissions)
session.permission = merged
await Session.setPermission({ sessionID: session.id, permission: merged })
}

if (input.noReply === true) {
Expand Down
4 changes: 4 additions & 0 deletions packages/opencode/src/tool/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export const TaskTool = Tool.define("task", async (ctx) => {

const hasTaskPermission = agent.permission.some((rule) => rule.permission === "task")

const parent = await Session.get(ctx.sessionID).catch(() => undefined)
const inherited = (parent?.permission ?? []).filter((r) => r.action === "deny")

const session = await iife(async () => {
if (params.task_id) {
const found = await Session.get(params.task_id).catch(() => {})
Expand All @@ -73,6 +76,7 @@ export const TaskTool = Tool.define("task", async (ctx) => {
parentID: ctx.sessionID,
title: params.description + ` (@${agent.name} subagent)`,
permission: [
...inherited,
{
permission: "todowrite",
pattern: "*",
Expand Down
Loading