Skip to content

heavy-install: link t3-capacity to the kit's copy; self-check warns on another (#919) - #922

Merged
scuttletoby merged 5 commits into
mainfrom
fork/heavy-t3-capacity-link
Nov 22, 2026
Merged

scuttletoby merged 5 commits into
mainfrom
fork/heavy-t3-capacity-link

Conversation

@scuttletoby

@scuttletoby scuttletoby commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

What and why

t3-capacity now has one source: the heavy kit's own bin/t3-capacity (fork part of #919, steps 1 and 3).

  • heavy-install links /usr/local/bin/t3-capacity to current/bin/t3-capacity, the same way it links heavy and heavy-install. Installing a newer kit now changes what t3-capacity does too, so the two copies can no longer drift apart.
  • A host's own plain copy is replaced only when you ask (--replace-t3-capacity), as the issue's plan says ("unless told"). Without the option, the installer leaves the file alone, prints a note, repeats a WARNING in its closing installed release line, and writes no installed.tsv row for it. A link there that the kit did not make is treated the same way without the option (left alone, noted, no row). It is opt-in because a host's installer and CI may read or compare that exact file (see the consumer list below). Replacing it without being asked would break them. Once the link is in place, later runs keep it without the option.
  • The old plain copy is kept in /usr/local/libexec/heavy-kept/t3-capacity.<sha256[:16]>, stored by hash. uninstall puts it back and then removes that folder. It is kept outside /usr/local/libexec/heavy and /etc/heavy, because every released installer's uninstall (ci/v6 to ci/v22) deletes those two folders whole; and it is not in replaced/, because those installers restore the newest file of replaced/ as /usr/local/bin/heavy.
  • Refused before anything is written: with --replace-t3-capacity, a t3-capacity that is a link to somewhere else (remove it by hand: there is no file to keep); with or without the option, a folder there.
  • heavy --self-check warns when the t3-capacity found on PATH is not this kit's: either it is missing, or a different copy comes first on PATH (for example a user's own wrapper). The warning does not change the exit code.
  • README: the Files table, the Install, Stops half-way and Rollback text, and the self-check row.

The release needs no new file: bin/t3-capacity was already in the release's source files. The #920 release test passes unchanged (ok release holds what the heavy kit's installer reads).

Why the kit's reading differs from an old copy

There are three things a caller can reach today, and they measure different things:

  • Kit (heavy facts): available= is the box's available memory less the hold of the reservation files (~/.config/t3-capacity/reserve.d). reserved= is the room that admitted work may still grow into: each running T3 agent counted as a writer (768 MB start cost minus what it uses now), machine-file holds, plus that same reservation hold again. So the hold is inside both numbers: do not compute available − reserved, that subtracts the hold twice. free= is the kit's own answer and is right. The answer is OK only when free covers the request and the level is ok.
  • The old plain copy (the host's installed file, run directly): reads no reservation files and does not count agents. Its reserved= is only the growth room of other busy budgets (the heavy slice, fork runners, the CI-light slice), 0MB when they are idle. Instead it checks box memory pressure (PSI), a soft cap, and load above 1.5× the core count.
  • A user's own wrapper in front of it on PATH (one host has one): reads the reservation files, prints reservations: …(available below is after these), lowers available= by their hold, and then runs the plain copy. It still does not count agents.

Readings on one machine, each row pair at the same moment, with one 1536 MB reservation holding all 1536 MB. The kit is this branch's bin/t3-capacity run from the source folder (A to C: from a test-prefix install), next to the plain copy run directly, and in E also the wrapper:

run need command available reserved free answer
A 3072 MB kit 7900 MB 6763 MB 1392 MB NOT OK: level severe
A 3072 MB plain copy 9438 MB 0 MB (not shown) NOT OK: box memory pressure
B 1536 MB kit 6076 MB 6327 MB −22 MB NOT OK: level severe
B 1536 MB plain copy 7619 MB 0 MB (not shown) NOT OK: load above 1.5× cores, box pressure
C 1536 MB kit 7811 MB 5909 MB 2123 MB NOT OK: level severe
C 1536 MB plain copy 9326 MB 0 MB (not shown) NOT OK: load above 1.5× cores, box pressure
D 1536 MB kit 5780 MB 7507 MB −1503 MB NOT OK: 1503 MB short (level ok)
D 1536 MB plain copy 7316 MB 0 MB (not shown) OK
E 1536 MB kit 4358 MB 7561 MB −2969 MB NOT OK: short, level elevated
E 1536 MB wrapper 4343 MB 0 MB (not shown) NOT OK: box soft cap
E 1536 MB plain copy 5857 MB 0 MB (not shown) NOT OK: box soft cap

What the readings show:

  • The kit's available= is about 1.5 GB below the plain copy's in every run (1538, 1543, 1515, 1536, 1499 MB): that is the reservation hold, not a different source. Against the wrapper, which also takes the hold off, it is the same within the time between the two reads (E: 4358 vs 4343 MB).
  • Only run D shows a different answer: the plain copy said OK and the kit said NOT OK, because the kit counts the room 12 running agents may still grow into (reserved= less the hold: about 6 GB). The wrapper was not read at that moment. In A, B, C and E both said NOT OK, for different reasons.

Kit line from D:

available=5780MB swapfree=2094MB load=5.65/12cores agents=12 jobs=0 waiting=0 reserved=7507MB need=1536MB free=-1503MB level=ok tier=full
NOT OK: 1536 MB (-1503 MB free, 1536 MB needed, level ok)

Plain copy line from D (first line shortened):

available=7316MB swapfree=2094MB load=5.65/12cores java=0 agent-sessions=12 heavy-slice=2247MB/6144MB fork-slice=51MB/6144MB reserved=0MB need=1536MB box=heavy.slice ...
OK

Does any number get worse for agents? Yes, it gets stricter (run D): with many agents running, the kit holds back their unused room, so a request the old copy allowed can be refused. In return, the kit does not refuse on load alone, and it does not read the old copy's box pressure or soft-cap checks, T3_CAPACITY_BOX, or the CI-light slice. The first line also loses the old copy's extra fields (java=, agent-sessions=, heavy-slice=, fork-slice=, box…=). The answer stays exit 0 = OK / exit 1 = NOT OK. A separate double count inside the kit (an agent working under a reserved folder is held both as an agent and by the reservation) is #923, not this PR.

Consumer part of #919 (step 2, not in this PR)

What a consumer whose installer writes its own /usr/local/bin/t3-capacity must change in its own repo:

  1. Its installer: stop writing t3-capacity to /usr/local/bin. Instead, run heavy-install --replace-t3-capacity once, which keeps the old file in /usr/local/libexec/heavy-kept/ and links the kit's, or check that /usr/local/bin/t3-capacity resolves into /usr/local/libexec/heavy/current/. Never cp, install or mv onto the path:
    • cp writes through the link into the release folder;
    • an install/mv of a renamed copy puts a plain copy back.
  2. CI steps that grep the installed file (for a LIGHT= slice line) must read that fact elsewhere, for example from the kit's config or the machine file, because the kit's script has no such line.
  3. A build-slot helper that compares the installed copy with the repo copy (and gives one slot until they match) must compare against the kit release instead, or stop comparing. Otherwise it stays on one slot forever.
  4. Callers that set T3_CAPACITY_BOX, or rely on the CI-light box or load checks, lose those checks. Move the holds into the machine file's heavy.capacity.holds, or keep a separate check in the consumer.
  5. Readers of the extra first-line fields listed above must switch to heavy facts or the kit's fields.
  6. Steps that write the consumer's own copy next to a helper (not to /usr/local/bin) are not affected.

State answers

  • Runs again: the link already points into current, so nothing changes. A test snapshots the whole prefix before and after a second run, with and without the option, and with a foreign link left alone.
  • Stops half-way: every install step was stopped and then run again (test_every_stop_half_way_then_run_again, with an old t3-capacity and the option). The old command keeps working until the links step, when it is swapped in one rename (a temp link renamed over the path). After the rerun there is exactly one kept copy and the link. Another test makes the t3-capacity swap itself fail: the old command still runs, and the next run finishes the job.
  • Old or empty state:
    • nothing there: the link is made;
    • our link (also a broken one left by an older uninstall): kept;
    • a plain file without the option: left alone, with a note and a WARNING in the closing line;
    • a plain file with the option: kept in heavy-kept/ and linked;
    • a link elsewhere without the option: left alone, with the same note and warning, no installed.tsv row;
    • a link elsewhere with the option, or a folder: refused before anything is written.
  • Rollback:
    • uninstall puts the newest kept copy back only if the path is empty, then removes heavy-kept/ (it stays, with a note, if something else is at the path);
    • rolling current back to a release from before this PR leaves the link pointing at that release's bin/t3-capacity, which exists in every release;
    • an older installer's uninstall (every release up to ci/v22) deletes /usr/local/libexec/heavy and /etc/heavy whole, so the kept copy lives outside both and survives. That uninstall does not know the t3-capacity link and leaves it broken (gates then fail with 127); running this release's sbin/heavy-install uninstall from its source folder removes the broken link and puts the copy back (README, Rollback). Tested with ci/v22's own installer, taken from git: install with this branch and the option, ci/v22's install and uninstall on the same prefix, then this uninstall restores the original bytes.

Tests

First round, without the change (main's kit plus that round's test file): Ran 22 tests ... FAILED (failures=16, errors=1). Every new test failed, and so did every step of the stop-half-way test. The 15 tests that already existed passed.

Fix round 1 (review comment on 975cdef), each new check run against 975cdef with this round's test file:

  • kept copy survives an older uninstall (test_older_installers_install_and_uninstall_keep_the_hosts_t3_capacity, runs ci/v22's own heavy-install from git archive; it skips with a message in a checkout without the tag, such as CI's shallow clone): at 975cdef (folder name only aliased) it fails with FileNotFoundError: .../usr/local/libexec/heavy/replaced-capacity right after ci/v22's uninstall, i.e. the copy was deleted. Now it passes, and this release's uninstall puts the original bytes back.
  • same deletes without git (test_kept_t3_capacity_is_outside_every_folder_an_uninstall_deletes, runs everywhere, CI too): at 975cdef AssertionError: True is not false : /usr/local/libexec/heavy (the kept folder is inside it).
  • foreign link without the option is left alone (test_foreign_t3_capacity_link_is_left_alone_without_the_option): at 975cdef 1 != 0 : ... /usr/local/bin/t3-capacity exists and is not the kit's link.
  • closing-line warning (added to test_old_plain_t3_capacity_is_left_alone_without_the_option): at 975cdef "WARNING: /usr/local/bin/t3-capacity is still the host's own, not the kit's (--replace-t3-capacity switches it)" not found in 'heavy-install: installed release aaaa…: slice heavy.slice, grace 30s'.
  • The refusal test now covers a foreign link with the option and a folder with and without it.

Tests in fork-kit/heavy/tests/install.test.py for this PR:

  • fresh install links t3-capacity to the release
  • a plain old copy is left alone without the option, with a note and the closing-line warning
  • with the option, a plain old copy is kept and linked, a rerun without the option changes nothing, and uninstall puts it back and removes heavy-kept/
  • the kept copy is outside every folder an uninstall deletes; after those deletes this uninstall restores it
  • ci/v22's install and uninstall over this state keep the copy; this uninstall restores it
  • the t3-capacity swap fails: the old command still works, and running again fixes it
  • a foreign link without the option is left alone (note, warning, no row, rerun changes nothing, uninstall leaves it)
  • a foreign link with the option, or a folder, is refused before anything is written
  • self-check warns when t3-capacity on PATH is not the kit's
  • the stop-half-way test also covers t3-capacity

At the new head, all through heavy:

  • install.test.py 25 OK (the ci/v22 test ran, not skipped)
  • heavy.test.py 68 OK (55 skipped on this machine, as before)
  • .github/scripts/fork-ci-release.test.py: all passed, 86 ok
  • seam check (fork-seam-check.cjs --config-ref origin/main origin/main HEAD): exit 0
  • vp fmt --check fork-kit/heavy/README.md: clean
  • First round only (files not changed since): facts 57 OK, capacity_rule 12 OK, queue 70 OK, measure 47 OK, sweep 82 OK (1 skipped)

General vs project

  • General (this PR): the kit links its own t3-capacity, keeps any old copy outside the folders any uninstall deletes, replaces a host's own copy only when told, and the self-check warns when a different copy is on PATH. Nothing here names a project, path or machine. The kit's install folder, the option and the backup folder are the same for every user.
  • Project: a consumer's own installer and CI (the list above) change in that consumer's repo. No project facts were added to the fork.

Part of #919. This PR is the fork part (steps 1 and 3). Step 2, the consumer part, is the list above.

🤖 Generated with Claude Code

scuttletoby and others added 2 commits November 22, 2026 09:18
…n another (#919)

heavy-install now also links /usr/local/bin/t3-capacity to
current/bin/t3-capacity, so the command has one source: the release in
use. A plain old file there (a host's own copy) is kept in
/usr/local/libexec/heavy/replaced-capacity/ (not replaced/: an older
installer's uninstall restores the newest file of replaced/ as heavy) and
stays in place until its link replaces it in one rename; uninstall puts it
back. A link elsewhere or a folder there is refused before anything is
written. heavy --self-check warns when the t3-capacity found on PATH is
not this kit's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-replace-t3-capacity

A host's installer may write its own t3-capacity to /usr/local/bin and its
scripts may read or compare that file, so the installer now leaves such a
plain file alone (with a note, and no installed.tsv row for it) unless it is
run with --replace-t3-capacity. With nothing there, or the kit's link, it
links as before; once linked, later runs keep the link without the option.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: lens agent (Opus) · read at: 975cdef
covered: the whole diff (sbin/heavy-install, bin/heavy capacity_on_path, README, tests/install.test.py), #919 and its comment, ci/v22's heavy-install (install and uninstall), bin/t3-capacity, lib/heavy_facts.py (reservations, pieces, answer) and lib/capacity_rule.py (_read_facts, decision)
checks: ran through heavy at this head: tests/install.test.py 22 OK, tests/heavy.test.py 68 OK (55 skipped here, so the self-check warning test path was read, not run), .github/scripts/fork-ci-release.test.py 86 ok; read ci/v22 sbin/heavy-install install() and uninstall() against this state (not run: this lens may run only the listed tests); compared the live output of a host's old plain copy
state: runs again: no change (the link is ours; checked by the snapshot test); stops half-way: the old file is copied to its folder first and the link renamed over it in one step, a rerun finishes (tested at every step); old/empty state: nothing there or a dangling link to current/bin/t3-capacity is linked, a plain file is left alone (or kept and linked with the option), a foreign link or a folder refuses the whole install before writing; upgrades: the link names current/bin/t3-capacity, so it follows every new release; rollback to an older installer: its install leaves the link (its release has bin/t3-capacity) and replaced-capacity/, but its uninstall deletes replaced-capacity/ (major below)

blocker: none
major: an older installer's uninstall loses the host's own t3-capacity. REPLACED_CAPACITY is inside /usr/local/libexec/heavy (sbin/heavy-install:39), and ci/v22's uninstall() ends with shutil.rmtree of /usr/local/libexec/heavy and /etc/heavy without restoring anything from replaced-capacity/ and without removing the t3-capacity link (it only knows the heavy and heavy-install links). So after --replace-t3-capacity, a rollback with the older installer followed by its uninstall (the path the README's Rollback bullet allows, README.md:717) deletes the only kept copy and leaves /usr/local/bin/t3-capacity a dangling link: every t3-capacity N && cmd gate then fails with 127 until someone reinstalls, and the host's copy is gone for good. The PR body says the opposite ("an older installer's uninstall ... never touches replaced-capacity/"), and no test runs an older installer against this one's state. Fix: keep the copy outside both folders an older uninstall removes (for example /usr/local/libexec/heavy-kept/t3-capacity.<sha>, checked as a folder in check_old_state), add a test that installs with the option, then runs main's heavy-install install and uninstall on the same prefix and checks the copy survives; and say in the README that an older uninstall leaves a dangling t3-capacity link (run this release's uninstall first, or reinstall)
minor: a link at /usr/local/bin/t3-capacity that is not exactly current/bin/t3-capacity refuses the whole install even without --replace-t3-capacity (sbin/heavy-install:260-269), while a plain file there is left alone. Until this PR the README told hosts to wire the command in themselves, so a host that linked it (to a version folder, to current by another spelling, or to its own script) can no longer upgrade heavy at all until someone removes the link by hand. Suggest: without the option, treat a non-kit link like a plain file (leave it, note it, no row); with the option, replace a link without keeping it (nothing to keep) or keep refusing
minor: the push to switch is weak, so hosts can stay on the old copy for good. Opt-in is the right call (#919 says "unless told", and consumer CI reads that exact file), but the only signals are one note: line in the install output and a WARNING: from heavy --self-check that keeps exit 0, and nothing runs heavy --self-check on a schedule. Suggest: repeat it in the closing installed release ... line ("t3-capacity: the host's own copy, not the kit's"), and track consumer step 2 in its own issue so the switch has an owner
minor: PR body, "Why the kit's reading differs": the old consumer copy does read reservation files (on a host running it now its output starts reservations: <name>:1536MB(using 0,holding 1536) (available below is after these)), so "does not count agents or reservation files at all" is wrong for reservations, and the lower kit available= is not "a different source" alone: bin/t3-capacity:51 prints available less the whole hold, while reserved= is owed plus that same hold (lib/heavy_facts.py:491). A reader who computes available − reserved subtracts the hold twice; free= itself is right. In all three runs both commands said NOT OK, the kit for level severe, so the table shows no request the kit refuses and the old copy admits; the "stricter" claim stands from the code, not from these readings
minor: double count in the kit (not in this diff, but this PR is what moves hosts onto it): an agent scope whose working folder is under a reserve.d folder is a writer piece owing 768 MB less its use (lib/capacity_rule.py:345-346), and the same reservation still holds its MB less the use of every process in the folder (lib/heavy_facts.py:162-197). A project reservation meant to cover that project's agents, servers and builds then holds the agents' unused room a second time, up to the smaller of their owed room and the reservation's hold (with one idle 300 MB agent and a 1536 MB reservation: 468 + 1236 = 1704 MB held, against 1536 meant); a heavy job started in the folder is held twice the same way while it starts. Other callers are then refused by up to the reservation's size too early; the caller's own folder is excluded, so the project's own agents are not. Not a merge stop because the switch is opt-in, but it should get its own issue and a fix (a reservation's hold less the owed room of the pieces working in its folder) before a host with reservations runs --replace-t3-capacity

…tall deletes

- The kept copy moves to /usr/local/libexec/heavy-kept/: every released uninstall
  (ci/v6 to ci/v22) deletes /usr/local/libexec/heavy and /etc/heavy whole, so a copy
  kept inside them was lost. This release's uninstall puts it back (also after an
  older uninstall left the t3-capacity link broken) and then removes the folder.
- A link at /usr/local/bin/t3-capacity that the kit did not make is left alone with
  a note when --replace-t3-capacity is not given (refused with it, as before).
- The closing install line repeats that the host still uses its own t3-capacity.
- Tests: an older release's install and uninstall (ci/v22, from git) over this
  state; the same deletes without git; a foreign link; the closing-line warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code r2 · reviewer: lens agent (Opus) · read at: ca97789
verdict: not safe to merge
covered: the fix diff 975cdef..ca97789 (sbin/heavy-install, README, tests/install.test.py) and the whole PR diff again (bin/heavy capacity_on_path); the uninstall() of every released installer (ci/v6 to ci/v22); which releases ship bin/t3-capacity; bin/t3-capacity and lib/heavy_facts.py free/reserved/hold (for the PR body numbers); this head's CI jobs
checks: through heavy at this head: tests/install.test.py 25 OK (the ci/v22 test ran here, not skipped), tests/heavy.test.py 68 OK (55 skipped here), .github/scripts/fork-ci-release.test.py 86 ok; this head's test file against 975cdef's installer: FAILED (failures=3, errors=13), so the new tests fail on the round-1 code; recomputed the PR body table (kit available is 1538/1543/1515/1536/1499 MB below the plain copy; D reserved less the hold is 5971 MB; free = available - reserved + hold - margin, so free is not available - reserved, as the body says)
state: runs again: a second --replace-t3-capacity after the copy is kept finds the kit's link, keep_old skips a link and switch_link does nothing (snapshot test); a foreign link without the option is left alone each run (snapshot test). Stops half-way: a crash after keep_old leaves the kept copy and the plain file; a rerun with the option finds the same hash and only links (tested), a rerun without it leaves the file (note and WARNING), and uninstall then removes heavy-kept/ because the file there equals the kept copy. Old state: an older installer's install over this state leaves the link to current/bin/t3-capacity (ci/v21 and ci/v22 ship that file), its uninstall deletes only /usr/local/libexec/heavy and /etc/heavy (checked in all 17 released installers), so heavy-kept/ survives, and this release's uninstall from its source folder removes the broken link, puts the bytes back and removes heavy-kept/ (tested with ci/v22's own code). heavy-kept/ from a crashed run: a stale t3-capacity..tmp is overwritten by the next keep_old and ignored by uninstall. Empty state: nothing there is linked; uninstall with nothing kept removes only the link
round 1, fixed: the kept copy is now /usr/local/libexec/heavy-kept/, outside both folders every released uninstall deletes, and two tests cover it (one runs ci/v22's installer)
round 1, fixed: a link elsewhere without the option is left alone with a note, the closing WARNING and no installed.tsv row; with the option it is refused before anything is written (tested)
round 1, fixed: the closing installed release line now carries the WARNING while the host's own t3-capacity is in place (tested)
round 1, fixed: the PR body now says the wrapper reads reservations, explains the hold inside both available= and reserved=, and adds run D where the plain copy says OK and the kit says NOT OK; the numbers check out
blocker: none
major: this head's CI is red because of the new test: "Fork kit tests 2" fails with install.test.py skipped Install.test_older_installers_install_and_uninstall_keep_the_hosts_t3_capacity, which it does not declare, since CI's shallow clone has no ci/v22 tag and the job refuses an undeclared skip; fork-ci-result is failure. Fix: add a whole-line # fork-ci: may skip Install.test_older_installers_install_and_uninstall_keep_the_hosts_t3_capacity near the top of fork-kit/heavy/tests/install.test.py (as .github/scripts/fork-fleet.test.py:7 does), or fetch that tag in the job so the test runs; the no-git test test_kept_t3_capacity_is_outside_every_folder_an_uninstall_deletes still covers the deletes in CI
minor: uninstall unlinks the t3-capacity link (sbin/heavy-install:441-443) and only then copies the kept file back (sbin/heavy-install:449-453), so for that moment t3-capacity is missing, and a crash between leaves it missing (gates fail 127) until uninstall runs again. Renaming the restored copy over the link in one step would close it. Follow-up
minor: the uninstall branch that leaves heavy-kept/ in place because a different file is at the path (sbin/heavy-install:454-459) has no test, and a heavy-kept/ that holds only a crashed .tmp is never removed (no backups, so the branch does not run). Follow-up
minor: rolling back to ci/v20 or older (no bin/t3-capacity in those releases) leaves the link broken right away; the README Rollback text says to uninstall first, which is enough. A note in the closing line or self-check when current/bin/t3-capacity is missing would make it visible. Follow-up
minor: the PR body ends with "Fixes #919" while consumer step 2 stays open, so merging closes the issue that tracks step 2. Use "Part of #919", or open its own issue for step 2 first (as round 1 suggested). Follow-up

…checkout

CI's clone has no ci/v22 tag, so the test skips there; fork-ci refuses an
undeclared skip (round-2 code lens on #922).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby

Copy link
Copy Markdown
Owner Author

Round-2 review handled:

This was the second lens round, so the PR merges once CI is green.

🤖 Generated with Claude Code

@scuttletoby
scuttletoby merged commit f2ad5ed into main Nov 22, 2026
30 checks passed
scuttletoby added a commit that referenced this pull request Nov 28, 2026
…n another (#919) (#922)

* heavy-install: link t3-capacity to the kit's copy; self-check warns on another (#919)

heavy-install now also links /usr/local/bin/t3-capacity to
current/bin/t3-capacity, so the command has one source: the release in
use. A plain old file there (a host's own copy) is kept in
/usr/local/libexec/heavy/replaced-capacity/ (not replaced/: an older
installer's uninstall restores the newest file of replaced/ as heavy) and
stays in place until its link replaces it in one rename; uninstall puts it
back. A link elsewhere or a folder there is refused before anything is
written. heavy --self-check warns when the t3-capacity found on PATH is
not this kit's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* heavy-install: a host's own plain t3-capacity is replaced only with --replace-t3-capacity

A host's installer may write its own t3-capacity to /usr/local/bin and its
scripts may read or compare that file, so the installer now leaves such a
plain file alone (with a note, and no installed.tsv row for it) unless it is
run with --replace-t3-capacity. With nothing there, or the kit's link, it
links as before; once linked, later runs keep the link without the option.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* heavy-install: keep a host's t3-capacity outside the folders an uninstall deletes

- The kept copy moves to /usr/local/libexec/heavy-kept/: every released uninstall
  (ci/v6 to ci/v22) deletes /usr/local/libexec/heavy and /etc/heavy whole, so a copy
  kept inside them was lost. This release's uninstall puts it back (also after an
  older uninstall left the t3-capacity link broken) and then removes the folder.
- A link at /usr/local/bin/t3-capacity that the kit did not make is left alone with
  a note when --replace-t3-capacity is not given (refused with it, as before).
- The closing install line repeats that the host still uses its own t3-capacity.
- Tests: an older release's install and uninstall (ci/v22, from git) over this
  state; the same deletes without git; a foreign link; the closing-line warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* heavy tests: declare the older-installer test's skip in CI's shallow checkout

CI's clone has no ci/v22 tag, so the test skips there; fork-ci refuses an
undeclared skip (round-2 code lens on #922).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-contracts: pin the heavy install test's declared CI skip in MAY_SKIP

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 28, 2026
…n another (#919) (#922)

* heavy-install: link t3-capacity to the kit's copy; self-check warns on another (#919)

heavy-install now also links /usr/local/bin/t3-capacity to
current/bin/t3-capacity, so the command has one source: the release in
use. A plain old file there (a host's own copy) is kept in
/usr/local/libexec/heavy/replaced-capacity/ (not replaced/: an older
installer's uninstall restores the newest file of replaced/ as heavy) and
stays in place until its link replaces it in one rename; uninstall puts it
back. A link elsewhere or a folder there is refused before anything is
written. heavy --self-check warns when the t3-capacity found on PATH is
not this kit's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* heavy-install: a host's own plain t3-capacity is replaced only with --replace-t3-capacity

A host's installer may write its own t3-capacity to /usr/local/bin and its
scripts may read or compare that file, so the installer now leaves such a
plain file alone (with a note, and no installed.tsv row for it) unless it is
run with --replace-t3-capacity. With nothing there, or the kit's link, it
links as before; once linked, later runs keep the link without the option.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* heavy-install: keep a host's t3-capacity outside the folders an uninstall deletes

- The kept copy moves to /usr/local/libexec/heavy-kept/: every released uninstall
  (ci/v6 to ci/v22) deletes /usr/local/libexec/heavy and /etc/heavy whole, so a copy
  kept inside them was lost. This release's uninstall puts it back (also after an
  older uninstall left the t3-capacity link broken) and then removes the folder.
- A link at /usr/local/bin/t3-capacity that the kit did not make is left alone with
  a note when --replace-t3-capacity is not given (refused with it, as before).
- The closing install line repeats that the host still uses its own t3-capacity.
- Tests: an older release's install and uninstall (ci/v22, from git) over this
  state; the same deletes without git; a foreign link; the closing-line warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* heavy tests: declare the older-installer test's skip in CI's shallow checkout

CI's clone has no ci/v22 tag, so the test skips there; fork-ci refuses an
undeclared skip (round-2 code lens on #922).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-contracts: pin the heavy install test's declared CI skip in MAY_SKIP

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@scuttletoby
scuttletoby deleted the fork/heavy-t3-capacity-link branch November 29, 2026 20:12
scuttletoby added a commit that referenced this pull request Nov 30, 2026
… its timer (#1157 phase 2b) (#1188)

* Model policy: an effort must be under the id the row's driver reads, on both sides of a link (#780) (#793)

* Model policy: an effort must be under the id the row's driver reads, on both sides of a link (#780)

A pick whose effort sat only under an id the running driver does not read
(an ACP `thought_level` for a Claude row, `reasoning` for Claude, `effort`
for an ACP agent) counted as naming an effort, so the driver ran its own
default level unchecked. Each row with efforts now needs the effort under
its driver's own id: the fixed id of a built-in driver, else the control
the checking machine's own catalog marks for the model on that driver's
instances. A driver whose id is not known there refuses (fail closed).
The receiving machine checks a linked agent's pick with its own catalog;
the sending machine checks every row's driver with its catalog.

Minors: a remote pick reads a catalog's ultracode default both ways and
gets the full-id alias hint; Settings reads each machine's lists apart,
flags names Claude Code resolves by itself, and reads an instance's
catalog effort control for its marks; tests for "an id is never an
alias"; a stale test comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Model policy: refuse an option the policy cannot read, keep the guard's driver ids in step (#793 review)

- While a policy is on, a pick may name only options this machine's model list
  describes for the model (the instance's list; any list here for a call sent to
  a linked machine), effort ids the policy reads, or ultracode. A driver can still
  apply any other option after the checked ones: Kiro's effortLevel, Grok's native
  thought_level, an ACP agent's hidden _t3/session-mode, or a model option written
  after the model. Enforce refuses it with the fix; advise reports it.
- The "effort id not known here" refusal now says how to fix it (and drops the
  "a acpRegistry" typo).
- The model guard's sync test compares the server's driver effort ids with the
  guard's DRIVER_EFFORT_IDS entry for entry, both ways.
- Docs: the "a second effort option cannot hide a higher effort" sentence is now
  true, and says how.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the Codex MCP profile lines (MCP profiles part 5, step 1) (#801)

Announces the two lines in CodexAdapterV2.ts that wrap its app-server
client factory with apps/server/src/fork/codexMcpProfile.ts. No code.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the tool_search filter lines (MCP profile design PR 4, step 1) (#806)

Step 1 of "Adding a seam line" in docs/fork/updates.md: the list only,
no code. A new entry for apps/server/src/mcp/McpToolExposure.ts with
"added": [] and two announced lines: the import of searchableT3Tool from
fork/mcpT3ToolFilter.ts, and one .filter(searchableT3Tool) step in
tool_search's ranking chain. The code follows on its own branch.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the unsigned macOS ad-hoc signing line (#822, step 1) (#832)

List only. Announces the one scripts/build-desktop-artifact.ts line that sets identity "-" and the
sign hook scripts/fork-codesign.cjs for macOS builds without signing secrets; the pull request
that closes #822 adds it.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(server): a child that already exited keeps its exit code when its stdin write breaks (#840)

The process runner writes a program's stdin while the program starts. A program that exits at
once (the handoff's missing program under `timeout` exits 127) can close the pipe before that
write, which then fails with EPIPE. The runner reported that as a stdin error ("its output could
not be read") and dropped the exit code, so the handoff test failed in a few CI runs of a hundred.

A broken pipe on stdin is now ignored: the exit code and output say how the program ended. Any
other stdin error is still an error. The check lives in fork/processRunnerFork.ts, with the fork's
output-tail collector moved there too, so processRunner.ts's pending ceiling drops from 35 to 8.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* placement P2: placement and placementNeeds setting contracts (#798)

* fork placement P2: placement and placementNeeds setting contracts

`placement` (mode off/advise/enforce, labels, factsCommand, never groups,
weights per linked machine) and `placementNeeds` (server value, and a
project override), added the way the fork's other settings are: fields,
patch fields, patch rules and pin rows in forkSettings.ts/forkDefaults.ts.

- An old or empty settings file reads as off with no needs.
- A bad placement value reads as off with the reason in `problem`; the
  person's text is kept in `unreadable` and written back until the key
  is saved (as modelPolicy). The rest of the file still loads.
- A save is strict (bad field or unknown key refused); a field left out
  keeps its value; a save over a kept unreadable value starts from off.
- Both keys are person-only (derived); a project's needs are kept when an
  older client's save leaves them out, and only null clears them.
- A managed policy locks placement as a whole value.

Contracts only: nothing reads the settings yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork placement P2: fail closed on bad placementNeeds, whole saves over bad placement

- A bad placementNeeds (server or project) now reads as broken: the work fits
  no machine (readPlacementNeeds gives the plain reason), the problem is kept,
  and the person's text is written back unchanged by other saves until the
  key is saved. A project save may send the kept text back only unchanged.
- Over an unreadable placement, a save that names only some fields is
  refused ("placement is not valid; save the whole setting"); a whole save
  replaces it.
- factsCommand must be a full path on the server's OS (playtest's check):
  a save of another OS's path is refused, and one in the file reads as off,
  kept, with its problem. Control characters are refused.
- Labels are stored trimmed, lower-cased and without repeats (so
  ["GPU", "gpu"] is no never group); weight keys with spaces are refused.
- Tests for each, a policy lock row for placementNeeds, and the docs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork placement P2: read factsCommand on this OS where placing reads it

The load and normalize lines added to upstream's serverSettings.ts are
gone (no pinned seam line runs after a save's normalize, so the same
result could not go through one). Placement code now reads placement
through apps/server/src/fork/placementRead.ts (readPlacementForThisOs):
a factsCommand this OS cannot run reads as off, kept as written, with
its problem. The save check that refuses setting one stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork placement P2: manage placement and placementNeeds only as a whole

Main now names the fork settings that read null in one list (WHOLE_ONLY), and
the pin test requires it to match exactly. Both placement settings read a bad
value, null included, as off/unset, so both join the list: a policy locks
placement as a whole, a path inside it is refused, and the manageable-settings
list shows placement as one path instead of its fields.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork placement P2: type the server's placementNeeds patch as the settings hold it

The web settings code builds a save from part of the settings, so a held
placementNeeds value (a kept bad value included) must fit the patch type.
The patch field was typed as plain labels, which broke the web typecheck.
PlacementNeedsPatch is now typed as PlacementNeeds while its decode stays
strict: only labels are taken, and a save replaces a kept bad value whole.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork test: read the MCP profile record at once in the scheduled-task tests

A webhook run is forked and reads the record file, and these tests give
forked work a fixed number of event-loop turns. On a loaded machine a read
on Node's thread pool can outlast them ("never: the owner's task ran"), on
main as well as on branches. The service in these tests now reads whole
files synchronously, so a run takes the same number of turns on any machine.
With the thread pool kept busy the test failed before and passes now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork placement P2: check only placementNeeds in the patch-type test

Since the merge of main, a whole Partial<ServerSettings> no longer fits a
patch (another field is nullable in settings only). The test checks the
placementNeeds field it is about.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* feat(playtest): the playtest MCP tool (start, push, status, end) (#809)

* feat(playtest): add the playtest MCP tool (start, push, status, end)

One tool in the waits toolkit over the playtest service. The thread is the
caller's own, from its MCP credential; the tool takes no thread and no
setting. Refusals (playtest off, busy, no session) come from the service
with what to do next. Docs: playtest.md gains the tool section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(fork): list the playtest tool in FORK_CHANGES (#809)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(playtest): own tool group; start and push need a full-access thread (#809)

- `playtest` is its own MCP tool group (MCP_T3_TOOL_GROUPS gains "playtest";
  MCP_T3_TOOL_OWN_GROUPS pins the tool in the waits toolkit to it), so a
  profile that keeps `waits` does not get it. Test: every T3 tool is in
  exactly one known group, and playtest alone in its own.
- `start` and `push` refuse a thread that is not full-access or is in plan
  mode, by the thread's modes as the server records them at each call.
  `status` and `end` stay open, so a restricted thread can release its target.
- Status tells the agent to call end for a claim cut off by a stop and for a
  release that has not worked yet.
- The waits tools share one calling-thread helper.
- `start` joins the unknown thread-argument test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork: report a linked child's pending prompts to its parent (#808 row 1) (#815)

* fork: report a linked child's pending prompts to its parent (#808 row 1)

A delegated task on a linked machine always reported
hasPendingQuestion false and pendingApproval null, so its parent never
learned the child was waiting.

- New fork route GET /api/fork/task-prompts on each machine: the open
  questions, approval and secret requests (label and reason only, never
  a value) of one of its threads. Link token only.
- task_status, delegate_task and their waits read it over the existing
  link through the fork seat remotePrompts (one spread line in the
  remote read). An unreachable or older machine reads as unknown in
  next, never as "not waiting".
- A watcher wakes the parent once per prompt, the way a local child's
  question does: it ends a blocking wait if there is one, else it queues
  one wake message, and cancels that message if the prompt is answered
  there first. Wake ids are fixed, so a restart sends no second wake.
- OrchestratorMcpService.ts is a pending file and may not gain a fork
  line: the Effect.scoped comment moves onto the (already fork) line it
  explains, which frees the line the seat takes. Still 35 fork lines.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* FORK_CHANGES: link #815

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork: quote a remote child's words; a wait has a prompt only while its run lasts (#815 fix round)

- Text and ids from the linked machine: ids only on a strict pattern (else
  unknown, "refused"), at most 50 prompts, a secret's label and reason
  folded to one line, capped (80/300) and quoted as the child's words.
- A secret never goes to a blocking wait; it is always a queued message.
  A question or approval handed to a wait counts only while the parent's
  run lasts; after it, one message if it is still open there.
- The receipt of a sent wake is read before a slot is taken; a machine
  that does not answer is asked once per round; "older" also names a link
  no longer accepted.
- The remote read's spread line carries its // Fork: marker (no new line).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* host tools: per-OS path layer (real-path resolve, Windows and macOS oddities) (#816)

* host tools: per-OS path layer (real-path resolve, Windows and macOS oddities)

resolveHostPath(input, {platform, fs}) follows every link, junction and
mount point to the real target and returns that path plus the compare key
the policy core will match reach kinds and secret patterns against, or a
plain refusal. Platform and file-system calls are injected, so the Windows,
macOS and Linux cases all run on any CI machine; nodeHostPathFs is the thin
real adapter. Nothing is wired yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* host tools path layer: fix round for both lenses

- Map macOS firmlinks on the walked path and on the OS answer; full list.
- Refuse /.vol, /dev, Linux /proc, /sys, the document portal, and devices,
  pipes and sockets.
- Add secretKey, always folded (full case map, NFKC, ignorables dropped);
  compareKey stays exact per OS.
- Cross-check the walk with the native realpath and refuse a different answer.
- Win32 collapses typed ".." first; cap the walk at 4096 steps.
- Header states the contract for 1.2 and 1.4.
- Tests: an independent fake file system, a regex case-fold oracle, state
  cases, real-adapter checks, and Windows/macOS tests skipped elsewhere.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* test(cleaner): one clock for report test stamps, so a mark's line stays the same (#819)

The report's mark names the last counted log line by its exact text. Three
Freed tests wrote the log twice and rebuilt an already-counted line with a
fresh stamp; when the clock crossed a second between the two, that line no
longer matched the mark, the report treated the log as trimmed and counted
the old delete again ("at least 5.0 GB (2 deletes)").

The real log is append-only, so the report code is right; the tests now
build each line once and reuse it, and stamp() reads one clock for the run.
Forcing a second boundary (time.time() moving one second per call) fails
the three old tests every time and passes the new file.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* heavy facts: per-kind fits from the kernel ledger; kit capacity evaluator and callers (#786)

* heavy facts: per-kind fits from the kernel ledger; kit capacity evaluator and callers

Dynamic slots design row D6. The kit gets a Python evaluator of the shared
capacity rule (lib/capacity_rule.py) that passes every vector and format case
the TypeScript tests read, and `heavy facts [--kind K] [--mb N]`: one free/v1
object with per-kind "fits" from a ledger read from the kernel (heavy's live
tickets plus T3's agent scopes, unlabelled = writer), a 5 s cache, the Basic
tier, unreadable signals as elevated, and per-folder reservations.
bin/t3-capacity and bin/agent-slots are thin callers of it that keep the older
output and exit codes; a facts call that is slow (5 s) or fails is never free.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* heavy facts: every ticket is a job, folders match exactly, basic tier and other users fail closed

Fix round for the two D6 reviews.

- A heavy ticket whose kind the rule does not know (tsc, gradle, a project's
  own) is the rule's unknownKinds.job, never an agent; heavy facts --kind
  with an unknown name asks for that job too.
- A reservation folder matches itself and what is below it, with or without
  a trailing '/', never a sibling sharing its first letters; its real path
  matches too. The caller's own folder is its real working folder only.
- Basic tier (no cgroup v2 or no user manager) is never free and fits 0.
  Full tier also counts every other user's heavy jobs and agent scopes
  from their user managers' cgroups; a folder that cannot be listed is
  basic. Without a cache folder every call starts "elevated".
- lib/capacity_readings.py: the shared reader's port. It runs every
  capacity-readings.json case and the "a failed reading never admits more"
  check; memory, PSI, cores and container limits now come from it, a box
  with a live piece but no folder is unreadable, a cut-short memory.stat
  owes in full.
- The cache has version 2 and a key of its settings; t3-capacity takes the
  rule's whole hold; a fill count of 2.5 asks three times, as in TypeScript.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* heavy facts: kit tests check out the capacity rule; its JSON names no kit path

The heavy kit's evaluator, its tests and heavy-install read the capacity rule
from its one source, packages/shared/src/capacity, but the sparse checkouts of
the workflows, action_tests and kit_tests jobs left that folder out, so
install.test.py and facts.test.py found no capacity-rule.json. The folder is
now in the three lists (and in the `workflows` comment that says why each app
file is there).

The "//" notes of capacity-rule.json and capacity-readings.json named the
kit's Python files, which the fork-owned-reads lint counts as app code reading
a fork-owned path; they now point to README.md beside them, which names them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the thread menu's MCP profile lines (MCP profile design PR 3, step 1); also restores the HO5 announcement lost in #777 (#807)

* fork seams: announce the thread menu's MCP profile lines (MCP profile design PR 3, step 1)

List only. The thread menu gets the MCP profile entry: the thread's
effective profile, and the owner's pick or clear for a client that may
change settings. Its logic and runtime are fork files
(apps/web/src/components/fork/mcpProfile/); upstream's menu files need
four lines in threadActionMenu.logic.ts and three each in
useThreadActionMenu.ts and Sidebar.tsx, announced here. The code is on a
branch pushed without a pull request until this merges.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Fork seams: also restore the HO5 announcement lost in #777

The squash merge of #777 dropped every HO5 announced line from
.github/fork-seams.json. Restore them exactly as they were, inside the
same per-file entries as this PR's MCP profile lines (one key per file).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* handoff HO4: source `agent` (write turn, marker, cap, joined check) (#824)

* handoff HO4: source `agent` (write turn, marker, cap, joined check)

The old session gets one normal turn on its own thread with the
setting's instructions; its reply is part 2 of the handoff when the
turn completed, no other message joined it, the reply starts with the
marker line and is within the command source's 32 KB cap. A reply that
does not count falls back like the command source (size: parts 1, 3, 4;
idle: nothing). A stopped, failed, joined or timed-out write turn means
no handoff: the old session carries on. Fixed ids per source run, so a
run never writes or hands off twice; the write run is no turn end and
stays out of the transcript. Default stays off; no migration.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* handoff HO4 fix round: write turn never lost, stopped at its timeout, quiet

- A late update of the source run, or a restart, no longer drops part 2:
  any loop that finds a write turn as the latest run carries it on to its
  handoff (fixed ids, so at most once).
- A message steered into a write turn stays in later handoffs' part 3; only
  the write turn's prompt and marked reply are left out.
- A failed or timed-out write turn at the size backstop sends parts 1, 3
  and 4 (idle: nothing), as the command source does.
- Notes lines that could pass for the message's own lines are quoted.
- T3 stops a write turn at its timeout (run.interrupt, its own reason);
  after one such stop the next size handoff uses the fallback at once.
- A completed write turn is marked quiet, as the handoff run is.
- New source `none` is the default, so a saved handoff setting keeps its
  old behaviour; `agent` only when set.
- The last reply that starts with the marker is used.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* handoff command test: "could not start" without the stdin race

A missing program under `timeout` can exit before the empty stdin is
written, so the reason sometimes read as an output error. The case now
uses a spawn that fails (its project folder is gone); exit codes 126 and
127 stay covered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork-kit/gh-apps: call forms and GH_REPO check of the older per-user gh-as (#835)

* fork-kit/gh-apps: call forms and GH_REPO check of the older per-user gh-as

gh-as now also takes `gh-as NAME -- gh ...`, `--repo=`/`--app=` and `--help`, and refuses a GH_REPO in the
caller's environment that names another repository instead of silently ignoring it. New parity.test.py covers
these and the state cases: an expired, half-written or empty token cache, a killed run's temp file, config
missing or empty, two gh-mint runs at once (one mint), cache modes, and no token in any message.

Fork audit #834, item G1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-kit/gh-apps: lens nits for the gh-as parity PR

- wrapper: a refused GH_REPO is masked before it is cut, so no start of a
  token is ever quoted; GH_HOST other than github.com is refused too
  (README says which variables are checked and which are only dropped).
- admin add-key: refuses the app name "gh" (gh-as gh -- gh ... reads it as
  the gh command, so it could not be picked by name).
- privileged gh-as: a repeated --app or --repo is a usage error, as in the
  wrapper, not last-wins.
- README: the new key is piped straight into root, never stored where an
  agent can read it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-kit/gh-apps: root test expects the wrapper to refuse a foreign GH_HOST

The wrapper now refuses GH_HOST other than github.com, so the environment
test checks that refusal, sends the rest of the attack environment through
the wrapper, and still sends all of it (GH_HOST too) to a direct sudo call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork release: SHA256SUMS covers the desktop files; unsigned macOS apps are ad-hoc signed last (#822) (#833)

* fork release: SHA256SUMS covers the desktop files; unsigned macOS apps are ad-hoc signed last (#822)

SHA256SUMS now lists every file a person downloads: the server archives and the desktop apps
(macOS dmg and zip, Windows exe, Linux AppImage), written in assemble after all desktop builds.

Without signing secrets electron-builder found no identity and signed nothing, so the macOS app
kept only the linker signature of Electron's executable and `codesign --verify --deep --strict`
failed on it. Unsigned macOS builds now set identity "-" with the sign hook
scripts/fork-codesign.cjs, which runs `codesign --force --deep --sign -` as electron-builder's last
change to the bundle, before the zip and dmg. A new verify_mac_signature job, which assemble waits
for, unpacks each shipped zip and dmg and runs `codesign --verify --deep --strict`.

The one line in scripts/build-desktop-artifact.ts is recorded in .github/fork-seams.json.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork release: review fixes for the desktop SHA256SUMS and ad hoc signing (#822)

- SHA256SUMS: `sha256sum --` (bare names kept) and compgen presence checks,
  so actionlint passes; a step before the upload checks every file the
  publish job uploads (less blockmaps and manifests) has a matching line.
- verify_mac_signature: no token, each dmg detached on any exit, the
  signature's Identifier/Signature/Authority in the step summary, and the
  hashes of the four checked files as an output; assemble fails when the
  macOS lines of SHA256SUMS differ from them.
- fork-codesign.cjs refuses any identity but "-" and says why entitlements
  and hardened runtime are ignored; scripts/fork-codesign.test.ts tests the
  hook and createBuildConfig's signed and unsigned macOS config.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* docs/fork/agent-rules.md + fork-ci doc-check: general agent rules, once (#874)

* docs/fork/agent-rules.md + fork-ci doc-check: general agent rules, once

docs/fork/agent-rules.md holds the agent rules that hold in every project
and on every machine, each once with a one-line why. Machine and project
facts stay in their own instruction files and config; review rules link
to the review skill instead of being copied.

fork-ci/actions/doc-check is a general port of a project's doc check:
size budgets and a no-history rule for instruction files, broken relative
links in changed Markdown, and no dated report files added. Budgets and
patterns come from an optional project config read at the base commit,
with defaults; a missing or empty config means the defaults, a broken one
exits 2.

Part of #834

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* git-clean test: doc-check is an action that runs the git check first

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the settled provider thread lines (#846, step 1) (#907)

List only (step 1 of "Adding a seam line"). Fixes the race behind the
flaky Kiro turn_interrupt replay test (#846): at a turn's end the ACP and
Cursor adapters cache the provider thread as active, and usage or shell
updates that arrive after the turn re-send that snapshot session-scoped,
which the server writes without a run guard. When that write lands after
the run's final idle write, the ended thread stays active.

The fix adds one override line (and a comment) after upstream's status
line in each adapter, so the cached snapshot is idle like the server's
final write, and one check in each adapter's existing test. No upstream
line changes, so no lost-line count is needed.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(acp,cursor): a turn's cached provider thread is settled, so late updates cannot mark it busy (#909)

* fork seams: announce the settled provider thread lines (#846, step 1)

List only (step 1 of "Adding a seam line"). Fixes the race behind the
flaky Kiro turn_interrupt replay test (#846): at a turn's end the ACP and
Cursor adapters cache the provider thread as active, and usage or shell
updates that arrive after the turn re-send that snapshot session-scoped,
which the server writes without a run guard. When that write lands after
the run's final idle write, the ended thread stays active.

The fix adds one override line (and a comment) after upstream's status
line in each adapter, so the cached snapshot is idle like the server's
final write, and one check in each adapter's existing test. No upstream
line changes, so no lost-line count is needed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(acp,cursor): a turn's cached provider thread is settled, so late updates cannot mark it busy

Fixes #846. At a turn's end the ACP adapter (Kiro, Kimi, Grok, fx and the
ACP registry agents) and the Cursor adapter cache the provider thread as
active. Usage or session info that Kiro sends after the cancelled prompt
(and Cursor's background-shell updates) re-send that cached snapshot as a
session-scoped update, which the server writes without a run guard. When
that write lands after the run's final idle write, the ended thread stays
active for good; the turn_interrupt Kiro replay test caught it now and
then.

The cached snapshot is now settled (idle, or error for a broken thread)
like the server's final write. One override line after upstream's status
line in each adapter, announced in .github/fork-seams.json.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork CI: each listed Python test declares its format, judged by it alone (#702) (#784)

- .github/fork-ci-tests.txt: a Python test's line ends in "unittest" or "ok lines". A Python
  line with neither is refused with what to write; either word on a non-Python test is refused.
  All 87 listed Python tests now say theirs (78 unittest, 9 ok lines).
- countTests: a Python test with no declared format counts nothing; it is never read as either.
- fork-contracts.test.py: its record fixtures pass the format the list would give.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* MCP profiles: Settings section and thread pick logic (design PR 3) (#804)

* MCP profiles: Settings section, thread picks and the menu entry's logic (design PR 3)

Settings → Fork gets its MCP profiles section (McpProfileSettings.tsx):
the built-ins all and t3-only read-only; add, edit and delete named
profiles (servers all or a list, t3Tools all or a list of the shared
MCP_T3_TOOL_GROUPS); the default profile and the sub-agent rule with the
usual project-override control; each thread's pick, changed or cleared.

Every patch names only what it changes: one mcpProfiles entry, or one
thread's mcpThreadProfiles key (null clears), and a pick or clear that
changes nothing writes nothing. A built-in name cannot be taken; a
profile something names cannot be deleted (the panel says who, and offers
to clear the thread picks). An entry with fields from a newer build shows
as broken, never as a profile; one with unknown tool groups as from a
newer version; neither is editable. Rows follow ForkRow's lock, so a
client that cannot write settings gets inert controls.

The pure resolver moves to packages/contracts/src/mcpProfileResolve.ts
(re-exported by the server's fork/mcpProfile.ts, unchanged behaviour) so
the app reads entries by readMcpProfileEntry and shows a thread's
effective profile from resolveMcpProfile, a child's cut down to its
parent's. The thread menu entry's logic is in
components/fork/mcpProfile/threadMcpProfile.logic.ts; wiring it into the
upstream thread menu needs seam lines, announced separately.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles: read the client's thread shells (delegatedFrom null) and a carried profile

The app's thread shells hold delegatedFrom: null for a thread nobody
delegated; the menu logic now takes that shape. Test: a task another
machine delegated is cut down to the profile it carried, and a shell
with delegatedFrom null is a top-level thread.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile settings: add a thread pick only with a chosen profile

- "Add thread" opens a form with the thread id and a profile picker next
  to it; one save writes that thread's key with the chosen profile.
  Nothing is written for a typed id alone, on Enter without a profile,
  or on cancel.
- The form and each pick row say what the pick gives the thread, and
  warn when that is more than the parent's cut-down set (a pick is never
  cut down to the parent's).
- The server refuses deleting a profile that the default, the sub-agent
  rule, a project or a thread pick still names, with the same rule and
  wording source as the panel (mcpProfileUses).
- "Clear the thread picks that use it" checks the lock of
  mcpThreadProfiles, the setting it writes.
- A blank pick hand-edited into settings.json shows as broken (it is
  ignored) and can be cleared.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork-kit/heavy: machine-file holds for heavy facts / t3-capacity (stacked on #786) (#843)

* heavy facts: per-kind fits from the kernel ledger; kit capacity evaluator and callers

Dynamic slots design row D6. The kit gets a Python evaluator of the shared
capacity rule (lib/capacity_rule.py) that passes every vector and format case
the TypeScript tests read, and `heavy facts [--kind K] [--mb N]`: one free/v1
object with per-kind "fits" from a ledger read from the kernel (heavy's live
tickets plus T3's agent scopes, unlabelled = writer), a 5 s cache, the Basic
tier, unreadable signals as elevated, and per-folder reservations.
bin/t3-capacity and bin/agent-slots are thin callers of it that keep the older
output and exit codes; a facts call that is slow (5 s) or fails is never free.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* heavy facts: every ticket is a job, folders match exactly, basic tier and other users fail closed

Fix round for the two D6 reviews.

- A heavy ticket whose kind the rule does not know (tsc, gradle, a project's
  own) is the rule's unknownKinds.job, never an agent; heavy facts --kind
  with an unknown name asks for that job too.
- A reservation folder matches itself and what is below it, with or without
  a trailing '/', never a sibling sharing its first letters; its real path
  matches too. The caller's own folder is its real working folder only.
- Basic tier (no cgroup v2 or no user manager) is never free and fits 0.
  Full tier also counts every other user's heavy jobs and agent scopes
  from their user managers' cgroups; a folder that cannot be listed is
  basic. Without a cache folder every call starts "elevated".
- lib/capacity_readings.py: the shared reader's port. It runs every
  capacity-readings.json case and the "a failed reading never admits more"
  check; memory, PSI, cores and container limits now come from it, a box
  with a live piece but no folder is unreadable, a cut-short memory.stat
  owes in full.
- The cache has version 2 and a key of its settings; t3-capacity takes the
  rule's whole hold; a fill count of 2.5 asks three times, as in TypeScript.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* heavy facts: kit tests check out the capacity rule; its JSON names no kit path

The heavy kit's evaluator, its tests and heavy-install read the capacity rule
from its one source, packages/shared/src/capacity, but the sparse checkouts of
the workflows, action_tests and kit_tests jobs left that folder out, so
install.test.py and facts.test.py found no capacity-rule.json. The folder is
now in the three lists (and in the `workflows` comment that says why each app
file is there).

The "//" notes of capacity-rule.json and capacity-readings.json named the
kit's Python files, which the fork-owned-reads lint counts as app code reading
a fork-owned path; they now point to README.md beside them, which names them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-kit/heavy: machine-file holds for heavy facts (t3-capacity), on top of the kit capacity check

Built on the kit's `heavy facts` and its thin `t3-capacity` caller (#786) instead of a second capacity
evaluator. What the older host check had that the kit's did not:

- heavy.capacity.holds in the machine file: a cgroup outside the user managers (a CI runners' slice) that
  is in use keeps its budget less its use, as a reservation, for every user but its own. Missing file,
  section or key: no holds; a broken one: no answer (t3-capacity NOT OK naming the key); a changed one
  is read again at once (cache key).
- The sweep and the queue accept the new `capacity` key.
- Tests for the state question: holds in use or idle, own users, missing cgroup, unreadable memory.max or
  memory.stat, machine file missing/empty/garbled/writable by others/unknown key, a changed file within
  the cache's 5 s, a reservation file cut short, a reservation whose processes are gone; one red check.

Part of #834 (G2, first half).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork-kit/review: one general review skill; tiers, failure table, nit-only check and a drift test (#845)

* fork-kit/review: one general review skill; tiers, failure table, nit-only check and a drift test

The kit's SKILL.md becomes the one general review skill, so a project keeps only its facts (review block, lens
prompts, kit settings) and a thin adapter. Merged in from the project skill: the tier table as the gate's weights,
the author's failure table, nit-only quick check, batch per area, twin lens names, focus lenses, covered rule, the
extra general lenses, and a concurrency part in the eval lens. Conflicts go to what the gate parses: the state answer
on a `state:` line and `blocker:`/`major:`/`minor:` lines.

New test (comments.test.py, SkillFormat): every report shape the skill, the eval lens and COMMENTS.md tell a lens to
write reads as a clean read with a state line through the gate's own parser; the skill's tiers match the gate's
weights and recommended min_lenses; the state question is word for word in the skill, the eval lens and REVIEW.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-kit/review: skill matches the gate on rounds, protected paths and check exits

- A quick check is a lens read of a new head, so the gate counts it as a
  round; the skill names rounds.approach_at / approach_lens / max, how to run
  the approach lens, and that only an override by a listed override_authors
  login waives it.
- The tier table names the gate's always-critical paths (queue config, lens
  prompts, .github/workflows/**); the light row no longer says config is light.
- focus: removed (nothing reads it); twin lenses described in general terms.
- check exits 1 for a real blocker or major by design; never soften a finding.
- not a lens: also needs no read-at sha outside a quote (COMMENTS.md rule).
- Drift test reads the round keys and recommended approach_at through the
  gate's parser and judge_rounds, the protected paths from review_judge, and
  the runner defaults from review_kit.DEFAULTS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-kit/review: the override passes a nit-only fix head, a quick check never does

The gate passes a head only when every lens's newest read names it or a newer
override covers them (lens.Review.reviewed_head). A quick check is one lens on
the fix head while the earlier lenses still name the old head, so it alone
holds the head. SKILL.md step 7 now says which head passes and that on
`nit-only: yes` the orchestrator still posts the override; COMMENTS.md says the
same. The round count says "whichever is higher", as review_round does.

Tests: a history (code at A, code r2 at B, fix C with a quick check) through the
gate's real reviewed_head and judge_rounds, pinned to the skill's words; the
protected-paths test now compares is_protected's answer with the skill's list
on every tracked file and on probe paths, so an inline rule fails it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Fix #911: a delivery refused for its profile leaves its place in line (#912)

A stored webhook delivery keeps its place in the slot gate's line from its
first, direct ask. When its worker run was refused for its MCP profile as it
started (before it reached its slot wait), the place stayed until the next
sweep, so for up to a sweep a free slot was refused to another run: that
run was stored for the worker instead of starting.

The flaky test hit this path only when the worker's run lagged behind a
fixed three worker rounds, so the widening landed before the slot wait it
meant to test. It now waits for that slot wait itself, and a new test
covers the start-time refusal, which leaves the place at once now.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Review rules T3a: lens_start plan, prompt, refusals and request ids (pure logic) (#825)

* Review rules T3a: lens_start's plan, prompt, refusals and request ids (pure logic)

New fork files next to the review-rules logic of #781. Nothing registers a tool yet.

- planLensStart: per pull request and batch plan. Required lenses come from planReview and
  requiredLenses, the round from judgeRounds (the gate's own rules), so lens_start cannot
  require fewer lenses than the gate. A lens whose newest report already read the head (or the
  same change) is not started again. A batch gives one child per lens that reads every pull
  request needing it and posts one report per pull request, each with that pull request's head.
- Refusals: rules off (unset, empty, off, unreadable), a bad call, an unknown, closed or merged
  pull request, a caller head GitHub does not name, no plan (unreadable change, no rule, a lens
  prompt not read), round past the cap, a person's override already on the head.
- confirmLensStart: just before starting, a child whose pull request moved or closed is refused.
- lensRequestId: same lens and heads = same id, in any order; fits delegate_task's 256 chars.
- The server builds the prompt: read only, the lens text, the state question word for word with
  a `state:` line, finding prefixes, report size, round and earlier reads.
- Tests replay every shared case, round and scan vector (counts checked) and answer the state
  question: same start twice, head moved, old/empty settings, round at the cap, partial batch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Review rules T3a: lens_start plans what the gate reads (fix round A+B)

- Restart every lens entry that does not name the head once anything must
  start, required or not: the gate needs every lens comment on one head.
  An entry lens_start cannot start (no header, unknown lens) is refused
  with what a person does. A newer override the gate counts is honoured.
- Read the gate's required-lenses input and the review block's mode;
  without a block the input names the lenses (built-in prompt), and an
  empty input outside enforce, a bad name or a bad mode is refused.
- Plan each pull request of a batch with its own base branch's rules.
- Earlier lens children: an ended one restarts as the next attempt
  (replaces + note), a running one is returned, never started twice.
- Repo and heads read lower-case; the approach lens runs on the approach
  runner by its role; lone-surrogate lens keys get a distinct id.
- Tests: both lens-A scenarios, a property test over every shared vector
  state (the gate's verdict, modelled from its code, passes after the plan
  is carried out, or a person must act), and a test per new refusal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Slot gate: enforce the capacity rule by default (dynamic slots D4) (#823)

* Slot gate: enforce the capacity rule by default (dynamic slots D4)

The capacity rule now decides agent starts (mode "enforce", the default when
agentSlots has no mode and is switched off):
- owed term: every agent still starting, held slot or waiter ahead owes its
  full cost, so two starts in one second both count;
- kinds from the task role: research, review and design are light, anything
  else or no role is a writer; a light agent that grows past the light cost
  counts as a writer, so a wrong role cannot hide one;
- floors (2 agents, 1 job) and derived ceilings (3 agents per core, at most 64);
- fallback to the fixed ceilings (10 agents, 4 jobs) with start costs raised
  25% per trip after an OOM kill (oom_kill in /proc/vmstat rises) or swap under
  10% free; it lifts after 10 minutes of calm, whole readings. A restart starts
  in the fallback and at "elevated"; unreadable readings are never calm.
Typed limits still apply while enabled; "mode": "fixed" turns the rule off.
The delegate_task route passes its role to the slot gate with the target.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: fix round after lenses A and B (D4)

- floor always starts, also with failed, hung or out-of-range readings;
  after 2 minutes unread the fixed 10 counts alone
- a restart lifts on calm for this host: swap counts by trend, the first
  calm needs the margin only; a 30 s timer takes readings
- costs from the rule file (light 384, writer 768); light cost clamped
- only agent-slice OOM kills raise costs; untold kills raise at most 2;
  each calm spell lowers one raise
- basic tier (no scopes or no oom_kill) keeps the fixed 10; unread
  running agents count once as writers
- unreadable settings use the fixed limits; true counts in refusals
- tests for the held slot, the role line, no OOM counter

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: kit evaluator follows the swap-trend rule; scheduled-run tests build the gate at START

The merge of main brought the heavy kit's Python evaluator of the capacity
rule (#786), written for the rule before this PR. This PR's rule counts swap
by its trend (pressure.swapFillingMb; calm.swapFreeAtLeastPercent gone), so
the kit read a key the shared rule no longer has (KeyError in
capacity_rule.test.py and every heavy facts call).

- lib/capacity_rule.py mirrors capacityPressure.ts and pressureOf: raw_level
  takes the last read's swap free (filling = it fell by more than
  swapFillingMb; nearly full counts only while filling; filling is never
  calm; no previous swap read = trend unknown), next_pressure keeps or starts
  the calm wait on an unknown trend but never ends it, and the kept state
  carries swapFreeMb for the next read (heavy facts' cache carries it).
  The shared capacity-vectors.json swap-trend cases and the facts carry test
  fail when any part is undone.
- capacity_rule.test.py: a kit copy of the rule from before the swap trend is
  refused by name; an empty or missing rule file raises (heavy facts then
  answers "not available", never free).
- agentSlotRoutes.test.ts: the gate's 30 s enforce sampler starts when the
  gate is built. Built at the test clock's 0, the tests' move to START ran
  every sample in the 56 years between (about 59 million): Test Server 5 hung
  until its 20 min cancel. boot now sets the clock to START first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* MCP profiles part 5: Codex threads apply their profile's outside servers (#826)

* MCP profiles part 5: Codex threads apply their profile's outside servers

Each Codex thread T3 loads on the shared app-server gets
mcp_servers.<name>.enabled = false in its own per-request config for
every server config/read lists for its folder that the profile leaves
out (launch-argument and project servers included; T3's own entries
stay). Each turn first reads the thread's live servers and refuses,
saying why and the fix, when one outside the profile is still on. A
missing or broken profile, a server list T3 cannot read, or a thread T3
cannot match is refused, never started with every server. Logic in
apps/server/src/fork/codexMcpProfile.ts; two seam lines in the Codex
adapter (announced in step 1). Remote delegation stays Claude-only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles part 5, fix round: check Codex-started turns, sub-agents and connectors

- Watch turn/started: a turn Codex starts on its own (a goal's next turn, a
  sub-agent's turn) gets the same check as turn/start; one that fails is
  stopped (goal paused, turn interrupted) and ends failed with the reason.
- Count Codex sub-agents as their parent's T3 thread (they copy the parent's
  loaded config, codex-rs child_config.rs), so their turns are checked too.
- Send features.apps=false when a narrowed profile leaves out codex_apps,
  which config/read never lists.
- A refused resume no longer becomes a fresh Codex session: the fallback
  start is refused once, so the history is kept.
- Tests for each, with Codex's real status words; docs updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* heavy holds: #913 follow-ups and neutral example names (#917)

- A hold cgroup that is there without a memory controller (no memory.stat)
  holds its whole budgetMb with a note, instead of nothing.
- The room a hold keeps is its budget less the RAM it uses: memory.max
  limits RAM only, so swap is left out (in use still counts swap).
- Holds in or the same as another hold's cgroup are refused (the same
  room held twice); a reservation file named like a hold gives a note.
- Tests that fail without the code: at most 8 holds (9 distinct labels),
  memory.max "max" gives no "cannot be read" note, and one mutation check
  per fix.
- Neutral example names in the reservation-folder docs and test.

Fixes #913

Co-authored-by: Claude Opus 5.5 <[email protected]>

* MCP profiles: T3 tool groups on T3's MCP server, for every provider (#827)

* MCP profiles: T3 tool groups on T3's MCP server, for every provider

MCP profile design PR 4. A profile's t3Tools now applies: one global
rule on T3's MCP server hides a T3 tool outside the calling thread's
groups from tools/list, refuses it on tools/call with a plain reason and
its fix, and keeps it out of tool_search. The groups are fixed as each
turn starts (Claude: as its query opens; other providers: the turn
check), so a running turn keeps its set and a change applies from the
next turn. A profile that cannot be worked out, or a thread T3 cannot
read, keeps only request_secret, send_to_user and tool_search.

Claude no longer refuses a profile whose t3Tools is a list, and a group
change gives its next turn a fresh process. Off Claude, a turn now
refuses only a profile that leaves out an outside server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles: guard the T3 tool table against drift; a tool in no group is refused as a T3 bug

- personOnlySettings.test.ts: the T3 tool filter's table must hold exactly the toolkit folders'
  tools, each in its folder's group, and every group of MCP_T3_TOOL_GROUPS must have a tool there.
  Dropping a toolkit from the filter's hand list, or adding a group with no toolkit, fails CI.
- A tool in no group is still refused by any profile but all, but its refusal now says it is a T3
  bug to report, not a setting to change.
- docs/fork: profiles are not a sandbox (requests with no thread, such as the t3 thread CLI, are not
  filtered); the sets live per thread, not per credential.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* FORK_CHANGES: shorten the MCP profiles row so the table keeps main's widths

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork-kit/agent-guards: the machine's agent guard hooks as a kit (#834 G4) (#847)

* fork-kit/agent-guards: the machine's agent guard hooks as a kit (#834 G4)

Five Claude Code hooks that guard every agent on a shared machine, as one kit with one
installer, facts from the machine file and the same messages and exit codes as before:

- actions-disable-guard (PreToolUse Bash): no disabling of workflows, Actions or branch
  protection; fails closed (a missing or failing hook refuses, and says so)
- capacity-pipe-guard (PreToolUse Bash|Monitor): no pipe out of a capacity check
- memory-index-guard (Pre/PostToolUse): the auto-memory index stays inside its budget
- bg-guard (Stop): no stop while a background Bash command still runs
- agent-slots (UserPromptSubmit, Stop): slot and ready-queue context for orchestrators

The others fail open with a visible line. `agent-guards check` runs each wired command
with a case it must refuse and one it must pass; `--settings` writes a managed settings
drop-in. Shared bootstrap and kit_install contract tests cover the new kit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-kit/agent-guards: lens round 1 fixes for G4a

- actions-disable-guard and capacity-pipe-guard match Bash|Monitor; the
  memory-index after-call check matches Monitor too; check reports a
  guard wired for Bash only as missing.
- The owner's approval is a root-owned file with the hash of a one-time
  code (agent-guards approve); the session variable is no longer read,
  since nested sessions inherited it.
- Refuse starting a nested session without this machine's hooks
  (claude --bare/--safe-mode, CLAUDE_CODE_SIMPLE, codex).
- The closed hook sets onFailure block; an empty guard file refuses.
- A ruleset set to evaluate is refused like disabled.
- Each hook reads only its own part of the machine file section; bad
  keys and refuseScripts rows are dropped one by one and named to the
  agent; self-check does the strict check.
- Uninstall refuses while a foreign settings file names a hook or an
  older session runs; rollback is --no-settings.
- check --settings as root reads only a root-owned file; check runs
  hooks under a temporary HOME; self-check checks links, an open
  approval and passwordless ways to root.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-kit/agent-guards: GraphQL ruleset update with EVALUATE in a variable is refused (lens B r2 minor 1)

The off word of updateRepositoryRuleset was looked for in canon() text, which blanks text with no cue
word, so `-F e=EVALUATE` (or a JSON variables block) was '' before OFF_WORD saw it. It is now read
without the cue words, as the REST ruleset body already was.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-kit/agent-guards: an owner approval passes one command, in one folder, once (lens B r2 major 2)

`sudo agent-guards approve --command '<cmd>' [--cwd DIR]` now stores the hash of the
normalised command and the folder next to the code's hash (approval file version 2).
The guard passes only that command, ending in the marker, run in that folder, and
records the use in its state folder (O_EXCL link; the same tool_use_id passes again),
so the approval is used up. A code seen in a transcript, the app database or ps opens
no other command. A version 1 file counts as no approval.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-kit/agent-guards: refuse hookless agent sessions by path, package and wrapper, and say what the guards are not (lens B r2 major 1)

A list of strings cannot be complete, so this does both things the review asked for:

(a) Wider detection where it is cheap and reliable. claude and codex now count by name, by their real
program path (.../claude/versions/<v>, the @anthropic-ai/claude-code and @openai/codex packages), as a
link to or a copy of the installed program, through npx, bunx, pnpm dlx, npm exec, bun x and
`node <their cli>`, behind `$(which claude)`, and inside python -c, node -e, perl -e, at, systemd-run
and the other wrappers already read for gh. CLAUDE_CODE_SIMPLE counts in the command, through env -S,
in a sourced file, in BASH_ENV/--rcfile and in the user's shell start files.

(b) The threat model, written plainly in the README ("What the guards are and are not") and the guard's
docstring: the guards stop mistakes and casual misuse; they are not a boundary against a hostile agent;
the boundary is the GitHub permissions of the agent's token (a fine-grained token without Actions and
Administration write is the recommended setup).

Codex arguments are now read option by option (an option's value is not taken for the subcommand),
because the new path and package forms need it; the separate codex nits follow in their own commit.

Tests: LensSecurityR2Test.test_r2_major1_* (each fails on 6d5047d4).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-kit/agent-guards: codex arguments are read option by option; codex mcp passes (lens A r2 nit)

`codex -m o3 exec x` is now refused as `codex exec` (the option's value is no longer taken for the
subcommand), `codex mcp list` (MCP setup, no session) passes, and `npx -y @openai/codex exec x` is refused
(the package form came with the major-1 commit). `codex mcp-server` stays refused.

Test: LensSecurityR2Test.test_r2_nit_codex_arguments_name_the_right_subcommand_mcp_passes_npx_refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-kit/agent-guards: uninstall finds sessions by program path, refuses inside a hooked session, remembers hand-wired entries (lens B r2 minor 2, lens A r2 minors 1 and 2)

- Sessions are found by the real path of their program (/proc/<pid>/exe: the native build in
  .../claude/versions/<v> under any name, the @anthropic-ai/claude-code script node runs through any
  link, an installed `claude`), not by the process name alone.
- The uninstall's own ancestors are no longer skipped: run from inside a Claude Code session that has
  the hooks, it refuses and says to run it from a terminal.
- A refusal for a hand-wired entry is remembered (/etc/agent-guards/hand-wired-seen.json, removed with
  /etc/agent-guards); the next run then counts every session older than itself, as does a run where the
  drop-in was never on. A broken record counts as seen now.
- The project .claude/settings*.json of each running session's working folder (and the folders above
  it) is searched too.

Tests: Install.test_r2_minorB2_*, test_r2_minorA1_*, test_r2_minorA2_* and test_r2_state_* (each fails on
6d5047d4).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-kit/agent-guards: README names the first Claude Code that honours onFailure, and how often a machine-file note shows (r2 nits)

- onFailure: "block" is honoured from Claude Code 2.1.295 on; older versions ignore it and let a
  failed or timed-out hook's call run (lens B r2 nit 1).
- A broken part of the machine file is named on every call the hook handles, once per hook with a
  problem, so a Bash call can carry it up to three times: kept loud on purpose, now said in the README
  (lens A r2 nit).
- The --safe-mode refusal is kept, with its reason in the README since the major-1 commit: safe mode
  runs managed hooks but not hooks wired by hand in user settings (lens B r2 nit 2).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-kit/agent-guards: uninstall reads the boot time only when a Claude Code session runs (follow-up to the session-check commit)

The session check now runs on every uninstall, so it must not refuse for a /proc/stat it does not need:
the boot time is read only once a Claude Code process is found, and an unreadable process list still
refuses with "cannot be read". Found by the shared fork-kit/common/tests/kit_install.test.py run (its
fake /proc has no stat file).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork-ci release: carry the files the heavy and desk kit installers read, and test every kit against the release (#920)

* fork-ci release: test that every kit installer finds its files in the release (desk: missing_sources)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-ci release: carry the files the desk and heavy kits read (capacity rule, fleet desk scripts)

heavy-install reads capacity-rule.json, capacity-format.json and capacity-vectors.json from
packages/shared/src/capacity, and desk-install reads the fleet desk scripts, units and
.github/fork-fleet.json; none were in the release paths, so both refused on every release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Placement P3 (facts out): t3_environment_read returns hostResources and placement (#820)

t3_environment_read now returns two optional fields beside upstream's, for this
machine and for a linked one (the read is forwarded there as before):

- hostResources: CPU, cores and memory from HostResources, the result field of
  upstream PR #34293 (closed upstream without merging), same name and schema.
  Its export in McpHttpServer.ts, its lines in upstream test files and its new
  tool description are not carried: the fork adds no lines there. The fork file
  finds the sampler with Effect.serviceOption instead of a new tool dependency,
  so no upstream test needs a new mock. Its tests moved to fork test files.
- placement: labels (empty: no setting holds them yet, P2 adds it), available
  and reason, runningAgents, slotsFree, memoryFloorMb, freeMemoryMb from the
  slot gate's existing status read (SlotGate.usage), and factsAt.

A slot gate that cannot be read (fails, dies, takes longer than its own count
limit, is not running, or the settings cannot be read) gives available: false
with a reason and no count. A linked machine on an older T3 leaves both fields
out: no facts, not a failed read. Nothing is stored; each read measures again.
Result fields are not in the measured tool list, so the budget files are
unchanged.

The two environment toolkit files take the four lines announced in #779, moved
from announced to added.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* heavy-install: link t3-capacity to the kit's copy; self-check warns on another (#919) (#922)

* heavy-install: link t3-capacity to the kit's copy; self-check warns on another (#919)

heavy-install now also links /usr/local/bin/t3-capacity to
current/bin/t3-capacity, so the command has one source: the release in
use. A plain old file there (a host's own copy) is kept in
/usr/local/libexec/heavy/replaced-capacity/ (not replaced/: an older
installer's uninstall restores the newest file of replaced/ as heavy) and
stays in place until its link replaces it in one rename; uninstall puts it
back. A link elsewhere or a folder there is refused before anything is
written. heavy --self-check warns when the t3-capacity found on PATH is
not this kit's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* heavy-install: a host's own plain t3-capacity is replaced only with --replace-t3-capacity

A host's installer may write its own t3-capacity to /usr/local/bin and its
scripts may read or compare that file, so the installer now leaves such a
plain file alone (with a note, and no installed.tsv row for it) unless it is
run with --replace-t3-capacity. With nothing there, or the kit's link, it
links as before; once linked, later runs keep the link without the option.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* heavy-install: keep a host's t3-capacity outside the folders an uninstall deletes

- The kept copy moves to /usr/local/libexec/heavy-kept/: every released uninstall
  (ci/v6 to ci/v22) deletes /usr/local/libexec/heavy and /etc/heavy whole, so a copy
  kept inside them was lost. This release's uninstall puts it back (also after an
  older uninstall left the t3-capacity link broken) and then removes the folder.
- A link at /usr/local/bin/t3-capacity that the kit did not make is left alone with
  a note when --replace-t3-capacity is not given (refused with it, as before).
- The closing install line repeats that the host still uses its own t3-capacity.
- Tests: an older release's install and uninstall (ci/v22, from git) over this
  state; the same deletes without git; a foreign link; the closing-line warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* heavy tests: declare the older-installer test's skip in CI's shallow checkout

CI's clone has no ci/v22 tag, so the test skips there; fork-ci refuses an
undeclared skip (round-2 code lens on #922).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-contracts: pin the heavy install test's declared CI skip in MAY_SKIP

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Slot gate: a stored delivery leaves the line when its worker removes it (#938)

A stored webhook delivery whose worker run ended before it asked for a
slot (task paused, trigger changed, blocked by policy, or the run failed
before its ask) kept its place in the slot gate's waiting line until the
5 s sweep. Another task's delivery that came in meanwhile was stored and
delayed instead of run.

keepStored, the fork hook the worker already calls after each run and
right before it removes the row, now frees that row's place whenever it
does not keep the row. No new lines in upstream files. Tests: paused,
trigger changed, and a run that fails before its ask.

Fixes #915

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Seam check: count pending-file text changes from upstream; refuse duplicate keys and dropped announcements (#796, #813) (#939)

* Seam check: count pending-file text changes from upstream; refuse duplicate keys and dropped announcements (#796, #813)

- A pull request that changes a pending file's text is now counted from
  upstream in its run, against main's ceiling and lost entry, even with its…
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