Skip to content
This repository was archived by the owner on Sep 27, 2026. It is now read-only.

Govern disk, gate merges, and find tokens where they live - #9

Merged
LopezAdan merged 1 commit into
mainfrom
fix/issues-4-5-6
Aug 13, 2026
Merged

LopezAdan merged 1 commit into
mainfrom
fix/issues-4-5-6

Conversation

@LopezAdan

Copy link
Copy Markdown
Contributor

One verified tree fixing all three open issues, gated and attested by this branch's own build of greentree.

Disk governance (#6)

  • min_free_disk in greentree.yaml: per-check > top-level > built-in 5G default; 0 disables. Human units (K/M/G/T, powers of 1024), overflow and exponent forms are config errors.
  • Pre-start refusal with new exit code 16 — no verdict, no anchor, no log; the message names the check, the floor, the free space, and the config key.
  • Mid-run: statvfs sampled in the existing supervision loop (≤1/s); below the floor the check is killed through the same SIGTERM→SIGKILL group escalation and recorded as non-cacheable disk_exhausted. A failed statvfs never kills a check; watch survives refusals and keeps watching.
  • Verdicts (schema v2) record disk_free_start_bytes / disk_free_min_bytes as filesystem-level observations, so floors can be set from evidence. Schema mismatches are now skipped explicitly, not accidentally.
  • Dogfood: this repo runs with a 2G backstop floor. The mid-run kill was verified live (a 2GB-writing check killed at 1.06s, nothing cached) — and the floor fired for real once during development when this box dipped below it.

Merge gating (#5)

  • Snapshot now answers only "is there an honest tree?": it refuses unmerged index entries and dirty submodules, nothing else. Resolved merges, cherry-picks, reverts, and rebase steps test and cache like any other tree.
  • Publish answers "can I create the commit git would create": merges get every MERGE_HEAD parent (octopus included), with stale heads filtered by ancestry so a leftover file can never mint a bogus second merge commit; cherry-pick/revert finalize single-parent and leave .git/sequencer for --continue; squash commits take SQUASH_MSG; message precedence is -m > squash/merge message (with git-faithful core.commentChar handling, auto included) > default. Rebase refuses at publish only, exit 12.
  • The publish journal carries the full parent list (schema 2) with back-compat reads of old single-parent journals; interrupted merge publishes resume idempotently. Post-ref-update housekeeping failures warn instead of reporting a false publish failure. The verdict cache is untouched — it was already tree-keyed and correct.

Token chain (#4)

  • GREENTREE_GITHUB_TOKEN → GITHUB_TOKEN → gh auth token --hostname github.com (5s timeout, process-group-killed, drained stdout, any failure falls through). Resolved once per publish, source logged, value never. The exit-15 error enumerates all three sources. This PR's own greentree/full status was posted through the fallback.

Process

Implemented as three changesets, then adversarially reviewed as a whole; the review confirmed 4 P1s and 9 P2s (stale-MERGE_HEAD double-merge hazard, watch dying on disk refusal, test-suite dependence on ≥5G free, the repo's own floor being unsatisfiable on its mandated box, commentChar=auto message loss, gh child leaks, and doc drift among them) — all fixed and covered by tests. One deliberate deferral: test still omits already-collected results from its JSON when a later check hits a pre-start refusal; the verdicts remain cached, so nothing is lost.

Tests: 67 passing (30 new across the three fixes and the review round). cargo clippy -D warnings and fmt --check clean. SPEC/README/SKILL/AGENTS exit-code tables and schema docs updated in lockstep.

Closes #4
Closes #5
Closes #6

🤖 Generated with Claude Code

Three fixes, one per open issue:

- Disk governance (#6): min_free_disk floor (per-check > top-level > 5G
  default, 0 disables), pre-start refusal with exit 16, mid-run statvfs
  sampling that kills through the existing escalation as non-cacheable
  disk_exhausted, and free-space observations in the verdict (schema v2).

- Merge gating (#5): snapshot refuses only trees that don't honestly
  exist (unmerged entries, dirty submodules). Publish creates the commit
  git would: multi-parent merges from MERGE_HEAD (octopus included,
  stale heads filtered by ancestry), cherry-pick/revert finalization,
  squash and MERGE_MSG message precedence with git-faithful commentChar
  handling, rebase refused at publish only. Journal carries the full
  parent list (schema 2, back-compat reads).

- Token chain (#4): GREENTREE_GITHUB_TOKEN -> GITHUB_TOKEN -> gh auth
  token, resolved once, source logged, never the value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Greentree-Change-Id: 5cfd4fdc9d3572e11dc3f2c42fec3730
@LopezAdan
LopezAdan merged commit 08da2c0 into main Aug 13, 2026
2 checks passed
@LopezAdan
LopezAdan deleted the fix/issues-4-5-6 branch August 13, 2026 19:30
LopezAdan added a commit that referenced this pull request Aug 13, 2026
Three fixes, one per open issue:

- Disk governance (#6): min_free_disk floor (per-check > top-level > 5G
  default, 0 disables), pre-start refusal with exit 16, mid-run statvfs
  sampling that kills through the existing escalation as non-cacheable
  disk_exhausted, and free-space observations in the verdict (schema v2).

- Merge gating (#5): snapshot refuses only trees that don't honestly
  exist (unmerged entries, dirty submodules). Publish creates the commit
  git would: multi-parent merges from MERGE_HEAD (octopus included,
  stale heads filtered by ancestry), cherry-pick/revert finalization,
  squash and MERGE_MSG message precedence with git-faithful commentChar
  handling, rebase refused at publish only. Journal carries the full
  parent list (schema 2, back-compat reads).

- Token chain (#4): GREENTREE_GITHUB_TOKEN -> GITHUB_TOKEN -> gh auth
  token, resolved once, source logged, never the value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Greentree-Change-Id: 5cfd4fdc9d3572e11dc3f2c42fec3730
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

1 participant