Repository navigation
fork-kit: gardener kit, a daily report issue per project (#1064, phase 1) - #1068
Merged
Merged
Conversation
…e 1) gardener run [--project NAME] [--dry-run] [--force] [--timer] runs each project's checks once a day (done marker per project per day; --force runs again) and writes one report issue per project, found by a hidden marker and updated in place. Report only unless a check sets "fix". - Check contract: JSON context on stdin, JSON-line findings on stdout; per-check timeout in its own process group; any failure is exactly one finding and never stops the run. - Config: the machine file's "gardener" section; project checks by path. - General checks: context-budget, facts (current project, never --all), worktrees, workflows-off, install-drift. - Report issue: closed or de-marked issues are left alone; hand-written text above the marker is kept; local paths redacted; at most one read, one search, one write per run; errors exit 1 with no done marker. - Judgment: interface only (gardener.model, OpenAI-style endpoint); an unreachable model is a note; no paid fallback. - gardener-install + bootstrap --kit gardener [--timer]: hourly user timer units; installing never enables them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gardener runs reports on machines; the merge gate reads none of it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iew fixes) Fixes from the #1068 review: - B1: check output is read as it comes and stopped at 256 KiB (process group killed); stderr keeps its last 4 KiB. Any error inside the gardener on one check is one finding; any error in one project never stops the others. - B2: the report issue is built from an allow-list. Only repo-relative paths; findings outside the repo are counted; local names are masked; a failed check shows its id and exit code, not stderr; the model endpoint is never shown; the judge reads only git-tracked files and its answer is masked. The full report stays local (report.md). - S1: the judge catches every error (a non-HTTP endpoint too). - S2: the done marker is written before the issue; a failed issue write is retried alone, at most 3 times a day. The whole body, a person's text too, is held under the size limit. - S3: fix hints quote every name. S4: a fresh worktree is not "merged". - M1-M6: a newer state is refused; a window past midnight is one day; the issue is searched by title too; a broken SKILL.md link is a warning; the uninstall says "disable first" before it removes; the test prefix is an environment variable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- worktrees: a branch whose upstream is the base itself (worktree add -b X PATH origin/main) is not pushed work, so it is never "merged"; a ~/ repos path stays expandable in fix hints. - report: the root and home are replaced only at a folder boundary; masks for user@host, compressed IPv6 (also ::), Windows drive and UNC paths. - A project check's text and fix reach the issue only with publicText: true; otherwise its id, count and where. Hidden (outside/no-where) findings show no id. - A private (or unknown) project repo that reports to another, not-private repo publishes counts only, and no judgment. - state keeps reportRepo; a change runs the day again for the new repo and drops the old issue number. - README: publicText, counts only, new masks, a warning for check authors, visibility reads, the reportRepo state key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1064 (Phase 1).
What
A new kit,
fork-kit/gardener:gardener run [--project NAME] [--dry-run] [--force] [--timer]runs each project's checks once a day and keeps one report issue per project, updated in place. It reports only, unless a check's config says"fix": true.{id, severity, where, text, fix}. Each check has its own timeout and runs in its own process group. Output is read as it comes and stopped at 256 KiB (the process group is killed), so a check that prints forever costs no memory. A check that hangs, exits non-zero, prints junk or too much, or cannot start becomes exactly onegardener.check-failedfinding, and the next check still runs. Any error inside the gardener on one check, or in one project, never stops the others."gardener"section (projects, schedule or quiet hours, time zone, optionalmodel, checks). Project checks are given bypath; the kit never names them. Typos are refused whole.context-budget,facts(facts --check --no-recordsin the project root, never--all),worktrees(merged, gone or stale worktrees and branches; its fix isgit worktree pruneonly),workflows-off,install-drift.<!-- gardener-report:NAME -->. Text a person writes above the marker is kept. A closed issue, or one whose marker was edited away, is left alone and a new issue is opened. The report repo may be public, so the issue is built from an allow-list: only repo-relative paths; findings outside the repo are counted (<outside repo>); paths (also Windows drive and UNC paths), URLs, IPv4/IPv6 addresses, e-mails anduser@hostin text are masked, and the root and home only as whole folders; a project check's own text and fix are shown only with"publicText": true(otherwise its id, count and location), and hidden findings show no id; a private project repo that reports to another, not-private repo publishes counts only (fail closed: an unreadable visibility counts as private); a failed check shows its id and exit code, never its stderr; the model endpoint is never shown. The full report stays on the machine (report.md). The whole body, a person's text too, is size-capped. Each run makes at most one issue read, two searches and one write, plus up to two visibility reads when the report repo is not the project repo. A GitHub error exits 1, but the done marker is already written: later ticks retry the issue alone, at most 3 times a day.--dry-runprints both reports and writes nothing.model {endpoint, model}, one OpenAI-style/chat/completionsrequest sends the public findings and a few capped git-tracked files (never ignored or untracked ones). Its answer is masked like the rest. Any endpoint error (non-HTTP too) is a note ("model unreachable"). There is no paid-model fallback.<stateDir>/<name>/state.jsonholds the done marker for the day (--forceruns again), the issue number, the pending-report retry count and the report repo (a changedreportReporuns the day again for the new repo). Writes are atomic. A lock per project. Missing, broken or old-version state is read as empty and noted in the report; a newer version is refused and kept. With quiet hours that wrap past midnight, the day is the window's start (one run per window).gardener-install(kit_install) and bootstrap--kit gardener [--timer], which writes hourly user timer units to/etc/systemd/user. Installing never enables the timer; it is not enabled on any machine.State question
Runs again the same day: nothing happens and no API call is made. Stopped half-way: before the done marker, the run starts again; after it, the saved
issue.mdis sent alone on the next tick, and the title/marker search finds an issue whose number was not saved, so no second issue is made. A report repo that keeps failing: 3 tries a day, the checks do not rerun. Old, empty or broken state: read as empty, with a note; old state withoutreportReporuns once more and finds its issue by title. Two runs at once: the second skips on the lock. One project failing does not stop the others. All of these have tests.Tests
fork-kit/gardener/tests/{run,report,checks,install}.test.py, 109 tests (38 + 30 + 31 + 10), all unittest and listed in.github/fork-ci-tests.txt. They cover:--forceRLIMIT_AS(stopped at the cap in under a second, the next project runs); aMemoryErrorin one check and in one project; an end-to-end privacy run of all five general checks plus a leaky project check, asserting no host, address, home path, private name or endpoint port reaches the issue; a junk-speaking model socket; a too-long hand-written head; repeated report failures; a newer state file; a window past midnight; branch names with shell characters; a fresh worktree, also one made fromorigin/main; a broken SKILL.md link; round 2: a sibling folder of the root,user@host, compressed IPv6, Windows and UNC paths,publicTextoff and on, counts only for a private project repo (and a failed visibility read), areportRepochange the same day, a~/path in fix hintsA RedCheck in run, report, checks and install breaks each guard and shows its test fails.
kit_install.test.py: 189 pass. Shared tests updated:kit_install.test.py(aGardenercontract class and bootstrap arms) andfork-ci-release.test.py(KITS row).General vs project
General (this PR): the runner, check contract, report issue, state, the five general checks, installer and timer templates. All of it lives in the fork, with no project named.
Project: which projects, repos, folders, budgets, schedules and project checks (by path) live only in each machine's
/etc/fork-kit/machine.json"gardener"section;machine.example.jsonuses placeholders. Test data uses only invented names (example-owner,client-acme,VM900,100.64.0.1). Phase 2 (turning it on for a project, project checks) is not in this PR.🤖 Generated with Claude Code