Repository navigation
Description
Problem
The pre-push gate (npm run local:gate) runs under a machine-wide lease, one gate at a time, and a waiter gives up after 45 minutes. With several agent sessions working in parallel, the queue has grown deeper than that budget: gates time out without running a single stage, and fixes wait longer for the gate than they took to write. #5757 lets gates share the machine; this issue makes each gate do less work. Three changes:
1. The gate runs every test suite twice
local:gate:stages runs validate (each TypeScript workspace's validate ends in vitest run) and then coverage (vitest run --coverage over the same suites), and likewise validate:py (pytest) and then coverage:py (pytest --cov). The coverage run executes the same tests and fails on any test failure, so the plain pass adds time and catches nothing more.
Change: in the gate and in CI, run each suite once, under coverage. Keep npm test / uv run pytest as the fast inner loop, which AGENTS.md wants kept separate from coverage.
2. The gate runs every server, whatever changed
interface-diff and image-smoke already run only for the servers a change touches, but validate, coverage, validate:py, coverage:py and smoke run all seven. A change confined to src/memory/ runs the fetch, git and everything suites too.
Change: when every changed path (against the merge base with origin/v2/main) is under one or more src/<server>/ directories, run those stages for those servers only. Any change to repository-wide files (a root manifest or lockfile, scripts/, .github/workflows/, .changeset/ config, the root tsconfig/lint/format config, AGENTS.md/skills for verify:skills) runs everything, as now. The root guards (validate:guards, verify:dco, verify:install-fresh) always run.
3. A draft PR does not need the full gate on every push
Change:
- While a PR is a draft, a push needs only the touched servers'
validate/validate:py, plusverify:dco. - Marking it ready for review needs a full
npm run local:gate(exit 0) first. - After that, every push needs the gate as now, scoped by change 2.
- In CI, coverage, smoke, the interface diff and the image smoke skip draft PRs and run on
ready_for_reviewand on every later push. Format, lint, typecheck, build and tests still run on drafts.
Scope
package.json(local:gate:stages,validate, the workspacevalidatescripts), and a changed-servers helper inscripts/lib/, shared withinterface-diff/image-smokeif they already compute it..github/workflows/typescript.ymlandpython.yml: drop the duplicate test pass, scope or skip by draft state, and addready_for_reviewto the PR event types.- The workflow guard (
scripts/lib/workflow-gate.mjs) and its tests, which pin whatlocal:gatecontains. - AGENTS.md (Before pushing, Always test new or modified code: "CI and
npm run local:gaterun each as a stage of its own"),docs/quality-gate.md, and thepre-push-gateandpr-flowskills.
Acceptance
- A change confined to one server's directory gates only that server, and the gate log says which servers it chose and why.
- A change to any repository-wide file gates every server.
- Each test suite runs once per gate, under coverage, and the per-file thresholds still fail the gate.
- A draft PR's CI skips coverage, smoke and the image smoke; marking it ready runs them.
- AGENTS.md's statement that the gate runs every check CI runs stays true.
- The docs and skills describe the new rules, and
npm run verify:skillspasses. - Before-and-after gate timings for a one-server change are recorded in the PR.
Activity
Gate: run each suite once, scope per-server stages, lighter draft gate