Respect backups for OpenCode and Crush generated files Review run finding. OpenCode and…
- User
Respect backups for OpenCode and Crush generated files Review run finding.
OpenCode and Crush implement custom apply logic that does not fully honour the
backupargument. Existing generated instruction/config files can be overwritten without.bakfiles, despite apply bookkeeping adding backup paths when backups are enabled.Impact: user-owned
AGENTS.md,CRUSH.md, or.crush.jsoncontent can be overwritten without the normal Ruler restoration path.Evidence:
src/agents/OpenCodeAgent.tsomits the backup parameter for instructions writes.src/agents/CrushAgent.tswritesCRUSH.mdand.crush.jsondirectly.
Expected fix:
- Accept
backup = truein these agent implementations. - Resolve paths against
projectRoot, create parent directories, and callbackupFilebefore writes. - Add tests for backup enabled/disabled behaviour.
Interface
No new interfaces are introduced.
- Assistant
I’ll trace the agent apply paths and existing backup conventions, then add failing coverage before the minimal implementation change. I’ll also check the current branch/worktree before deciding whether branch creation is safe.
- Assistant
The worktree is clean but checked out at a detached HEAD, so I’m creating a scoped feature branch as required.
rgis unavailable here; I’ll usefind/grepfor repository inspection. - Assistant
The defect is broader than a single instruction write: both adapters directly write their instruction and MCP files. I’m adding filesystem-level tests that exercise both generated files with backups on and off, using nested relative custom paths so path resolution and parent-directory creation are covered too.
- Assistant
The new regression suite failed on the original code and now passes for both adapters. The implementation now resolves custom paths from the project root, creates both parent directories, and conditionally backs up each file immediately before it is written. Next I’m running formatting and the full CI-equivalent checks.
- Assistant
Formatting, clean install, lint, and build all pass. The full coverage suite is running now; once it completes I’ll inspect the final diff for any unintended changes and report the exact verification status.
- Assistant
The full suite completed with 1,036 passing and two unrelated environment-sensitive failures: a permission-denial test runs as root (so chmod does not deny access), and a global-config test expects
/rootwhile its mocked environment resolves/workspace. I’m rerunning those suites independently to distinguish persistent harness assumptions from cross-suite leakage; the changed-agent suites remain green.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.