Skip to content
Closed
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
12 changes: 12 additions & 0 deletions packages/opencode/src/agent/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,18 @@ export namespace Agent {
external_directory: {
[path.join(Global.Path.data, "plans", "*")]: "allow",
},
apply_patch: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: These new apply_patch/write rules do not enforce the plan-mode restriction.

WriteTool and ApplyPatchTool both call ctx.ask({ permission: "edit", ... }), so the path check still comes from the existing edit rules. PermissionNext.disabled() also maps write to edit, but not apply_patch, which means this block leaves apply_patch exposed to the model while not changing the runtime restriction. The fix likely needs to reuse the edit permission for apply_patch tool gating instead of adding separate apply_patch/write entries here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. Well then this patch isn't needed.

"*": "deny",
[path.join(".kilo", "plans", "*.md")]: "allow", // kilocode_change
[path.join(".opencode", "plans", "*.md")]: "allow", // kilocode_change: .opencode fallback
[path.relative(Instance.worktree, path.join(Global.Path.data, path.join("plans", "*.md")))]: "allow",
},
write: {
"*": "deny",
[path.join(".kilo", "plans", "*.md")]: "allow", // kilocode_change
[path.join(".opencode", "plans", "*.md")]: "allow", // kilocode_change: .opencode fallback
[path.relative(Instance.worktree, path.join(Global.Path.data, path.join("plans", "*.md")))]: "allow",
},
edit: {
"*": "deny",
[path.join(".kilo", "plans", "*.md")]: "allow", // kilocode_change
Expand Down
Loading