Skip to content

test(skills): run the starter-skill imports in one CLI process - #8013

Merged
kovtcharov-amd merged 1 commit into
mainfrom
fix/starter-skills-cli-one-interpreter
Nov 13, 2026
Merged

kovtcharov-amd merged 1 commit into
mainfrom
fix/starter-skills-cli-one-interpreter

Conversation

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

The starter-skill CLI test keeps timing out on macOS CI (#7887, #7912). It launched a fresh gaia process for each of the ~24 starter skills, and every cold start costs ~3.5 s, so the test took ~80 s on an idle machine and went past its 180 s limit on a loaded macOS runner. The imports now run through the real CLI entry point in one process, each still checked for its own exit code and error message, and the test takes ~9 s.

What it checks is unchanged: every in-ceiling skill imports, every over-ceiling one is refused with exit 4 and a "ceiling" message, and a separate cold gaia skill list --json then sees exactly the importable set.

Test plan

  • pytest tests/unit/test_starter_skills.py -n 4: 311 passed, 22 skipped
  • Same load (a parallel -n 3 run of the file): old test 84 s, new test ~9 s
  • 20/20 runs pass under that load
  • New test_batched_cli_keeps_each_commands_own_exit_code_and_stderr: a failing import keeps the same exit code as a standalone run, and its error doesn't leak into the next command
  • python util/lint.py --black --isort

…per skill

test_cli_imports_every_starter_skill started a fresh `python -m gaia.cli`
for each of the ~24 starter skills. Each cold start costs ~3.5 s (the CLI
imports the agent base, the LLM clients and matplotlib up front), so the
test took ~80 s on an idle box and blew its 180 s timeout on loaded macOS
runners.

The imports now run through the real gaia.cli.main in one interpreter,
each with its own captured exit code, stdout and stderr; the final
`skill list` is still a separate process, so what landed on disk is checked
from cold. A new test proves batching keeps a failed command's exit code and
error and does not leak them into the next command.
@github-actions github-actions Bot added the tests Test changes label Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

This fixes the macOS CI timeout in the starter-skill import test by running all ~24 imports in one CLI process instead of paying a cold start for each one. It still checks each import's own exit code and error message, and the final skill list still runs as a separate cold process, so it covers the same ground as before. The new guard test that compares a batched failure with a standalone one is a good check that batching hides nothing. One small thing to tidy is below; nothing blocks the merge.

Real-world evidence

N/A: this PR only changes tests. No user-facing surface changed, so the verdict rests on static review and the author's test-plan runs.

🔍 Technical details

Issues found

🟢 The batch driver drops the text of a sys.exit("message") (tests/unit/test_starter_skills.py, _BATCH_DRIVER). A real interpreter prints a non-int SystemExit code to stderr before exiting 1. The driver maps it to 1 and throws the text away, so a failure of that kind would show an empty stderr in the assertion message. The skill import path doesn't do this today, but the guard test's promise of "same exit code and stderr as a standalone run" depends on it. Suggested fix:

        except SystemExit as exc:
            if isinstance(exc.code, int) or exc.code is None:
                code = exc.code or 0
            else:
                print(exc.code, file=sys.stderr)
                code = 1

Checked and fine

  • python -m gaia.cli calls main() without sys.exit(main()), so treating a None return as 0 in the driver matches the subprocess behaviour.
  • A non-SystemExit exception escapes the driver, makes the process exit non-zero, and fails assert proc.returncode == 0, proc.stderr with the traceback. It is not swallowed.
  • The len(results) == len(commands) check means a half-finished batch can't pass by zip truncation.
  • No docs describe this test, so there is no doc drift.

Strengths

  • The final skill list --json stays a separate cold process, so leftover in-process state can't make the end-state check pass.
  • test_batched_cli_keeps_each_commands_own_exit_code_and_stderr tests the batching itself against a standalone run. It doesn't just trust that batching works.
  • Pulling out _cli_env keeps the two runners on the same isolated environment instead of duplicating it.

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator Author

Leaving the sys.exit("message") suggestion out of this PR. It only changes the text shown when a test fails, and none of the commands this test batches exit that way, so exit codes and pass/fail come out the same either way.

🔍 Technical details

The only string sys.exit calls in src/gaia/cli.py are in gaia eval retrieval; src/gaia/skills/ has none. A string exit code still maps to 1, which matches a real interpreter.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit 1aed9a6 Nov 13, 2026
33 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the fix/starter-skills-cli-one-interpreter branch November 13, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant