Skip to content

harness: enforce hard rules with git guard, hooks, invariant registry; slot keeper and flow gates - #63

Merged
thomashan merged 203 commits into
mainfrom
docs/harness-20261127
Nov 28, 2026
Merged

thomashan merged 203 commits into
mainfrom
docs/harness-20261127

Conversation

@thomashan

Copy link
Copy Markdown
Contributor

Summary

Harness control-plane work for the Holon flow: turns the hard rules in .agents/ into enforced gates (git hooks,
validators, invariant registry), adds the coordinator tooling that keeps up to 8 flows running, and backfills the bean
/ triage / failure-ledger bookkeeping through HAC #456 and Coherence #94.

Squash-merge on merge (201 commits, harness bookkeeping throughout).

Changes

Enforcement tooling (14 new scripts + git hooks)

  • git_guard.py + .agents/bin/git: blocks forbidden git operations (stash, --no-verify, add -A/add .) and
    edits/builds in a main worktree, including inside a REPL shell.
  • harness_commit.py + harness_lock.py: single-writer path for the shared harness branch (lock, empty index,
    prettier, staged-blob validation, commit, push).
  • staged_validation.py, check_commit_trailers.py, check_main_worktrees.py: commit-msg and pre-commit hooks
    installed by install_git_hooks.py (idempotent).
  • stamp.py + timestamps.py: UTC timestamps are generated, never typed; check_beans.py and
    check_failure_ledger.py reject future, malformed, misordered or post-commit values.
  • new_bean.py: sequential 4-digit bean ids enforced at creation.
  • invariant_registry.py + .agents/invariants.yml: every hard rule must have a named automatic check;
    test_invariant_registry.py fails on a missing or partial entry.
  • slot_keeper.py: flow-slot accounting with event triggers and reasons; defaults to antigravity-agent/gemini-4-neon.
  • pr_readiness.py: per-head readiness gate for merge/post-merge.
  • skills/holon_flow/scripts/flow_gates.py and intent_coverage.py: Stage gates and bean-acceptance coverage before
    an intent is launched.

Tests

11 new suites (git_guard, harness_commit, stamp, slot_keeper, pr_readiness, invariant_registry,
intent_coverage, flow_gates, check_beans, check_commit_trailers, check_main_worktrees) and 3 updated; 454
tests pass locally. .github/workflows/test-hygiene.yml extends CI coverage.

Docs and bookkeeping

  • AGENTS.md and .agents/{rules,workflows,worktrees-and-git,pr-merging,coordination,subagents,submodules,self-improvement-audit}.md:
    hard-rule wording updated to point at the checks that now enforce them.
  • 85 new + 52 updated beans, refreshed .beans/bean-triage-prioritisation.md, docs/ecosystem-audit-report-2026-11.md,
    and the .agents/ledger/coordinator-failures.jsonl rows through CF-0083.

Verification

  • uv run pytest -q → 454 passed
  • npx prettier --check "**/*.md" → clean

PR #356 (secret-bundle-private-files) merged into main as d3c68686. Bean 0532 stays in-progress with the remaining scope and two follow-ups; bean 0153 notes the two docstrings PR #356 added to agent_runner.py.
… PR #351 merge

PR #351 (flow single-runner-per-checkpoint, merged at 2f29d8c) delivered the per-slug run lock and the
child reaping on halt (beans 0390 target side and 0472). Bean 0390 stays in-progress for its harness-side
items. Bean 0518 closed: shared repo identity keys are gone. Bean 0153 notes the PR's docstring and comment lines.
Triage matrix refreshed.
Comment thread tests/test_intent_coverage.py Resolved
Comment thread tests/test_intent_coverage.py Resolved
…CF-0084

Ruff check and ruff format --check, both enforced by test-hygiene.yml, failed on
the branch PR #63 opened from: pr_readiness.py author ternary, calibration path
filter, cal_files_note and the head-SHA report row, plus the ready-line call in
test_pr_readiness.py.

Bot findings 4726411239, 4726411254, 4726411265 (implicit string concatenation in
a list) are rejected as false positives: the bean_progress.py pair is one --json
argv token and gh exits 1 on the split; splitting the two test_intent_coverage.py
items fails 9 tests because each is one acceptance criterion.

Action-Origin: pr_review
Review-Severity: nit
Review-Iteration: 1
Review-Finding-Ids: 4726411239,4726411254,4726411265
…ed out

tests/test_invariant_registry.py asserted that every path in .agents/invariants.yml
exists, but 41 of those checks live in apps/holon-agentic-coder/main and
apps/holon-coherence/main, which .gitignore excludes and CI never has, so
test_every_referenced_check_exists and test_the_script_exits_zero_on_the_real_registry
could only pass on a machine with both targets checked out and failed hygiene in CI.

invariant_registry now resolves apps/ references only when apps/ is present, still
rejects a target reference that is not under a main worktree, and prints the count of
checks it could not verify; the suite covers all three paths.

Action-Origin: pr_review
Review-Severity: important
Review-Iteration: 1
Review-Finding-Ids: ci-hygiene-pytest
@thomashan

Copy link
Copy Markdown
Contributor Author

Review pass 1 resolved at dfe7751; hygiene and Analyze (python) both pass.

Applied

  • Ruff (enforced by test-hygiene.yml, missed when this PR was opened — CF-0084): 4 E501 in pr_readiness.py, 1 in test_pr_readiness.py, and 2 unformatted files.
  • Failing test: tests/test_invariant_registry.py asserted that every path in .agents/invariants.yml exists, but 41 of those checks live in apps/holon-agentic-coder/main and apps/holon-coherence/main, which .gitignore excludes and CI never checks out. invariant_registry.py now resolves apps/ references only where the targets are present, still rejects a target reference outside a main worktree, and prints the number of checks it could not verify; three tests pin all three paths. Reproduced red and green in a clean clone without apps/ before pushing.

Rejected (all three bot comments, threads resolved)

bean_progress.py:871 is the single value of gh's --json flag: adding the comma splits one argv token and gh exits 1 with unknown argument "mergeStateStatus,...". test_intent_coverage.py:29 and :47 are single acceptance criteria; applying the comma there fails 9 tests. Evidence in the thread replies.

Not merged — merging a main-targeted PR stays with the maintainer.

@thomashan
thomashan added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit 0507140 Nov 28, 2026
2 checks passed
@thomashan
thomashan deleted the docs/harness-20261127 branch November 28, 2026 10:03
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