Repository navigation
fix: make the Gemini adapters work against a real Gemini CLI - #89
Open
matheusPavaneli wants to merge 2 commits into
Open
matheusPavaneli wants to merge 2 commits into
matheusPavaneli wants to merge 2 commits into
Conversation
Running WB-61's Gemini adapters against Gemini CLI 0.61.0 found four things the unit tests could not (WB-62): - Gemini runs Windows hooks through PowerShell, where a quoted program is a string, so the command wb hooks install wrote never ran and every edit went through. It now carries the & call operator. - wb run --agent gemini exited 55 in a folder Gemini had not trusted, and untrusted Gemini ignores project hooks. Sessions now run with GEMINI_CLI_TRUST_WORKSPACE=true. - Headless Gemini refuses any tool that would ask, and auto_edit leaves the shell asking, so a session could never run wb. A policy file allows the session's wb invocation and nothing else, rather than yolo. - npm installs gemini and codex as .cmd shims on Windows, and cmd.exe cuts an argument at its first newline. Both now get the prompt on stdin. The Gemini report also carries the session_id it prints.
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.
What
WB-61's Gemini support, run against Gemini CLI 0.61.0, did not work: the hook never ran on Windows and
wb run --agent geminicould not start or runwb. This fixes all four causes found.Why
WB-62. Unit tests matched Gemini's documented formats. The live session showed what the docs leave out.
How
"python.exe" "wb_hook.py"is a string, not a command.wb hooks install gemininow writes& "python.exe" ...on Windows.GEMINI_CLI_TRUST_WORKSPACE=true.auto_editleaves the shell asking. A policy file (.workflow/gemini-policy.toml) allowsrun_shell_commandonly for the session'spython "<wb.py>". Gemini checks each command of a chain separately.yolowas rejected because it allows everything.geminiandcodexas.cmdshims on Windows, and cmd.exe cuts an argument at the first newline. The multi-line prompt now goes on stdin (codex exec -, Gemini with a one-line-p). Claude Code and Cursor keep an empty stdin.Verification
wb impl verify WB-62, verdict pass:python -m unittest discover -s tests -q: exit 0python -m ruff check lib: exit 0python -m mypy: exit 0The new tests were run by hand against the previous commit in a scratch worktree, and every one failed there.
wb impl verify --regressionwas not run: it needs the owner's approval to run plan commands.Live, on Gemini CLI 0.61.0 with an API key:
replace,tool_input.file_path,cwd,stop_hook_active.wbcommand under the generated policy..cmdshim as an argument, and correct on stdin.Risk and rollback
No critical zone touched. Rollback: revert the commit. Gemini goes back to the WB-61 behaviour. No data or config to migrate.
Open questions
wb run --agent geminidid not finish. The free-tier quota (20 requests per model per day) ran out mid-test, so each fix was confirmed on its own.codex exec -) is documented but has not been run live..cmdshim, or runs hooks through PowerShell, is unknown.