fix(zsh): codex を fnox exec ラッパーで起動しキーを注入#57
Closed
k35o wants to merge 1 commit into
Closed
Conversation
codex は Sakana プロバイダの SAKANA_API_KEY を環境変数から読むが、秘密は fnox 管理で シェルに常駐していない(fnox-activate は手動関数で自動実行されない / CLAUDE.md 方針)。 そのため素の codex は `Missing environment variable: SAKANA_API_KEY` で起動できなかった。 codex() ラッパーで `fnox exec -- codex` 経由にし、codex プロセスにだけ都度注入する。 新シェルで `codex exec` が PONG を返す(Missing エラー無し)ことを確認済み。
Owner
Author
|
auto-load(fnox export 起動時注入)方式に置き換えるためクローズ。codex ラッパーは不要に。 |
k35o
added a commit
that referenced
this pull request
Jun 22, 2026
秘密を2段 tier に分け、日常の API キーは自動ロード/機密は守る両立にする。 - fnox: K35O_BOT_*(GitHub App 秘密鍵=tier2) を [secrets] → [profiles.bot.secrets] に分離。 default の exec/export には載らず `fnox exec -P bot` で取得。SAKANA 等の API キー(tier1)は [secrets] のまま。 - zsh: aliases.zsh をテンプレ化し、個人機の対話シェル(CLAUDECODE 以外)で tier1 を `eval "$(fnox export -f env)"` で自動ロード。素の codex 等が鍵を読める。 新しい API キーは [secrets] に足すだけで自動で載る。 - new-project スキル: bot secret 投入を `fnox exec -P bot` に。 - CLAUDE.md: tier 運用を記載。 旧 codex ラッパー(PR #57)はこれに置換しクローズ済み。 実機検証: 対話=SAKANA載る/bot載らない・エージェント=載らない・-P bot=bot取得可・codex doctor auth ✓。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
素の
codexがMissing environment variable:SAKANA_API_KEY`` で起動できなかったのを修正。原因
env_key = SAKANA_API_KEYを環境変数から読む。~/.zshrcはfnox-activateを自動実行せず、関数定義のみ。CLAUDE.md も「秘密は常駐させずfnox exec -- <command>で実行」と明記)。codex()ラッパーを削除したのが誤りだった(activate は手動で、新ターミナルでは効いていない)。対処
dot_config/zsh/aliases.zshにcodex()ラッパーを復活:fnox は PATH 上の実体を exec するため再帰しない。CLAUDE.md の
fnox exec方針に沿う。テスト
新シェル相当(
zsh -c 'source aliases.zsh; codex exec …')で PONG 応答・Missing エラー無しを確認。CI shellcheck は*.shのみ対象で.zshは不問。