Skip to content

Pool meter 15: the GitHub API basics move to ci_pool_github.py - #165

Open
paulfoley wants to merge 15 commits into
SoulCraft-Org:mainfrom
paulfoley:claude/ci-pool-15-split
Open

paulfoley wants to merge 15 commits into
SoulCraft-Org:mainfrom
paulfoley:claude/ci-pool-15-split

Conversation

@paulfoley

@paulfoley paulfoley commented Nov 20, 2026 •

Copy link
Copy Markdown

Part of #149. Layer 15 of 15, stacked on #164. Merge bottom up. This layer's own diff, with CI: paulfoley#15.

File Change
tools/ci_pool_github.py New: Unreadable, parse_time, iso, Api, items_of, moved verbatim
tools/ci_pool.py Imports them from beside itself; 301 to 262 code lines, so code.long_files is 0 again

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

paulfoley and others added 15 commits November 19, 2026 21:43
…ills it

The first layer of the org-wide Blacksmith meter: the API reader, the label
weights (x64 vCPU/2, ARM x0.625, Windows 2 per 2 vCPU, macOS 20 and 40) and
per-job rounding up to the minute. An unknown label or failed read raises
Unreadable, never a count of zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
repo_runs, run_jobs and org_repos page through the GitHub API over a rolling 31
days. A list cut off by GitHub's 1,000-result cap, or short of its total_count,
says it is not whole instead of undercounting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
meter() sums every repo's Blacksmith minutes, keeps finished runs in a ledger
so later passes read only what changed, and sets the stop 1.25 hours of the
busiest hour's burn under 3,000. A pass out of time or reads stops and reports
complete: false; the next pass resumes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
…ariable

ci_pool.py meter --org --ledger --seconds --write saves the ledger every 50
runs and on any failure, then writes the reading to the org variable CI_POOL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
… own

--cli-usage FILE reads `blacksmith usage --since 30d --format json` output.
The reading keeps the higher count; output with no billable minutes becomes a
note, and the meter's count stands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
At --hard-stop (default 2,850) a --write pass sets each runner group whose
name starts with Blacksmith to selected with no repos, and does so again on
every pass while stopped. Only --resume opens them to all. The last reading,
$CI_POOL_PREVIOUS, carries the stop between passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
…manifest

A composite action runs tools/ci_pool.py at the pinned commit, as
actions/pages does, so no 390-line copy is embedded in a workflow. Its usage
mode reads Blacksmith's own count in a job of its own, since that installer
runs unpinned code. templates/ci/ci-pool.yml goes in an org's .github repo;
ci-pool-app.json asks for Actions read, org Variables write and org
Self-hosted runners write, with the webhook off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
With the org variable CI_POOL set, ci_overflow.py names the lane's label only
when the reading is version 2, under 75 minutes old, complete, not stopped
and under its stop; anything else is ubuntu-latest. It makes no API call, and
serves every repo in the org, so the per-repo meter stays only for orgs
without the pool. ci-overflow.yml passes vars.CI_POOL and embeds the new copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
…de the chooser

A new rule, blacksmith, that no exception waives: a Blacksmith label in any
runs-on but ci-standard.yml's chooser, and useblacksmith/stickydisk,
build-push-action or setup-docker-builder, whose storage no meter stops.
The chooser's own runs-on stays a runner finding, as before. Known-bad and
known-clean samples in the self-test; ci-standard.yml embeds the new copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
…tail

templates/ci/README.md gains a CI pool section: the App, the meter's place
in an org's .github repo, its variable and secrets, the Blacksmith* runner
groups, resume, and the reading. DECISIONS.md records five 2026-11-20
decisions, each with its reversal. compute-detail.md says one org meter
replaces per-repo shares. ci-overflow.json's note points a second repo to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
…ction documented

code-gate failed layers 1 to 10 on tools/ci_pool.py: weight at complexity 11, meter at 24, and nine public
functions with no docstring. weight now looks its rate up in a table. meter hands each repo to a Pass object
(read_repo, read_run) and sums with tally. The reading and the ledger are unchanged; the self-test passes 44 of 44.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
… Blacksmith's own cost leads

Blacksmith's FAQ says the free minutes are "a monthly credit worth the same number of x64 2 vCPU minutes at
list price" (docs.blacksmith.sh, read 2026-11-20): $0.004 a minute, $12 a month. Its CLI's billable minutes
are not the meter's 2-vCPU minutes, so dollars are the one unit both share.

- Reading version 3: cost, credit, stop ($10.80, 90 %), left, floor_cost and floor_minutes.
- `blacksmith usage`'s estimated cost is the reading; the job-record walk is its floor; the higher counts.
- No estimated cost (no token, or output without one) makes the reading complete: false: no Blacksmith.
- Hard stop $11.40 (95 %). The usage job runs in environment ci-pool-meter, which holds BLACKSMITH_ORG_TOKEN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
…ng with Blacksmith's own cost

pool_reason now needs version 3, cost under the stop in dollars, and a number in cli_cost. A reading the meter
made without Blacksmith's estimated cost (no BLACKSMITH_ORG_TOKEN) keeps every repo on ubuntu-latest. The
outputs keep minutes (the floor's) and the reason gives dollars. ci-overflow.yml is re-embedded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
…ck under the reading goal

CI-POOL.md holds the setup, the flow in dollars and the pool's decisions.
DECISIONS.md keeps the units row with Blacksmith's FAQ quote and list price.
The meter's comment cites only pages read on 2026-11-20.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
…ol.py under 300 code lines

Unreadable, parse_time, iso, Api and items_of move verbatim to tools/ci_pool_github.py beside
ci_pool.py, which imports them (python3 -I leaves the folder off sys.path, so it appends HERE).
ci_pool.py drops from 301 to 262 code lines: code.long_files goes back to 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: paulfoley <268432743+paulfoley@users.noreply.github.com>
@paulfoley

Copy link
Copy Markdown
Author

Reviewer note for the CI pool stack, #151 to #165 (from the paulfoleyllc orchestrator, 2026-11-20)

Item Detail
Merge As one unit from the top (#165), or squash. Layers 1 to 14 keep red runs whose fixes sit in later layers: folding them would need a force-push, which delegation.md forbids.
CI #165's fork run (paulfoley#15) is green except dependency-review, which the fork can't run (dependency graph off). Upstream workflows wait for a maintainer's approval to run.
Primary reading Blacksmith's own blacksmith usage estimated cost against its $12 monthly credit; the job-record walk is a floor; the higher wins. Stop $10.80 (90 %), hard stop $11.40 (95 %) closes every Blacksmith* runner group. No org token means no Blacksmith.
Why cost, not job records Colorado-Startups, 30 days to 2026-11-20: Blacksmith reported 5,246 billable / 2,623 runtime minutes, $10.49; the per-repo job-record guards read about a third.
The $12 credit, source Blacksmith's flex-scheduling FAQ: "Free minutes are a monthly credit worth the same number of x64 2 vCPU minutes at list price" (docs.blacksmith.sh/llms-full.txt, read 2026-11-20), with $0.004 a minute list price. Cite it in DECISIONS' units row.
Backstop, measured Colorado-Startups, 2026-11-20: closing all four Blacksmith groups made a job wait 8.5 min with no runner; Blacksmith did not reopen them; reopening ran it in 30 s; a job pushed about 10 s after closing still ran. GitHub's org self-hosted-runner switch does not stop org-level runners (GitHub docs).
Still to verify on the first real run The CLI's install path on the runner, and its JSON cost key and units (it may report cents).
Org variables Private repos read org variables on paid plans; check per org. Colorado-Startups is Enterprise Cloud.
Depends on #150 (account-local deny file) for this account to store BLACKSMITH_ORG_TOKEN by pipe.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant