Skip to content

fix(esa): keep user zsh startup files out of esa bats tests - #250

Merged
furedea merged 2 commits into
mainfrom
fix/esa-bats-sandbox-hang
Oct 21, 2026
Merged

furedea merged 2 commits into
mainfrom
fix/esa-bats-sandbox-hang

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

概要

tests/esa/zsh.bats が agent sandbox 内で test 11 以降に進まず,Stop hook の検証が毎ターン 300 秒でタイムアウトしていた問題を修正する.

Closes #244

原因

  • 止まっていたのは test 11「opening a numbered esa post fetches its body through the official CLI」(_esa_edit を呼ぶ最初のテスト).Hook の記録でも ok 10 の直後で停止していた.
  • テストは zsh -c で起動しており,zsh が ~/.zshenv を読む.この .zshenv は EDITOR=nvim / VISUAL=nvim を強制し,PATH も前置するため,テストの editor スタブが上書きされていた.
  • その結果,esa.py は実体の Neovim を tty なしで起動し,Neovim は入力を待ち続けた.lsof で,python の stdout パイプを共有する nvim プロセスが worktree を cwd として残っていることを確認した.sandbox がサーバソケット作成を拒否した記録(server_start: Failed to start server: operation not permitted)も cwd の nvim.log に残っていた.
  • CI には ~/.zshenv が無いためスタブが使われ,通過していた.

変更

  • tests/esa/zsh.bats の zsh -c をすべて zsh -f -c に変更し,ユーザの起動ファイルを読まずにスタブだけを使うようにした.テストの内容と件数は変えていない.
  • テスト中の headless Neovim は sandbox で state ディレクトリに書けないとき cwd に nvim.log を作るため,リポジトリ直下の /nvim.log を .gitignore に追加した.

確認

  • bats tests/esa/zsh.bats(sandbox 内): 21 件すべて成功,約 5 秒
  • bats tests/ --recursive(sandbox 内,stdin は開いたままのパイプ): 64 秒で完走しハングなし.失敗した 13 件は tests/ssh-agent/sign_ssh.bats,tests/zsh/ssh_agent.bats の Unix ソケット bind 拒否と tests/nvim/lspmux.bats の ~/.local/state/nvim/lsp.log 書き込み拒否で,いずれも sandbox の制限により即時失敗するもので今回の変更とは無関係
  • uv run --frozen pytest: 1877 件成功

🤖 Generated with Claude Code

furedea and others added 2 commits October 21, 2026 11:22
zsh -c read ~/.zshenv, which exports EDITOR=nvim and prepends PATH, so the
editor-opening tests launched the real Neovim instead of the editor stub.
Without a terminal Neovim waited forever, hanging zsh.bats at test 11 in the
agent sandbox while CI, which has no such .zshenv, passed. Run zsh -f so the
tests only see their stubs.

Closes #244

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Headless Neovim in the bats suite writes nvim.log to the working directory
when the agent sandbox denies its server socket and state directory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@furedea
furedea merged commit 9ffcb0d into main Oct 21, 2026
11 checks passed
@furedea
furedea deleted the fix/esa-bats-sandbox-hang branch October 21, 2026 02:30
furedea added a commit that referenced this pull request Nov 13, 2026
…466)

agent-config を v0.1.4,agent-harness を v0.9.14 に更新し,コマンド承認の削減と Pi・Codex
の秘密パス関連の修正を取り込む.

| 入力 | 変更前 | 変更後 |
| --- | --- | --- |
| agent-config | `9e2843c`(v0.1.3) | `2ab23eb`(v0.1.4) |
| agent-harness | `b365277`(v0.9.13) | `83caaa9`(v0.9.14) |

| 主な変更 | 中身 |
| --- | --- |
| furedea/agent-config#187 | `&&` でつないだコマンドや,jq・head などで絞り込むパイプ付きの
gh・herdr コマンドを,1 つずつ判定して承認なしで通す |
| furedea/agent-config#188 | furedea リポジトリのレビュー返信と,変更を伴わない GraphQL
クエリを許可する |
| furedea/agent-harness#239, #245 | Pi の srt の denyRead
に秘密パスのポリシーを適用する.リポジトリルート基準で解決し,曖昧なパターンは拒否する |
| furedea/agent-harness#240, #244 | Codex のガード対象パス判定の端のケースと UNC
のプロジェクトルートを修正する |
| furedea/agent-harness#238, #247, #248, #250 |
プロバイダ登録表からの導出,エラーメッセージの改善,テストコードへの clippy 適用 |

## 検証

- [x] `nix build .#darwinConfigurations.mba.system --no-link` が成功

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

tests/esa/zsh.bats が sandbox の中で止まり,Stop の検証が毎回時間切れになる

1 participant