Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/fork-ci-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ fork-kit/common/tests/kit_install.test.py ~125s unittest
fork-kit/common/tests/machine_file.test.py unittest
fork-kit/desk/tests/install.test.py ~103s unittest
fork-kit/desk/tests/windows.test.py ~65s unittest
fork-kit/gardener/tests/checks.test.py unittest
fork-kit/gardener/tests/install.test.py unittest
fork-kit/gardener/tests/report.test.py unittest
fork-kit/gardener/tests/run.test.py ~30s unittest
fork-kit/golive/tests/back.test.py ~100s unittest
fork-kit/golive/tests/check.test.py unittest
fork-kit/golive/tests/contract.test.py unittest
Expand Down
3 changes: 2 additions & 1 deletion .github/scripts/fork-ci-release.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def load(rel, name):
loader.exec_module(mod)
return mod
failed = []
if how == 'kit_install': # agent-guards, cleaner, golive, schedule-kick, update-policy: check_options' file part
if how == 'kit_install': # agent-guards, cleaner, gardener, golive, schedule-kick, update-policy: check_options' file part
m = load(installer, 'kit_installer')
inst, missing = m.INSTALLER, []
for rel in inst.source_files():
Expand Down Expand Up @@ -469,6 +469,7 @@ def load(rel, name):
# passes: the kit's folder or the release's top folder)
KITS = {"agent-guards": ("kit_install", "sbin/agent-guards-install", "kit"),
"cleaner": ("kit_install", "sbin/fork-cleaner-install", "kit"),
"gardener": ("kit_install", "sbin/gardener-install", "kit"),
"golive": ("kit_install", "sbin/t3-golive-install", "kit"),
"schedule-kick": ("kit_install", "sbin/schedule-kick-install", "kit"),
"update-policy": ("kit_install", "sbin/update-policy-install", "kit"),
Expand Down
4 changes: 2 additions & 2 deletions fork-ci/actions/pr-queue/review_judge.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,8 @@ def test_a_wrong_list_is_refused(self):
# report must say to count), gh-apps keeps the gate App's key and mints its tokens (the gate-trust design). The
# other kits run machines and agents, and the merge gate reads none of them.
GATE_KITS = ('gh-apps', 'review')
OTHER_KITS = ('.gitignore', 'README.md', 'agent-guards', 'cleaner', 'common', 'desk', 'golive', 'heavy', 'model-guard',
'pc-agents', 'schedule-kick', 'update-policy')
OTHER_KITS = ('.gitignore', 'README.md', 'agent-guards', 'cleaner', 'common', 'desk', 'gardener', 'golive', 'heavy',
'model-guard', 'pc-agents', 'schedule-kick', 'update-policy')


class ForkConfig(unittest.TestCase):
Expand Down
3 changes: 2 additions & 1 deletion fork-kit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Every kit follows the same pattern:
| [agent-guards](agent-guards/README.md) | Claude Code hooks that guard every agent on a machine: no disabling Actions, no piped capacity check, a memory index in budget, no stop with a background command, agent slots (Linux) |
| [cleaner](cleaner/README.md) | `fork-cleaner`: free disk space by rules (`worktrees` with merged branches, `tmp`, `agent-scratch`, `docker`; `compress-cold` and `dedupe` delete no content) and never what could be needed; daily timer (Linux, systemd) |
| [desk](desk/README.md) | A desktop's side of a fork fleet desk pool: runner users, walls, desk agent; one folder (Linux, WSL2) |
| [gardener](gardener/README.md) | `gardener`: each project's checks once a day (small scripts, JSON-line findings; general ones shipped, project ones by path), one report issue per project updated in place; report only (Linux, systemd) |
| [gh-apps](gh-apps/README.md) | GitHub App tokens for agents through `gh-as`, without giving agents the keys (Linux) |
| [golive](golive/README.md) | Move a T3 boot service to a new build with a cold copy first, and back; installs from `ci-release` (Linux) |
| [heavy](heavy/README.md) | `heavy <command>`: run builds and tests in a capped slice, stop what they leave behind (Linux, systemd) |
Expand All @@ -29,7 +30,7 @@ Every kit follows the same pattern:

[common](common/README.md) is code the kits share, copied into each kit's version folder: the loader of the one
private machine file (`/etc/fork-kit/machine.json`) where the facts of one machine live, and the installer and
bootstrap of the agent-guards, cleaner, golive, schedule-kick and update-policy kits.
bootstrap of the agent-guards, cleaner, gardener, golive, schedule-kick and update-policy kits.

[review](review/README.md) is the one kit with no installer: a skill, docs and tools an agent uses from a checkout
of the fork, beside the merge gate whose parser it imports.
4 changes: 2 additions & 2 deletions fork-kit/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ standard library.

## The installer

`kit_install.py` is the installer of the agent-guards, cleaner, golive, schedule-kick and update-policy kits; each kit's `sbin/<kit>-install` is a small
`kit_install.py` is the installer of the agent-guards, cleaner, gardener, golive, schedule-kick and update-policy kits; each kit's `sbin/<kit>-install` is a small
subclass that names its paths, links, files and modules, and adds its own steps. `install --source FOLDER --sha
SHA`, as root:

Expand Down Expand Up @@ -108,7 +108,7 @@ root's `uninstall` can then wait there forever, with both locks held (as it can
process whose memory is FUSE-backed). It fails safe: nothing is removed yet, and Ctrl-C ends it and frees the
locks. Updates go through the bootstrap.

`bootstrap.sh --kit agent-guards|cleaner|golive|schedule-kick|update-policy --repo OWNER/REPO --sha SHA [kit options]` checks the commit is on the protected
`bootstrap.sh --kit agent-guards|cleaner|gardener|golive|schedule-kick|update-policy --repo OWNER/REPO --sha SHA [kit options]` checks the commit is on the protected
release branch, downloads exactly that commit and runs the kit's installer; it passes on only the kit's own options.

## Tests
Expand Down
6 changes: 4 additions & 2 deletions fork-kit/common/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# KIT and its options (each kit's sbin/*-install says what they do):
# agent-guards fork-kit/agent-guards/sbin/agent-guards-install [--settings | --no-settings]
# cleaner fork-kit/cleaner/sbin/fork-cleaner-install [--timer | --no-timer]
# gardener fork-kit/gardener/sbin/gardener-install [--timer | --no-timer]
# golive fork-kit/golive/sbin/t3-golive-install (none)
# schedule-kick fork-kit/schedule-kick/sbin/schedule-kick-install [--timer | --no-timer]
# update-policy fork-kit/update-policy/sbin/update-policy-install [--timer | --no-timer] [--force]
Expand Down Expand Up @@ -39,14 +40,15 @@ done
case "$kit" in
agent-guards) installer='sbin/agent-guards-install' ;;
cleaner) installer='sbin/fork-cleaner-install' ;;
gardener) installer='sbin/gardener-install' ;;
golive) installer='sbin/t3-golive-install'; [ -z "$opt" ] || die "$opt is not an option of --kit golive" ;;
schedule-kick) installer='sbin/schedule-kick-install' ;;
update-policy) installer='sbin/update-policy-install' ;;
*) die "--kit must be one of: agent-guards cleaner golive schedule-kick update-policy" ;;
*) die "--kit must be one of: agent-guards cleaner gardener golive schedule-kick update-policy" ;;
esac
[ -z "$force" ] || [ "$kit" = update-policy ] || die "--force is not an option of --kit $kit"
case "$kit:$opt" in
agent-guards:--timer|agent-guards:--no-timer|cleaner:--*settings|schedule-kick:--*settings|update-policy:--*settings)
agent-guards:--timer|agent-guards:--no-timer|cleaner:--*settings|gardener:--*settings|schedule-kick:--*settings|update-policy:--*settings)
die "$opt is not an option of --kit $kit" ;;
esac
printf '%s\n' "$repo" | grep -Eqx '[A-Za-z0-9][A-Za-z0-9-]{0,38}/[A-Za-z0-9._-]{1,100}' || die "--repo must be OWNER/NAME"
Expand Down
30 changes: 30 additions & 0 deletions fork-kit/common/machine.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,36 @@
},
"disk": { "floorGb": 25, "path": "~" }
},
"gardener": {
"stateDir": "~/.local/state/gardener",
"gh": "gh",
"projects": [
{
"name": "example",
"repo": "example-owner/example-repo",
"reportRepo": "example-owner/example-repo",
"root": "/srv/example/repo",
"schedule": "03:00",
"quietHours": "02:00-07:00",
"timeZone": "Europe/London",
"model": { "endpoint": "http://127.0.0.1:8080/v1", "model": "example-local-model" },
"checks": [
{
"name": "context-budget",
"options": {
"files": { "AGENTS.md": 6000 },
"memoryIndexes": ["~/.claude/memory/MEMORY.md"]
}
},
{ "name": "facts" },
{ "name": "worktrees", "options": { "staleDays": 14 } },
{ "name": "workflows-off", "options": { "ignore": ["old-deploy.yml"] } },
{ "name": "install-drift" },
{ "path": "/srv/example/bin/doc-check", "id": "docs", "timeoutSeconds": 120 }
]
}
]
},
"golive": {
"home": "/srv/example/t3-home",
"targetVersion": "0.0.0-example.fork.1",
Expand Down
17 changes: 12 additions & 5 deletions fork-kit/common/tests/kit_install.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
KITS = {
'agent-guards': os.path.join(fx.FORK_KIT, 'agent-guards', 'sbin', 'agent-guards-install'),
'cleaner': os.path.join(fx.FORK_KIT, 'cleaner', 'sbin', 'fork-cleaner-install'),
'gardener': os.path.join(fx.FORK_KIT, 'gardener', 'sbin', 'gardener-install'),
'golive': os.path.join(fx.FORK_KIT, 'golive', 'sbin', 't3-golive-install'),
'schedule-kick': os.path.join(fx.FORK_KIT, 'schedule-kick', 'sbin', 'schedule-kick-install'),
'update-policy': os.path.join(fx.FORK_KIT, 'update-policy', 'sbin', 'update-policy-install'),
Expand Down Expand Up @@ -615,6 +616,10 @@ class Cleaner(Contract, fx.FakeHost):
KIT_DIR, INSTALLER = os.path.join(fx.FORK_KIT, 'cleaner'), KITS['cleaner']


class Gardener(Contract, fx.FakeHost):
KIT_DIR, INSTALLER = os.path.join(fx.FORK_KIT, 'gardener'), KITS['gardener']


class Golive(Contract, fx.FakeHost):
KIT_DIR, INSTALLER = os.path.join(fx.FORK_KIT, 'golive'), KITS['golive']

Expand All @@ -638,15 +643,15 @@ def refused(self, *args):

def test_the_kit_is_one_it_knows(self):
self.assertEqual(self.refused('--repo', 'a/b', '--sha', SHA1), 'fork-kit-bootstrap: --kit must be one of: '
'agent-guards cleaner golive schedule-kick update-policy')
'agent-guards cleaner gardener golive schedule-kick update-policy')
self.assertIn('--kit must be one of', self.refused('--kit', '../heavy', '--repo', 'a/b', '--sha', SHA1))
self.assertEqual(self.refused('--repo', 'a/b', '--sha', SHA1, '--kit'),
'fork-kit-bootstrap: --kit needs a value')

def test_only_the_kit_options_are_passed_on(self):
"""Nothing reaches the installer unchecked: a second --source would install a folder the release check
never saw."""
for kit in ('agent-guards', 'cleaner', 'golive', 'schedule-kick', 'update-policy'):
for kit in ('agent-guards', 'cleaner', 'gardener', 'golive', 'schedule-kick', 'update-policy'):
for extra in (['--source', '/elsewhere'], ['--x']):
with self.subTest(kit=kit, extra=extra):
err = self.refused('--kit', kit, '--repo', 'a/b', '--sha', SHA1, *extra)
Expand All @@ -659,18 +664,20 @@ def test_only_the_kit_options_are_passed_on(self):
self.assertEqual(self.refused(timer, '--kit', 'golive', '--repo', 'a/b', '--sha', SHA1),
f'fork-kit-bootstrap: {timer} is not an option of --kit golive')
for kit, opt in (('agent-guards', '--timer'), ('agent-guards', '--no-timer'), ('cleaner', '--settings'),
('schedule-kick', '--no-settings'), ('golive', '--settings'), ('update-policy', '--settings')):
('schedule-kick', '--no-settings'), ('golive', '--settings'), ('update-policy', '--settings'),
('gardener', '--settings')):
with self.subTest(kit=kit, opt=opt):
self.assertEqual(self.refused('--kit', kit, opt, '--repo', 'a/b', '--sha', SHA1),
f'fork-kit-bootstrap: {opt} is not an option of --kit {kit}')
for kit in ('agent-guards', 'cleaner', 'golive', 'schedule-kick'): # --force: update-policy's only
for kit in ('agent-guards', 'cleaner', 'gardener', 'golive', 'schedule-kick'): # --force: update-policy's only
with self.subTest(kit=kit, opt='--force'):
self.assertEqual(self.refused('--kit', kit, '--force', '--repo', 'a/b', '--sha', SHA1),
f'fork-kit-bootstrap: --force is not an option of --kit {kit}')
if os.geteuid() != 0: # as root it would go on to download
for args in (['--kit', 'cleaner', '--timer'], ['--no-timer', '--kit', 'cleaner'], ['--kit', 'golive'],
['--kit', 'update-policy', '--timer', '--force'],
['--kit', 'schedule-kick', '--timer'], ['--kit', 'update-policy', '--timer'],
['--kit', 'gardener', '--timer'],
['--kit', 'agent-guards', '--settings'],
['--no-settings', '--kit', 'agent-guards']):
with self.subTest(args=args):
Expand Down Expand Up @@ -782,7 +789,7 @@ def test_only_the_kit_options_are_passed_on(self):
'bootstrap', ' [ -z "$opt" ] || die "$opt is not an option of --kit golive" ;;', ' ;;',
'test_only_the_kit_options_are_passed_on'),
'bootstrap: an unknown kit is refused': (
'bootstrap', ' *) die "--kit must be one of: agent-guards cleaner golive schedule-kick update-policy" ;;', ' *) installer=x ;;',
'bootstrap', ' *) die "--kit must be one of: agent-guards cleaner gardener golive schedule-kick update-policy" ;;', ' *) installer=x ;;',
'test_the_kit_is_one_it_knows'),
'bootstrap: --settings is kept, nothing after it passed on': (
'bootstrap', ' --settings|--no-settings) opt="$1"; shift ;;', ' --settings|--no-settings) break ;;',
Expand Down
Loading
Loading