Skip to content

fix(eval): make the gh stand-in answer argv calls on Windows - #4458

Merged
kovtcharov-amd merged 1 commit into
amd:mainfrom
kovtcharov:kalin/ghstub-exe-launcher
Sep 29, 2026
Merged

kovtcharov-amd merged 1 commit into
amd:mainfrom
kovtcharov:kalin/ghstub-exe-launcher

Conversation

@kovtcharov

Copy link
Copy Markdown
Contributor

On Windows, GitHub benchmark tasks were answered by the real, logged-out GitHub CLI instead of the offline stand-in. gh issue list failed with "run gh auth login", and every GitHub task (triage, labels, duplicates…) scored the harness rather than the model. The stand-in now also installs a gh.exe, so the agent's gh calls reach the fixture repos. That covers both the agent and the task probes.

Closes #4427

🔍 Technical details
  • The flagship runs a skill-granted CLI as argv (use_shell=False). CreateProcess resolves a bare gh to gh.exe only, so the existing gh (sh) and gh.cmd launchers were skipped.
  • gh.exe uses distlib's console-script format, taken from ScriptMaker._write_script: the t64/t64-arm/t32 launcher bytes, then #!<python> -I\n, then a zip whose __main__.py runs ghstub.py via runpy.
  • The launcher template comes from pip._vendor.distlib, or from the pip wheel in ensurepip/_bundled when the environment has no pip. uv venvs, including the repo's .venv, have no pip. If neither source has it, install() raises and says to install pip. It never falls back to writing only .cmd.
  • A bare-name lookup searches the parent's PATH, not the child's env=. So the new test puts the shim on this process's PATH, which matches the agent process the harness launches.

Test plan

  • pytest tests/unit/eval on Windows: 1025 passed, 27 skipped. The new test_bench_ghstub_windows.py fails without the fix, because real gh answers --version.
  • python util/lint.py --all: black, isort and flake8 pass. The 2 pylint errors are pre-existing Windows false positives in untouched files (os.getuid, signal.SIGKILL).
  • gaia eval tasks run --suite everyday --tasks b3-triage --model fireworks.deepseek-v4p1-flash --no-judge: the transcript shows gh issue list --repo kovtcharov/toybox returning fixture issues 5→1 and gh issue view serving their bodies.
  • On Windows, a --suite everyday run where b6-github-labels' probe (gh issue view … --json labels) passes rather than hitting real gh.

GitHub benchmark tasks on Windows were served by the real, logged-out GitHub
CLI instead of the offline stand-in. The flagship runs a skill-granted CLI as
argv, and CreateProcess resolves a bare `gh` to `gh.exe` only, so the `gh` and
`gh.cmd` launchers were never found.

The stub now also writes a `gh.exe`: distlib's console launcher (from pip, or
the pip wheel ensurepip bundles when the venv has no pip, as uv venvs don't)
with a `-I` shebang and a zip that runs ghstub. A missing launcher template is
an error, not a silent `.cmd`-only install.

Closes amd#4427
@github-actions github-actions Bot added eval Evaluation framework changes tests Test changes performance Performance-critical changes labels Sep 29, 2026
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 29, 2026
Merged via the queue into amd:main with commit a4659a4 Sep 29, 2026
27 of 31 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the kalin/ghstub-exe-launcher branch September 29, 2026 16:04
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Oct 4, 2026
…he runner's (amd#4636)

The gaia_shell GitHub scenarios on the nightly eval were measuring the
runner's own gh install, not the agent. Nothing put the staged fake `gh`
on PATH, and on Windows a `.cmd` shim can't win an argv call anyway. So
every github-triage scenario ran the real, signed-out GitHub CLI: reads
came back "unauthenticated", the refusal probes were scored on a sign-in
prompt, and auto-approved write commands were aimed at the real CLI.
Staging now builds a `gh.exe` launcher for the fake on Windows, and both
gaia_* eval workflows put it first on the backend's PATH.

Evidence from run 37110051697 (gaia-tools lane):
- `shell_allow_gh_list` (FAIL 5.1): "check_cli_setup … reported
unauthenticated, then blocked asking for auth instead of running … gh
issue list". The backend log shows `CLI setup check: gh is
unauthenticated`, but the fake gh reports a signed-in `fixture-bot`.
- `shell_refuse_auth_token` (FAIL 5.9): the agent "held position … for
the wrong reason (auth state, not security policy)". The scenario never
reached the refusal it is meant to test.
- `shell_refuse_escalation` (FAIL 6.5): the backend log shows real gh's
`Usage: gh issue edit …` output. The fake gh fails loudly on `issue
edit`, so this output could only come from the real CLI.

<details>
<summary>🔍 Technical details</summary>

- The scenarios' `setup.notes` say "Fake gh shim on PATH", but only
`util/launch-tui-eval.ps1` actually did that. Neither
`eval_flagship.yml` nor `test_gaia_agent_eval.yml` did.
- amd#4458 already fixed the same Windows resolution problem for the bench
stand-in (`ghstub._exe_launcher`, distlib's console launcher).
`stage_eval_env.install_fake_gh` reuses that launcher. It writes
`gh`/`gh.cmd`/`gh.exe` into `<home>/.gaia-eval-bin`, and they run the
checkout's `fake_gh/gh.py`, so the canned issue data stays outside the
staged `gaia-eval` folder that a scenario can give the agent access to.
- `gaia_scorecard_refresh.yml` does not stage the gaia_* fixtures, so it
is unchanged.
- Left for a follow-up: the `local_blocked_win_shim` tag still excludes
`shell_confirm_surfaces_command` and `task_ghtriage_fixture_triage` on
CI. They can be re-enabled once a run confirms the fake gh answers.
- Pairs with amd#4633 (the fake gh answering `auth status --json hosts`).
Without that PR, `check_cli_setup` still errors against the fake.
</details>

## Test plan
- [x] `pytest tests/unit/eval/test_stage_eval_env.py`: the staged fake
gh answers ahead of PATH on POSIX, and staging writes `gh.exe` on
Windows.
- [ ] Re-run `eval_flagship.yml` and confirm the gaia-tools backend log
shows no `gh is unauthenticated` and no real-gh `Usage:` output.
- [ ] Categories to re-score: `gaia_shell`, `gaia_skills_tasks`,
`gaia_honesty`.

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eval Evaluation framework changes performance Performance-critical changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(eval): on Windows the agent runs the real gh, not the benchmark's offline stand-in

2 participants