GeezerVison is showing github.com — permission: file rules are case-sensitive on macOS, whose default file system is not · Issue #64624 · anomalyco/opencode
permission: file rules are case-sensitive on macOS, whose default file system is not #64624DescriptionDescription
Permission rules match paths with case only ignored on Windows (Wildcard.match). macOS volumes ignore case by default, so a path written in a different case opens the same file but does not match a rule for it.
For example, with { "action": "edit", "resource": ".opencode/*", "effect": "ask" }, an edit to .OPENCODE/plugins/example.ts is allowed without asking, and the file lands in the .opencode/plugins directory that OpenCode loads plugins from. A read deny rule for *.env is bypassed by reading secrets.ENV.
Plugins
None needed to reproduce.
OpenCode version
2.3.0, and current dev
Steps to reproduce
- On macOS, in a project with a
.opencode directory, add the rule { "action": "edit", "resource": ".opencode/*", "effect": "ask" }.
- Ask the agent to write
.opencode/plugins/example.ts. OpenCode asks for permission.
- Ask the agent to write
.OPENCODE/plugins/example.ts. OpenCode writes it without asking, and it appears as .opencode/plugins/example.ts.
Operating System
macOS 27.2.1 Activityopencodejr commented on Nov 18, 2026 Seen with a simulated model or a mock server, not a real provider; a maintainer should confirm.
Thanks for the detailed report. I reproduced this on 2.3.0 and on the latest release, 2.3.2.
There was no macOS machine here, so I put the project on a case-insensitive vfat file system on Linux. vfat ignores case like default APFS, and the permission matching runs the same way on macOS and Linux. The tool calls came from opencode-drive's simulated model.
With { "action": "edit", "resource": ".opencode/*", "effect": "ask" } after an allow-all rule:
- Adding
.opencode/plugins/lower.ts showed "Permission required → Edit .opencode/plugins/lower.ts".
- Adding
.OPENCODE/plugins/upper.ts went through with no prompt.
ls -la .opencode/plugins then listed both files, and OpenCode tried to load .opencode/plugins/upper.ts as a plugin (the "2 plugins failed" toast).
The screenshots and recording below show this, and the script below reproduces it. The simulated model is given patch rather than write, so the script uses patches.
I couldn't run the latest dev from source in this setup. The path-matching code in packages/core/src/util/wildcard.ts is unchanged on dev (2237765), and still ignores case only when the platform is win32.
Your PR, #64626, is open for this.
recording.mp4


Reproduction script (drive.ts)
// Reproduces anomalyco/opencode#64624: an `edit` ask rule for `.opencode/*`
// prompts for `.opencode/plugins/lower.ts` but not for `.OPENCODE/plugins/upper.ts`,
// which on a case-insensitive file system lands in `.opencode/plugins`.
// Every tool result the model receives is printed as TOOL_RESULT.
//
// macOS is not available here, so the drive artifacts (project included) are
// put on a vfat loop mount, which is case-insensitive like default APFS:
// truncate -s 200M /tmp/ci.img && mkfs.vfat /tmp/ci.img
// mkdir -p /tmp/ocd/opencode-drive && mount -o loop /tmp/ci.img /tmp/ocd/opencode-drive
// TMPDIR=/tmp/ocd opencode-drive run drive.ts
import { Effect, Stream } from "effect"
import { Llm, OpenCodeDriver } from "opencode-drive"
const add = (path: string) => `*** Begin Patch\n*** Add File: ${path}\n+export default {}\n*** End Patch`
const lastUser = (body: any): string => {
const msgs: any[] = body?.messages ?? []
const last = msgs[msgs.length - 1]
if (last?.role === "tool") {
console.log("TOOL_RESULT", JSON.stringify(last.content))
return "TOOL_RESULT"
}
const u = [...msgs].reverse().find((m) => m.role === "user")
return typeof u?.content === "string" ? u.content : JSON.stringify(u?.content ?? "")
}
export default OpenCodeDriver.use(
{
...(process.env.OC_DEV ? { opencode: { dev: process.env.OC_DEV } } : {}),
tui: { recording: true },
config: {
permissions: [
{ action: "*", resource: "*", effect: "allow" },
{ action: "edit", resource: ".opencode/*", effect: "ask" },
],
},
},
({ ui, llm }) =>
Effect.gen(function* () {
yield* llm.serve((req: any) => {
const body = req.body
const system = JSON.stringify(body?.messages?.[0]?.content ?? "")
if (system.includes("You name conversations")) return Stream.make(Llm.text("Case test"))
if (process.env.DEBUG_TOOLS) console.log("TOOLS", (body?.tools ?? []).map((t: any) => t.function?.name ?? t.name).join(","))
const text = lastUser(body)
const call = (id: string, name: string, input: any) =>
Stream.make(Llm.toolCall({ index: 0, id, name, input }), Llm.finish("tool-calls"))
if (text === "TOOL_RESULT") return Stream.make(Llm.text("Step finished."))
if (text.includes("STEP1"))
return call("call_lower", "patch", { patchText: add(".opencode/plugins/lower.ts") })
if (text.includes("STEP2"))
return call("call_upper", "patch", { patchText: add(".OPENCODE/plugins/upper.ts") })
return call("call_ls", "shell", { command: "ls -la .opencode/plugins" })
})
// 1. Lower-case path: the ask rule matches, so OpenCode asks.
yield* ui.submit("STEP1 write .opencode/plugins/lower.ts")
yield* ui.waitFor("Allow once", { timeout: 20000 })
yield* ui.screenshot("1-lower-case-asks")
yield* ui.enter()
yield* Effect.sleep(3000)
// 2. Upper-case path: same directory on a case-insensitive FS, no prompt.
yield* ui.submit("STEP2 write .OPENCODE/plugins/upper.ts")
yield* Effect.sleep(4000)
yield* ui.screenshot("2-upper-case-no-prompt")
// 3. Show where the file landed.
yield* ui.submit("STEP3 list .opencode/plugins")
yield* Effect.sleep(4000)
yield* ui.screenshot("3-listing")
}),
)
Run it with opencode-drive: opencode-drive run ./drive.ts. It drives opencode from your PATH; set OC_DEV to the path of an OpenCode checkout to run that from source instead.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|