Skip to content

fix: AIラッパーの環境変数を隔離して実行ファイルを直接呼び出す - #115

Merged
mjun0812 merged 2 commits into
mainfrom
fix/ai-wrapper-command-resolution
Oct 4, 2026
Merged

mjun0812 merged 2 commits into
mainfrom
fix/ai-wrapper-command-resolution

Conversation

@mjun0812

@mjun0812 mjun0812 commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

概要・背景

Linuxでも claudex が起動できるようにし、プロキシ用の環境変数を呼び出し元のシェルに残さないようにする。従来の env ... command claude は外部の command 実行ファイルを必要とし、それがないLinux環境では env: ‘command’: No such file or directory で失敗していた。

関連Issue

なし

実装方針

claudex と claude-headroom の関数本体をサブシェルにし、その中で環境変数を export する。command \claude でシェル組み込みの command を使い、alias展開と同名のシェル関数を回避してPATH上の実行ファイルを呼び出す。

変更内容

  • プロキシ用の環境変数をサブシェル内に限定
  • Claude・Codex・agyのラッパーで実行ファイル名のalias展開を明示的に回避

影響範囲

AIコマンドのラッパーに適用。既存のモデル指定と起動オプションを維持。

検証結果

変更前の定義でLinuxの起動失敗を再現し、変更後に次のコマンドが成功。

zsh -n config/dot_config/zsh/aliases.zsh
git diff --check

macOSおよび実際のAPI接続の確認は未実施。ShellCheckは実行したが、zsh固有の構文をサポートしていないため診断が発生し、成功とは扱っていない。zsh自身の構文検査とリポジトリ指定のshfmt検査は成功。

- Use subshell exports for claudex and claude-headroom to avoid leaking proxy settings
- Escape AI executable names and bypass shell functions in command wrappers
- Add regression checks for executable resolution, arguments, environment isolation, and exit status
@mjun0812 mjun0812 added the bug Something isn't working label Oct 4, 2026
@mjun0812 mjun0812 self-assigned this Oct 4, 2026
- Keep the pull request limited to AI alias configuration changes
@mjun0812
mjun0812 merged commit b5ae08c into main Oct 4, 2026
11 checks passed
@mjun0812
mjun0812 deleted the fix/ai-wrapper-command-resolution branch October 4, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant