Skip to content

tooling: box-capacity skill + box_status.py (admission control, collision checks for agent fleets) - #4882

Merged
squid-protocol merged 4 commits into
mainfrom
tooling/box-capacity
Oct 11, 2026
Merged

squid-protocol merged 4 commits into
mainfrom
tooling/box-capacity

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Why

Agents share one box. The concurrency caps count agents, not load. On 2026-10-11 the 15-minute load reached 13.5 on 12 cores while only a couple of agents ran: the orchestrator's own gate runs, unwrapped pytest runs and Docker proofs ran beside the heavy-run.sh slots. Overload isn't only slow. Load-induced regex timeouts faked 2,911 golden diffs (#4247), and proofs time out.

What

  • tests/tools/box/box_status.py (--json for scripts) reports:
    • cores, load 1/5/15, CPU and memory pressure (Linux PSI), memory available and swap;
    • who holds each heavy slot and the golden lock (PID, worktree, command);
    • the busiest worktrees by cores in use, and running containers;
    • a verdict of GREEN / YELLOW / RED. decide() is pure and tested. Swap that's merely in use isn't judged on its own, because it can be old pages from a spike long gone; paging now shows as memory pressure.
  • .claude/skills/box-capacity covers:
    • admission: heavy agents only into free slots, light work only on YELLOW, nothing on RED;
    • what counts as heavy (always wrapped in heavy-run.sh, the orchestrator's own runs included);
    • overload response: pause the newest heavy worker at a checkpoint, find orphans with kill-by-cwd.sh --dry-run, stop idle singletons;
    • collision checks: file overlap with in-flight branches, the hot files, generated and ratchet files, shared runtime changes, singletons like the Db2 container, golden lock and crucible pins, and the API budget;
    • a per-launch checklist.
  • parallel-pr-agents references it, in the box tools table and the checklist.

Checks

  • test_box_status.py: 6 pass. It exercises only the pure decide(), so it also runs on the Windows and macOS legs.
  • Live run on the box: GREEN (load 0.3, 0% pressure, 4 GB of leftover swap with 22 GB available). The first draft wrongly called that YELLOW, which is why swap alone is no longer judged.
  • pr_gates --fast PASS; --ratchets 7/7 PASS, nothing skipped.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AUWeQX7v4QBdErFbghEEEX

…collision checks for agent fleets

On 2026-10-11 the 15-minute load reached 13.5 on 12 cores with a couple of
agents running: the caps count agents, not load, and the orchestrator's own
gates, unwrapped pytest runs and Docker proofs ran beside the slots.

- tests/tools/box/box_status.py: cores, load, CPU / memory pressure (PSI),
  memory available, swap, who holds each heavy-run slot and the golden lock,
  busiest worktrees by cores in use, containers; verdict GREEN / YELLOW / RED
  (decide(), pure; swap merely in use is not judged alone: paging now is
  memory pressure). --json for scripts.
- .claude/skills/box-capacity: admission (heavy agents only into free slots,
  nothing on RED), what counts as heavy, overload response (pause the newest
  heavy worker at a checkpoint, find orphans, idle singletons), collisions
  (file overlap with in-flight branches, hot files, generated/ratchet files,
  shared runtime changes, singletons, API budget), per-launch checklist.
- parallel-pr-agents: references it (box tools table + checklist).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AUWeQX7v4QBdErFbghEEEX
@squid-protocol squid-protocol added ci-cd Continuous integration, delivery, and automated runners enhancement New feature, sensor, or structural signature shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md labels Oct 11, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 11, 2026 10:58
@squid-protocol
squid-protocol enabled auto-merge (squash) October 11, 2026 10:58
Comment thread tests/tools/box/box_status.py Fixed
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol

Copy link
Copy Markdown
Owner Author

PR #4882 @ d96e8a0: 2 failed check(s)

== full-suite (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/38133784397/job/114455821474
repro: python -m pytest -q tests
errors:
##[error]Process completed with exit code 1.
log tail:
2026-10-11T11:10:52.3173247Z Current runner version: '2.337.0'
##[group]Runner Image Provisioner
Hosted Compute Agent
Version: 20261002.596
Commit: c3d12f3313a95f25162a1503be624f3b0617f8c0
Build Date: 2026-10-02T22:28:27Z
Worker ID: {35b431a8-2ace-4cea-851a-a05a9b57f7ab}
Region: eastus2
Cloud: Azure
##[endgroup]
##[group]Operating System
Ubuntu
24.04.5
LTS
##[endgroup]
##[group]Runner Image
Image: ubuntu-24.04
Version: 20261004.327.1
Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20261004.327/images/ubuntu/Ubuntu2404-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20261004.327
##[endgroup]
##[group]GITHUB_TOKEN Permissions
Contents: read
Metadata: read
##[endgroup]
Secret source: Actions
Cache mode: write
Prepare workflow directory
Prepare all required actions
Complete job name: full-suite
##[group]Run echo "full-suite parts: $PARTS"
echo "full-suite parts: $PARTS"
test "$PARTS" = "success"
shell: /usr/bin/bash -e {0}
env:
PARTS: failure
##[endgroup]
full-suite parts: failure
##[error]Process completed with exit code 1.
Cleaning up orphan processes

== full-suite part 3/3 (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/38133784397/job/114453342204
repro: python -m pytest -q tests/test_source_reads.py::test_no_source_read_loses_a_byte
failing tests: tests/test_source_reads.py::test_no_source_read_loses_a_byte
errors:
fail-on-cache-miss: false
E AssertionError: #3813: decode through gitgalaxy.core.source_text (read_source / open_source / decode_bytes) instead of a lossy errors= handler or a text-mode read of an estate file:
tests/test_source_reads.py:137: AssertionError
FAILED tests/test_source_reads.py::test_no_source_read_loses_a_byte - AssertionError: #3813: decode through gitgalaxy.core.source_text (read_source / open_source / decode_bytes) instead of a lossy errors= handler or a text-mode read of an e
##[error]Process completed with exit code 1.
log tail:
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib
##[endgroup]
##[group]Run {
{
echo "## CICS spec status page (advisory)"
if python tests/tools/cics_spec_status.py render --check 2>&1; then :; else
echo "The evidence-refresh bot re-renders docs/language_status/cics_spec_status.md on main after merge; do not commit it here."
fi
} >> "$GITHUB_STEP_SUMMARY"
shell: /usr/bin/bash -e {0}
env:
PYTHONUTF8: 1
GITGALAXY_LICENSE_KEY: COMMUNITY_FREE_TIER
OMP_NUM_THREADS: 1
EVIDENCE_REPORT_ADVISORY: 1
pythonLocation: /opt/hostedtoolcache/Python/3.12.15/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib
##[endgroup]
Post job cleanup.
[command]/usr/bin/git version
git version 2.55.0
Temporarily overriding HOME='/home/runner/work/_temp/153fe03b-b9c0-4ed9-b95b-f81951d64a6f' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/gitgalaxy/gitgalaxy
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Cleaning up orphan processes

@squid-protocol squid-protocol added the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Oct 11, 2026
@squid-protocol squid-protocol removed the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 11, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

CI shepherd: the head of this PR (11056f9) is not the one a maintainer labelled shepherd:merge on (new commits, or never approved), so the label was removed and nothing merges unreviewed code. Re-add the label when the new head is ready (shepherd:reapprove marks this PR until then).

@squid-protocol squid-protocol added shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md and removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md labels Oct 11, 2026
…tatus sees short-lived processes

Measured while #4882 was in CI: load 52-86 on 12 cores with two workers.
pr_gates' unicode gauntlet ran --jobs nproc in every heavy slot, so two
gates at once ran 24+ CPU-bound scans on 12 cores; the slot model assumed
a job takes nproc / slots.

- heavy-run.sh exports GG_JOB_CORES = nproc / heavy slots held when the job
  starts (alone: every core; two jobs: half each). pr_gates' gauntlet and
  unicode_gauntlet's --jobs default read it (CI runners: unchanged).
- box_status: a process born during the sample counts all its ticks (the
  gauntlet's scans live ~1 s and were invisible); a lock whose taker has
  exited is attributed to the processes holding its descriptor.
- test_box_tools: the fair share (alone vs beside a held slot).
- box-capacity skill: parallel tools size themselves from GG_JOB_CORES.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AUWeQX7v4QBdErFbghEEEX
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 11, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

Two commits added after review:

  1. CI fix (Decoding foundation: read_source (BOM / strict UTF-8 / UTF-16 / declared / cp1252-Latin-1 fallback), per-file source_encoding, no errors=ignore anywhere (lint gate) #3813 gate): box_status._cmd decoded /proc/<pid>/cmdline with errors="replace". It's now backslashreplace, which is lossless. The CodeQL empty-except is now commented and uses continue.
  2. Found live while this was in CI: load 52–86 on 12 cores with two workers. pr_gates' unicode gauntlet ran --jobs nproc in every heavy slot. heavy-run.sh now exports GG_JOB_CORES (nproc ÷ slots held when the job starts), and the gauntlet uses it. box_status now counts short-lived processes and finds lock holders by open file handle. It attributed 12.8 cores to one worker's gate, where before it showed only chrome. There's a new test_box_tools case for the fair share. The box was RED, so per the skill only the light tests ran locally (15 + 13 pass); CI runs the full suite.

@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol enabled auto-merge (squash) October 11, 2026 11:21
@squid-protocol squid-protocol removed the shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md label Oct 11, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

PR #4882 @ 80b421c: 1 failed check(s)

== full-suite part 3/3 (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/38135251599/job/114457792817
repro: python -m pytest -q tests/tools/test_box_tools.py::test_heavy_run_gives_the_job_a_fair_share_of_the_cores
failing tests: tests/tools/test_box_tools.py::test_heavy_run_gives_the_job_a_fair_share_of_the_cores
errors:
fail-on-cache-miss: false
E AssertionError: assert 1 == 4
tests/tools/test_box_tools.py:69: AssertionError
FAILED tests/tools/test_box_tools.py::test_heavy_run_gives_the_job_a_fair_share_of_the_cores - AssertionError: assert 1 == 4
##[error]Process completed with exit code 1.
log tail:
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib
##[endgroup]
##[group]Run {
{
echo "## CICS spec status page (advisory)"
if python tests/tools/cics_spec_status.py render --check 2>&1; then :; else
echo "The evidence-refresh bot re-renders docs/language_status/cics_spec_status.md on main after merge; do not commit it here."
fi
} >> "$GITHUB_STEP_SUMMARY"
shell: /usr/bin/bash -e {0}
env:
PYTHONUTF8: 1
GITGALAXY_LICENSE_KEY: COMMUNITY_FREE_TIER
OMP_NUM_THREADS: 1
EVIDENCE_REPORT_ADVISORY: 1
pythonLocation: /opt/hostedtoolcache/Python/3.12.15/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib
##[endgroup]
Post job cleanup.
[command]/usr/bin/git version
git version 2.55.0
Temporarily overriding HOME='/home/runner/work/_temp/5e7e588e-fe64-4e19-a19c-dba9da5c51e4' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/gitgalaxy/gitgalaxy
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Cleaning up orphan processes

@squid-protocol squid-protocol added the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Oct 11, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol squid-protocol removed the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 11, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

CI shepherd: the head of this PR (6f27358) is not the one a maintainer labelled shepherd:merge on (new commits, or never approved), so the label was removed and nothing merges unreviewed code. Re-add the label when the new head is ready (shepherd:reapprove marks this PR until then).

@squid-protocol squid-protocol added shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md labels Oct 11, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

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

Labels

ci-cd Continuous integration, delivery, and automated runners enhancement New feature, sensor, or structural signature shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants