Repository navigation
fix(hooks): explain gh asks caused by other commands on the line - #284
Conversation
…d ask Split the ask reason for a gh read: a line that holds another command able to write a file or run a program now says so and tells the caller to run gh as its own Bash call, instead of blaming the working directory's remotes. Keep asking when --repo is literal, because it names no host and gh reads GH_HOST or its configured default host, which such a command may rewrite after the hook reads them. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Review summary: no findings. I read the diff and checked I did not run the test suite myself; I relied on the PR's reported results. |
The guard, not the delegation skill, owns the judgement. Pinning GH_HOST settles the host but not http_unix_socket in gh's configuration, so a literal --repo read still asks beside a command that may rewrite that configuration. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Review summary: no blocking findings. I checked that Only a P3 remains, and I did not post it inline. When the line and the remotes are both at fault, the ask names only the line. After the caller splits the call, they get a second ask about the remotes. That is acceptable, since the first fix is still correct. 🤖 Generated with Claude Code |
🤖 I have created a release *beep* *boop* --- ## [0.6.0](v0.5.1...v0.6.0) (2026-12-01) ### ⚠ BREAKING CHANGES * **settings:** declare the harness protection and the agent GitHub policy ([#286](#286)) ### Features * **delegation:** offer herdr-core terminals as an alternative lane transport ([#281](#281)) ([e0488ef](e0488ef)) * **settings:** declare the harness protection and the agent GitHub policy ([#286](#286)) ([ac335be](ac335be)) ### Bug Fixes * **hooks:** explain gh asks caused by other commands on the line ([#284](#284)) ([16ecae8](16ecae8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: furedea-release[bot] <353651101+furedea-release[bot]@users.noreply.github.com>
概要
gh の読み取りを
git fetchやnix eval,cdなどと 1 行でつなぐと,ガードが「作業ディレクトリのリモートが github.com とは限らない」という理由で確認を求めていた.実際の原因は同じ行の別のコマンドで,理由が原因と合わなかった.Closes #282
変更
gh_policy.py: ask の理由を原因ごとに分けた.同じ行の別のコマンドが原因なら,そう書き,gh を単独の Bash 呼び出しで実行する直し方を示す.リモートが原因の場合の文は変えていない.GH_HOST を固定すれば
--repoの読み取りを許可できるかできない.そのため許可は広げていない.
DefaultHostはGH_HOSTを設定ファイルより先に読み,--repo OWNER/REPOはghrepo.FromFullNameからDefaultHostでホストを補う.GH_HOST=github.comなら,設定ファイルの既定ホストを書き換えてもリダイレクトできない.http_unix_socketがあり,go-gh のクライアントは設定からこれを読んで,ホストに関係なく HTTP 通信(トークンを含む)をローカルの unix socket に送る.環境変数による上書きはない.同じ行のnix evalなどが hook の確認後にこのキーを書けるので,GH_HOSTの固定だけでは通信の宛先を保証できない.GH_CONFIG_DIRを,sandbox の書き込み許可に入れない).ただし hook はユーザーの権限で動くため,書けるかどうかを hook はos.accessで確かめられない.許可に使うには,sandbox の設定をガードが読む仕組みが要るので,この PR の範囲外にした(feat(agent-runtime): build persistent, isolated, provider-neutral agent infrastructure #181 の方向).この判断は
_read_host_problemの docstring と,GH_HOSTを固定した場合も含むテストに残した.テスト
tests/hooks/test_gh_line_asks.py: 3 つの行形で理由が行を原因として示すこと.--repoが literal でも,GH_HOST固定の有無にかかわらず ask になり,gh 単独なら許可されること.test_gh_joined_read_only_lines.py: リモートが原因の理由は行を責めないこと,何も書かないコマンドの隣では許可されること.test_gh_effects.py:cd ../other && gh pr listの期待理由を更新.uv run pytest tests/hooks,ruff check と format は通過.🤖 Generated with Claude Code