Skip to content

[Bug]: Can't run Opencode from a directory without a local .cupcake/policies/opencode folder #104

@bcbernardo

Description

@bcbernardo

Bug Description

If I execute Opencode (v1.3.0) from any directory that does not contain a local .cupcake/policies/opencode folder, agents cannot use any tool, as Cupcake fails with exit code 1.

Steps to Reproduce

  1. Configure Cupcake as described in the official documentation
  2. Run;
~$ mkdir temp && cd temp
~/temp$ echo "Hi!" > greet.txt
~/temp$ opencode run "Read the contents of the './greet.txt' file"
> Sisyphus (Ultraworker) · big-pickle

✗ read failed
Error: Cupcake exited with code 1

The file `greet.txt` doesn't exist in `/home/bcbernardo/temp/`. Let me check what's in the directory:

✗ read failed
Error: Cupcake exited with code 1
✗ bash failed
Error: Cupcake exited with code 1

The file `./greet.txt` does not exist in the current working directory (`*******/temp/`). 

The directory appears to be empty or inaccessible. Would you like me to:
1. Create the file for you?
2. Search for `greet.txt` elsewhere on the system?

For comparison, it will work if you create an empty local policy folder:

~/temp$ mkdir .cupcake && mkdir .cupcake/policies && mkdir .cupcake/policies/opencode
~/temp$ opencode run "Read the contents of the './greet.txt' file"

> Sisyphus (Ultraworker) · big-pickle

→ Read greet.txt

The file contains:

'''
Hi!
'''

Expected Behavior

If no local policies directory exist, Cupcake should run normally, using only the available global policies.

Alternatively, it could auto-create a local policies folder within the current project - although I like this option less, as it forces me to add these folders to manually add these folders to .gitignore files and just clutters the file system.

Actual Behavior

Every attempt from an agent to run any tool fails with an exit code 1 from Cupcake.

Harness

OpenCode

Cupcake Version

1.3.0

Operating System

Linux

OS Version

Fedora Linux 42 (Workstation Edition)

Cupcake Configuration

Not relevant.

Relevant Logs

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssues that need to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions