Skip to content

Windows CI leg never runs session-start-hook.sh: add a Git Bash benchmark test that measures wall time and spawn count on windows-latest (Part of #660) #669

Closed

Description

@fdaviddpt

Part of #660. Every latency number attached to #660 and its follow-ups (#662-#668) is reasoned from the reporter's per-spawn figure, not measured, because the one place this repo runs Windows -- the windows-latest leg of .github/workflows/tests.yml -- never executes the hook: 92 modules blanket-skip on win32 (#497), and the two tests #661 added are skipif(sys.platform == "win32") too. The Windows leg is green because it exercises almost nothing about the shell path.

windows-latest ships Git for Windows, so C:\Program Files\Git\bin\bash.exe (MSYS, the same environment Claude Code hooks run under on the reporter's machine) is available on every run. Nothing stops CI from measuring the real thing.

Ask

One test module that runs on Windows only (and is not skipped there):

  1. Locate Git Bash (C:\Program Files\Git\bin\bash.exe, falling back to where bash filtered to a Git path; skip with a reason naming the miss, never silently pass -- a skipped benchmark on the one leg it exists for is the absence this repo's own rules forbid).
  2. Build a representative fixture store: legacy .remember layout with identity + 4 memory files, a recent.md, a last-save.json marking the previous session saved, installed_plugins.json version 2, jq present (Git for Windows does not ship it; choco install jq or a pinned download in the workflow step, so the jq-present and jq-absent paths can both be measured -- run both).
  3. Invoke scripts/session-start-hook.sh under that bash with a realistic stdin payload, twice (cold, then warm -- the warm run is what SessionStart: cache the injected context, the flattened config and the tool verdicts across starts, validated by mtime (Part of #660) #668's cache targets).
  4. Measure: wall time per run (time.perf_counter around the subprocess), and spawn count via BASH_XTRACEFD + set -x (count trace lines that begin a command; subshell depth from BASH_SUBSHELL in PS4), written to a file in the fixture.
  5. Emit both as a pytest record_property / printed summary line so they show in the job log, and assert a budget: wall time under N seconds and spawns under M. Start with generous values that the current code passes on the runner (measure first, then pin), and tighten them as SessionStart: drop the unconditional python -V probe from the foreground path (Part of #660) #662-SessionStart: cache the injected context, the flattened config and the tool verdicts across starts, validated by mtime (Part of #660) #668 land -- each PR lowers the ceiling to what it measured.
  6. Same test on Linux/macOS with the local bash, so the cross-platform ratio is visible in one log.

Why this and not a timing budget in the hook

A budget inside the hook cannot fail CI. A test that runs on the Windows leg can, and it turns "reasoned" into "observed" for every follow-up under #660 -- the CLAUDE.md bar for cross-platform claims.

Caveats to state in the test

  • The runner is an x64 Xeon; the reporter is Windows 11 ARM64. Absolute numbers will differ. The point is the before/after on the same runner per PR, plus the spawn count, which is machine-independent.
  • Defender exclusion already exists in the workflow for the checkout and RUNNER_TEMP; keep the fixture under RUNNER_TEMP so the scanner does not add noise.
  • read -r -t 1 at session-start-hook.sh:92: close stdin properly in the harness so the timeout path is not measured by accident, and add a second variant that leaves it open to measure it on purpose.

[AI-generated]

Activity

  1. added
    priority:high
    filed-by-loop
    lane-diagnostics
    on Sep 11, 2026
  2. self-assigned this
    on Sep 12, 2026
  3. added 7 commits that reference this issue on Sep 12, 2026
  4. removed their assignment
    on Sep 12, 2026
  5. added 3 commits that reference this issue on Sep 12, 2026
  6. added 2 commits that reference this issue on Sep 26, 2026
  7. added 2 commits that reference this issue on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    filed-by-looplane-diagnosticspriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions