GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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 #64624

New issue
Copy link
New issue
Copy link
Closed
#64626
Closed
permission: file rules are case-sensitive on macOS, whose default file system is not#64624
#64626
Copy link
Labels
area/coreAgent loop, tools and configplatform/macosmacOSseverity:highstatus/repro-simulatedReproduced with a simulated model or mocktype/bugSomething is brokenversion/v2OpenCode 2.x

Description

@knp-sap
knp-sap
opened on Nov 18, 2026
Issue body actions

Description

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

  1. On macOS, in a project with a .opencode directory, add the rule { "action": "edit", "resource": ".opencode/*", "effect": "ask" }.
  2. Ask the agent to write .opencode/plugins/example.ts. OpenCode asks for permission.
  3. 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

Activity

  1. opencodejr
    added
    area/coreAgent loop, tools and config
    platform/macosmacOS
    type/bugSomething is broken
    version/v2OpenCode 2.x
    on Nov 18, 2026
  2. opencodejr commented on Nov 18, 2026

    @opencodejr
    opencodejrBot
    on Nov 18, 2026
    Contributor
    More actions

    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:

    1. Adding .opencode/plugins/lower.ts showed "Permission required → Edit .opencode/plugins/lower.ts".
    2. Adding .OPENCODE/plugins/upper.ts went through with no prompt.
    3. 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

    Screenshot

    Screenshot

    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.

  3. opencodejr
    added
    severity:high
    status/repro-simulatedReproduced with a simulated model or mock
    on Nov 18, 2026
  4. neriousy
    closed this as completedin #64626on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreAgent loop, tools and configplatform/macosmacOSseverity:highstatus/repro-simulatedReproduced with a simulated model or mocktype/bugSomething is brokenversion/v2OpenCode 2.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.