fix: run from directories without a local .cupcake policies folder (#104)#107
fix: run from directories without a local .cupcake policies folder (#104)#107punk-dev-robot wants to merge 3 commits into
Conversation
A missing project .cupcake/policies/<harness> dir made eval exit 1, blocking every tool call. The project scan errored on a missing dir while the global scan guards with .exists(); mirror that guard so eval proceeds with global policies. Scanner stays strict. Adds a regression test.
init --global emitted --policy-dir <global config root>, but eval treats it as the project root and mis-resolved it, so local policies were never read (and pre-fix the bogus path exited 1). The global config auto-discovers independently, so global hooks now use the same project-relative path as project hooks. Existing global installs must re-run init --global.
b487aa9 to
7d81ab9
Compare
Engine::new tolerates a missing project .cupcake/policies dir as of the eqtylab#104 fix, initializing with global policies only. The binding smoke test asserted is_err() on a bogus path; that path now yields Ok. Flip the assertion to is_ok() to match the intended post-eqtylab#104 behavior.
|
Confirming this reproduces on Claude Code with a global setup, not just OpenCode (matching @ahokinson on #104). Symptom: after We independently root-caused and fixed this the same way you did here — mirroring the
Also +1 on the CLI half — This PR supersedes a local fix we'd staged, so we've dropped ours in favor of it. Thanks for getting to it. 🎂 |
Summary
Running a harness from a directory without a local
.cupcake/policies/<harness>folder exited eval with code 1, blocking every tool call (#104). Two related causes:.exists(). Mirror that guard so a missing project dir yields no policies and eval proceeds on global policies. Scanner stays strict (validate/inspect).init --globalemitted--policy-dir <global config root>, but eval treats--policy-diras the project root and mis-resolved it, so local policies were never read (and pre-fix the bogus path exited 1). The global config auto-discovers independently, so global hooks now use the same project-relative path as project hooks ($CLAUDE_PROJECT_DIR/.cupcake, etc.).Regression test added; cli + opencode/scanner/global suites pass.