Skip to content

fix(worktree): find mise and put its Ruby first in Orca's setup shell (#268) - #269

Merged
plainprogrammer merged 5 commits into
mainfrom
268-orca-setup-system-ruby
Nov 10, 2026
Merged

plainprogrammer merged 5 commits into
mainfrom
268-orca-setup-system-ruby

Conversation

@plainprogrammer

Copy link
Copy Markdown
Owner

Closes #268.

Cause

Two things, both about the environment Orca's setup shell (bash -lc 'eval "${ORCA_SEQUENCED_SETUP_SCRIPT}"') has, which #226's check (from an interactive shell with mise active) never saw:

  1. No mise on the PATH. The Orca app's PATH is /usr/bin:/bin:/usr/sbin:/sbin; a login bash doesn't activate mise. mise exec gives command not found (127), and the post-checkout hook's "no mise, run as is" fallback ran bin/setup on macOS's Ruby 2.6 (the error in Orca worktree setup still runs bin/setup on the system Ruby #268).
  2. mise found, system Ruby still first. In a worker's setup terminal (zsh with mise active, then bash -lc), mise's installs/ruby/4.0.7/bin is in the PATH but behind /usr/bin (macOS path_helper), and mise exec doesn't move a directory already in the PATH. mise exec -- ruby -v said 4.0.7, but mise exec -- sh -c 'command -v ruby' said /usr/bin/ruby, so bin/setup's #!/usr/bin/env ruby and bundle ran on 2.6. Unsetting the __MISE_* variables changed nothing; only the PATH order matters.

Fix

script/worktree/with_mise [--optional] COMMAND… finds mise (PATH, then ~/.local/bin, /opt/homebrew/bin, /usr/local/bin, Linuxbrew, ~/.cargo/bin; COLLECTOR_MISE_SEARCH overrides), drops mise's own installs/* and shims directories from the PATH, and runs mise exec -- COMMAND. No mise is exit 127 with a message; --optional (the hook, for CI runners) runs the command as is. orca.yaml and .githooks/post-checkout use it. Cause recorded in the orca.yaml comment, the script's header, CLAUDE.md's Worktrees fact and docs/lessons/2026-11-09-orca-setup-shell-has-no-mise.md.

Evidence

Before (main, real worker-start worktree; the setup terminal): Could not find 'bundler' (4.0.20) … Ruby.framework/Versions/2.6 … bin/setup:10:in 'system', agent skipped (failedStage=agent_readiness). The first version of the fix (finding mise only) failed identically in that terminal, which is how cause 2 was found.

After (this branch, orca orchestration worker-start --worktree new-top-level --base-branch 268-orca-setup-system-ruby): state ready, setup terminal:

bash -lc 'eval "${ORCA_SEQUENCED_SETUP_SCRIPT:?missing}"'
== Installing dependencies ==
The Gemfile's dependencies are satisfied
== Installing the OCR engine == … == Preparing database == … == Dev server URL: http://localhost:3925 ==

Specs: spec/script/worktree/with_mise_spec.rb (9), spec/githooks/post_checkout_spec.rb, spec/project_config_spec.rb; bin/ci passes at the pushed SHA (pre-push hook).

🤖 Generated with Claude Code

plainprogrammer and others added 5 commits November 9, 2026 18:16
Add script/worktree/with_mise: mise on the PATH, else the usual install
directories; no mise is an error unless --optional.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…mise (#268)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… exec (#268)

A login bash keeps mise's tool directories but behind /usr/bin; mise exec
does not move a directory already in the PATH, so setup ran on Ruby 2.6.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@plainprogrammer plainprogrammer self-assigned this Nov 9, 2026
@plainprogrammer
plainprogrammer merged commit ffcb808 into main Nov 10, 2026
9 checks passed
@plainprogrammer
plainprogrammer deleted the 268-orca-setup-system-ruby branch November 10, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Orca worktree setup still runs bin/setup on the system Ruby

1 participant