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 existing agent and backup conventions, then add failing coverage before making the smallest implementation change. I’ll also run Prettier and the relevant test/lint/build checks.
- Assistant
rgisn’t installed in this environment, so I’m switching tofind/grep. I’m also checking the current branch and worktree before editing so unrelated changes remain untouched. - Assistant
The existing apply engine already forwards the fifth
backupargument. I’m adding agent-level regression tests covering both values and relative nested output paths; the tests target both instruction and MCP/config writes, since all three affected file types participate in revert bookkeeping. - Assistant
The regression suite now fails at the intended boundary: neither concrete class accepts the interface’s fifth argument yet. I’m updating the signatures and applying the repository’s established
path.resolve→ parent directory →backupFile→ write sequence. - Assistant
The targeted tests pass, including real filesystem verification for Crush and call-level verification for OpenCode. I’m formatting the touched files now, then I’ll run the full local CI sequence and inspect the final diff for accidental changes.
- Assistant
The offline clean install and its build succeeded with no vulnerabilities. Lint, the full coverage suite, and a separate build are running concurrently; I’ll address any failures rather than narrowing verification to the new tests.
- Assistant
Lint passed. The full suite is still finishing, but it has exposed two pre-existing environment-sensitive failures outside this change: one depends on a mocked global config path (
/rootvs/workspace), and one filesystem-error mock did not trigger. I’m letting the run complete, then I’ll rerun to distinguish deterministic failures from cross-test/environment interference. - Assistant
The relevant code is complete, but I’m adding one CLI-level regression pair as well. This verifies the actual
apply/--no-backuppath for OpenCode and Crush together, including their instruction and config files—not just direct class calls.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- fable-5Compare side by side →
- fable-5Compare side by side →