Title: mcpx testing: a CI time budget in the final job, and the over-budget runbook · Issue #1995 · developing-today/code · GitHub
Open Graph Title: mcpx testing: a CI time budget in the final job, and the over-budget runbook · Issue #1995 · developing-today/code
X Title: mcpx testing: a CI time budget in the final job, and the over-budget runbook · Issue #1995 · developing-today/code
Description: Relocated from dezren39/darwin-nix#140 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/ni...
Open Graph Description: Relocated from dezren39/darwin-nix#140 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue referenc...
X Description: Relocated from dezren39/darwin-nix#140 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue refe...
Opengraph URL: https://github.com/developing-today/code/issues/1995
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mcpx testing: a CI time budget in the final job, and the over-budget runbook","articleBody":"Relocated from dezren39/nix#140 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix numbering).\n\nParent: #95\n\n## Summary\n\nAdd a CI time budget: a hardcoded default (overridable per run), a final job after the matrix that measures how long the run took and which part was slow, and a written runbook for what to do when the budget is exceeded. Recommendation: **report several measures, gate on the longest leg, warn rather than fail on PRs, and track sustained overruns on main**. The final job doubles as the single required check (`ci-ok`) defined in #135, so the budget costs no extra job start.\n\n## Original notes\n\n> - testing\n> - importantly, as we add more testing agents should not run every single test basically ever. below documents a rough idea of a ci job design/policy, the main priority is being short as possible.\n> - make a comprehensive github action ci.yaml workflow (or test.yaml) that is as fast as possible,\n> - continue until the jobs can't get much faster considering setup/teardown and then set a ci testing budget which is a hardcoded default input. after the test matrix have a time budget job when subtracts github workflow request time from now. (this catches if the jobs are impacted by matrix size, could lessen by taking initial job end or matrix start time.)\n\n> - testing\n> - make a comprehensive github action ci.yaml workflow (or test.yaml) that is as fast as possible,\n> - repeat this process whenever testing exceeds some time budget. make setup faster, rebalance alpha splits, split groups of tests on the longest shard. maybe flag that never tears down because just killing the box after. anything downloaded should be cached, shallow clone a partial path to mcpx dir, if there's unexplainable job start delays, try to keep all job times balanced, 10 ultrafast ones can give you quick signals but may put pressure on runner infra and cause the longest jobs to last a little longer. all that matters is how long the longest jobs take. job runners have 2 or 4 cores, consider if theres lengthy tests which are '1' test but re-exec N times 'in parallel': they will only run 1-3 at a time and so 30 cases _could_ take up to 10 tests worth of time even in parallel and may need to be examined. we're using go so im not too worried about time budget but its best to get this early. main focus is strong tests as each step of the lifecycle.\n\n## Current state\n\n- No budget and no timing report exist. Wall times of the last 20 `mcpx.yml` runs: 3m24s-4m30s; the last 10: 3m57s-4m30s (a ~15 % spread on an unchanged workload -- the budget must have headroom or it flakes). The runs since (8001f23's merge, #182's PR and merge at 05c78b2, Renovate PR #184): 4m03s-4m15s, with e2e now at 209 tests. The gap between summed step time (229 s on 36673523537) and reported run time (237-258 s on the eight runs before it) is 8-29 s of queue and runner provisioning -- the quantity the notes worry about contaminating the number (from #167).\n- **There is no run-start timestamp in any expression context.** The `github` context has `run_id`, `run_number`, `run_attempt`, `workflow_sha`, ... but no time ([contexts reference](https://docs.github.com/en/actions/reference/workflows-and-actions/contexts)). The times come from the REST API with `permissions: actions: read`:\n - `GET /repos/{owner}/{repo}/actions/runs/{run_id}` -> `created_at`, `run_started_at`, `updated_at`. `run_started_at` is the start of the **current attempt**; `created_at` is the first attempt's. They are equal on attempt 1 (both `2026-09-30T05:27:57Z` for run 36673523537) and differ on a re-run -- use `run_started_at`, or a re-run is measured from the original push.\n - `GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt}/jobs` -> per job `created_at` (queued), `started_at`, `completed_at`, and per step `started_at`/`completed_at`. Verified on run 36673523537: job created 05:27:58, started 05:28:00, completed 05:31:53; step times match the log.\n- The notes' caveat is real: \"now minus run start\" includes the budget job's own queue and startup, `init`, and any queueing caused by matrix size (the Free plan runs 20 standard jobs at once account-wide, [limits](https://docs.github.com/en/actions/reference/limits)).\n\n## Approaches\n\n### What to measure\n\n- **A -- only `now - run_started_at` (the notes' first idea).** Simple, and it is what a human waiting on the PR feels. But it mixes queueing, `init`, the budget job's own start (~5 s + queue), and the real test time, so when it goes over, it does not say why. Least recommended as the *only* number.\n- **B -- measure from `init` completion / matrix start (the notes' alternative).** `max(completed_at of matrix legs) - init.completed_at`. Removes init and the final job's own start; still includes queue delay for legs. Of the notes' two spellings, prefer `init` end over \"matrix start\": the gap between `init` finishing and the legs starting *is* the matrix-size effect the notes want caught, and measuring from the first leg's start deletes it (from #167). `init` can also publish its own end time as a job output (`date +%s` into `$GITHUB_OUTPUT`), so this number needs no API call.\n- **C -- report all of them, gate on the longest leg (recommended).**\n\n| Measure | Formula (jobs API) | Tells you |\n| --- | --- | --- |\n| wall | `max(completed_at of needed jobs) - run_started_at` (not `now`, so the final job's own start is excluded) | what the author waits |\n| matrix span | `max(completed_at) - init.completed_at` | the notes' \"matrix start\" variant |\n| **longest leg** | `max(completed_at - started_at)` over legs, with its name | the thing sharding controls -- \"all that matters is how long the longest jobs take\" |\n| queue | max and sum of `started_at - created_at` | runner pressure / \"unexplainable job start delays\" |\n| fixed cost per leg | first test step `started_at` - job `started_at`, plus post steps | whether setup or tests dominate (the stop rule in #139) |\n\nGate on **longest leg** (controllable by us); report **wall** prominently; show **queue** so an over-budget wall with a normal longest leg is visibly GitHub's queue, not our tests. All go into the job summary as one table, plus a `timings.json` artifact merged from the legs' `go test -json` output (the input #139's splitter reads).\n\n### The budget input\n\n\"Hardcoded default input\" = a literal in the workflow, overridable when dispatched by hand:\n\n```yaml\non:\n workflow_dispatch:\n inputs:\n budget_seconds: { type: number, default: 0 }\nenv:\n # Longest-leg budget. Changing it is a reviewed edit with a reason; see the runbook.\n BUDGET_SECONDS: ${{ inputs.budget_seconds > 0 && inputs.budget_seconds || 120 }}\n```\n\n`inputs` is empty on `push`/`pull_request`, so those use the literal. A repository variable (`vars.MCPX_CI_BUDGET`) would let someone change the budget without a commit -- rejected, because the notes ask for a hardcoded default and a budget that changes silently is not a budget. A committed file (e.g. `.github/ci-budget.json`, `{ \"longest_leg_seconds\": ..., \"wall_seconds\": ... }`, read by `init` and passed down as an output) is the other reviewable home: a budget change becomes a one-line data diff beside the timing file #139 reads, and the dispatch input still overrides it (from #167). Either is fine; the literal is one file fewer.\n\nThe number: set it after #143's baseline and #139's first sharding, at roughly the p90 longest leg of ~10 main runs plus 15 % (the observed spread), then ratchet down as the runbook wins time. `120` above is a placeholder.\n\n### What happens over budget\n\n- **A -- fail the run.** With a ~15 % run-to-run spread, a tight budget fails healthy PRs, people re-run until green, and the budget becomes noise that costs more runner time than it saves. Not recommended.\n- **B -- warn only** (`::warning::` annotation + summary). Cheap and honest, but a warning on every PR is ignored within a week.\n- **C -- warn per run; act on sustained overruns; fail only on gross overruns (recommended).**\n - Every run: summary table + a `::warning::` if the longest leg exceeds the budget.\n - On `main` only: if the median longest leg of the last 5 main runs (from the API) exceeds the budget, open or update one issue \"mcpx CI over budget\" (label `testing`) with the table and a link to the runbook. `permissions: issues: write` on this job, main only.\n - Fail only above 2x the budget: that is a hang or an accidental serialisation, not variance, and it should block.\n\nRun the final job on `ubuntu-slim` (1 vCPU container, meant for short automation jobs; [runner reference](https://docs.github.com/en/actions/reference/runners/github-hosted-runners)) -- it only needs `gh`/`curl` and `jq`. Whether `ubuntu-slim` starts faster or slower than `ubuntu-latest` is unmeasured; check in #143.\n\n## Runbook (when the budget is exceeded)\n\nLives as a comment block at the top of `mcpx-test.yml` and is linked from the summary (a longer version can go wherever #99 puts the testing policy doc). Cheapest first; stop as soon as the budget is met:\n\n1. **Read the table.** Which measure is over?\n - *queue* high, longest leg normal -> runner pressure. Merge the smallest legs (lint legs first), or drop a shard. Do not add shards.\n - *fixed cost* high -> setup. Go to 2.\n - a *test leg* long -> go to 3.\n - the `nix` leg longest -> see #135 decision 7 (store cache; question whether `checkPhase` needs to re-run units CI already ran).\n2. **Make setup faster.** Look for cache misses in the log (until #182 every run carried `Restore cache failed: Dependencies file is not found`; since #182 a miss reads `Cache is not found` in the setup-go step); drop `setup-*` steps a leg does not use; ship the compiled `e2e.test` and binaries instead of building per leg.\n3. **Rebalance.** With the #139 splitter this is automatic; check the timing file is fresh. If using hand ranges (not recommended), move the boundaries.\n4. **Split the longest shard.** Lower `target_leg_seconds` / raise N -- but only while the saving per extra leg exceeds the fixed cost per leg (#139's stop rule).\n5. **Make the slowest tests faster.** Top 10 from `timings.json`: fixed `time.Sleep` waits, fan-out tests on too few cores, anything that starts a runtime it does not need. #79's CLI speedups apply to every e2e test.\n6. **Parallelise within a leg** (`t.Parallel` in e2e). #52 no longer blocks it (fixed in #182); #138's environment allowlist comes first (see #139).\n7. **Raise the budget** only as a reviewed change with the table attached and the reason in the commit message.\n\nRepeat whenever the main-branch issue opens.\n\n## Open questions\n\n1. Budget on longest leg only, or also a separate (looser) wall budget?\n2. Where does the long-form runbook live -- workflow comment only, or the testing policy doc from #99?\n3. Should the over-budget issue be one rolling issue or a comment on #95?\n4. `ubuntu-slim` vs `ubuntu-latest` for the final job: start latency?\n5. Are timings from re-run attempts excluded from the median? (They are usually warm and faster.) Record `github.run_attempt` beside every measurement so the history stays interpretable.\n6. Should a leg's *setup* have its own threshold? A setup regression is invisible in wall clock while the matrix absorbs it, and setup is the floor on the useful shard count (#139's stop rule) (from #167).\n7. #97's environment legs (container, remote, macOS) are legitimately slower: one global budget, or one per matrix dimension (from #167)?\n\n## Ease · Impact · Related\n\n**Ease** S (the job) + S (runbook) · **Impact** med · **Depends on / related**: #95, #135 (the final `ci-ok` job this lives in), #139 (consumes `timings.json`; stop rule), #143 (baseline that sets the number), #138 (before `t.Parallel`), #52 (closed, fixed in #182), #79, #97 / #134 (environment legs will likely be the longest -- macOS runners are 3 vCPU and capped at 5 concurrent), #130 (its PR job is inside the budget, its nightly run is not), #99.\n\nSecurity/auth deferred; see tracker.\n\n## Acceptance criteria\n\n- The final CI job enforces/reports the stated time budget and the over-budget runbook is recorded where the body specifies.\n- The work described in the Summary/Scope above is delivered via a branch + PR (no direct push to main); verification runs in GitHub Actions CI, not on the sandbox.\n- Evidence (CI links, timings, or probe output as applicable) is recorded on this issue before it is closed.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-28T23:00:05Z","url":"https://github.com/developing-today/code/issues/1995"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9e601fcc-551a-d253-68f1-6e1373945373 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF52:3CBF9:7A41B0:9DD029:6B0628AD |
| html-safe-nonce | 806ae1249530163c9febd1b39da1cffde5e0f08153367e99d3fe9991529c2e7a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjUyOjNDQkY5OjdBNDFCMDo5REQwMjk6NkIwNjI4QUQiLCJ2aXNpdG9yX2lkIjoiOTU0MDczNDE1NDc0ODgyNzMzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 108b06d4b8f48f820e3b8ef5c901f21a02c27bccc0daa854f2726403996e2ae1 |
| hovercard-subject-tag | issue:6089071445 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/1995/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3305359481fe6be722388fc7357abe0d56df41dd2bb156ade440c7124953eb70/developing-today/code/issues/1995 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3305359481fe6be722388fc7357abe0d56df41dd2bb156ade440c7124953eb70/developing-today/code/issues/1995 |
| og:image:alt | Relocated from dezren39/darwin-nix#140 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue referenc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9e10bb0ecc0bd0f8692aa89586ee9b54e498d7ab9f244a44cdb5b93653a125ce |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32e57d5cc2ce6ce92ec6dceb65858344750c27c2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width