Skip to content

Fix agent apply patching gem homes Bundler never loads (#2313) - #2402

Draft
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
mainfrom
agent/fix-gem-apply-unused-system-homes
Draft

Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
mainfrom
agent/fix-gem-apply-unused-system-homes

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-fable-5-2

Fixes #2313

Root cause

Agent apply takes its gem write targets from the crawler's gem paths. Those keep every gem env home whenever the default vendor/bundle root holds no store, so that default gems (which only live there) can be patched. Nothing then limits the copies found in those homes to default gems. Under an explicit or deployment Bundler path, Bundler never loads a non-default gem from a gem env home, so apply writes a copy that belongs to other projects on the machine, and on a fresh clone reports success while the project has no patched gem. The read-only side (vex, apply --check) already applies the right rule.

Blocked: needs a maintainer decision

The behavior #2313 reports is the documented contract ("Copy classes" in CLI_CONTRACT.md: a copy in a gem env fallback home "is patched too when it matches and is writable") and is pinned by tests/apply/in_process_gem_fallback_home.rs (writable_fallback_home_copy_still_patched). The fix inverts that test and rewrites that paragraph, so it waits for a yes or no on the issue. No code is on this branch yet.

Plan (if the answer is yes)

  1. Failing tests: apply under an explicit path with the gems installed, and with nothing installed yet.
  2. Give the forward writer the rule the verifiers use: a copy in a gem env home Bundler does not load from is a write target only when it is a default gem. rollback and remove keep finding such copies, since an earlier release may have patched them.
  3. Update CLI_CONTRACT.md and the Ruby docs.

https://claude.ai/code/session_011f9aePyMvbD6rKimV9v2pL


Generated by Claude Code

Agent apply writes gem copies in gem env homes that Bundler never
loads for a project with an explicit install path. Work in progress
for #2313.

Assisted-by: Claude Code:claude-fable-5-2
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011f9aePyMvbD6rKimV9v2pL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants