Merge Orchestration runtime · Kin.Gate lease storage + competence-weighted council#494
Merged
Merged
Conversation
…ed council
Two operationalisation pieces for the merge-orchestration runtime (brain-side).
Kin.Gate (the runtime tier .machine_readable lacked -- who is ACTING now):
* KinGate.decide_acquire/3 -- per-repo atomic acquire authority. Same-holder
re-acquire renews; a different holder on a live lease conflicts; an expired
lease is taken over. Enforces the a5 invariants in code, not just after the
fact: LE1 (a held lease always carries a TTL) by construction, LE2 (a meta
territory claim is refused without owner_authorized -- the reflexivity guard
at lease level).
* KinGate.FileStore -- one JSON per repo IS the per-repo lock; the contended
first-acquire goes through a real O_EXCL create so two racers cannot both
win. Jason codec injectable (tests run dep-free).
Kin.Competence (make the council competence-aware; it was uniform):
* KinCompetence.weight_fn -- weight = GoT trust(bot) x domain competence,
where the specialist (the route authority for the change-class) counts in
full and a generalist is discounted. A zero-trust bot gets weight 0.0, which
KinCouncil reads as recuse: its APPROVAL stops counting while its VETO stays
monotone. Pure over a trust snapshot, so Strategist/KinCouncil stay I/O-free.
* Strategist.route_authority/1 made public -- single source of truth for 'who
is the specialist', shared by routing and weighting.
54 ExUnit (was 39): +9 KinGate (mint/conflict/renew/expiry/LE1/LE2/FileStore),
+6 KinCompetence (specialist/generalist/recuse/weighted-mean/end-to-end-demote/
GoT-snapshot). 0 failures, local elixir 1.14, mix-format-clean.
🔍 Hypatia Security ScanFindings: 42 issues detected
View findings[
{
"reason": "Repository has 5 non-main remote branch(es). Policy: single main branch only.",
"type": "GS007",
"file": ".",
"action": "delete_remote_branches",
"rule_module": "git_state",
"severity": "medium"
},
{
"reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 11 day(s) old",
"type": "CSA001",
"file": "src/ui/gossamer/README.adoc",
"action": "review",
"rule_module": "code_scanning_alerts",
"severity": "medium"
},
{
"reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 11 day(s) old",
"type": "CSA001",
"file": "scripts/ci-tools/Cargo.toml",
"action": "review",
"rule_module": "code_scanning_alerts",
"severity": "medium"
},
{
"reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 11 day(s) old",
"type": "CSA001",
"file": "scripts/bench-tools/Cargo.toml",
"action": "review",
"rule_module": "code_scanning_alerts",
"severity": "medium"
},
{
"reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 11 day(s) old",
"type": "CSA001",
"file": "ffi/zig/README.adoc",
"action": "review",
"rule_module": "code_scanning_alerts",
"severity": "medium"
},
{
"reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 11 day(s) old",
"type": "CSA001",
"file": "docs/reports/audit/audit-2026-04-15-post.md",
"action": "review",
"rule_module": "code_scanning_alerts",
"severity": "medium"
},
{
"reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 11 day(s) old",
"type": "CSA001",
"file": "docs/integration/github-registry.adoc",
"action": "review",
"rule_module": "code_scanning_alerts",
"severity": "medium"
},
{
"reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 11 day(s) old",
"type": "CSA001",
"file": "docs/integration/github-registry.adoc",
"action": "review",
"rule_module": "code_scanning_alerts",
"severity": "medium"
},
{
"reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 11 day(s) old",
"type": "CSA001",
"file": "docs/integration/a2ml-k9.md",
"action": "review",
"rule_module": "code_scanning_alerts",
"severity": "medium"
},
{
"reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 11 day(s) old",
"type": "CSA001",
"file": "docs/architecture/system-integration.md",
"action": "review",
"rule_module": "code_scanning_alerts",
"severity": "medium"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
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.
Two brain-side operationalisation pieces (owner order: items 2 then 3)
The runtime spine is on
main; this adds the coordination tier it was missing and makes the council competence-aware. Both are pure-core + thin-I/O, in the established style.Item 2 — Kin.Gate lease storage (the runtime tier)
.machine_readable/was declarative (contractiles) + validating (k9) but had no record of who is acting right now. A lease (a5CoordinationLease) fills it;KinGateis the atomic-acquire authority.KinGate.decide_acquire/3(pure) — "one bot per repo at a time". Same-holder re-acquire renews; a different holder on a live lease conflicts; an expired lease is taken over. It enforces the schema invariants in code, not just after the fact:heldlease always carries anexpires_at(TTL), by construction. A crashed agent's claim self-expires; no immortal locks.bot_directives/ contractiles /standards) is refused withoutowner_authorized. The reflexivity guard at lease level — an agent can't self-authorise a meta claim.KinGate.FileStore— one JSON per repo is the per-repo lock. The contended first-acquire goes through a realO_EXCLcreate (File.open(_, [:write, :exclusive])) so two racers can't both win; the loser re-evaluates against the winner and gets:conflict. Jason codec injectable so the logic tests run dependency-free.Item 3 — competence-weighted Kin Council
The council was uniform (every approving bot counted
1.0).KinCompetencegrounds the weight in two signals the estate already computes:KinCompetence.weight_fn—weight = GoT trust(bot) × domain competence, where the specialist (the route authority for the change-class: echidnabot⇄proof, patch-bridge⇄bump, panicbot⇄security, …) counts in full and a generalist is discounted (0.5). A zero-trust bot gets weight0.0, whichKinCouncilreads as recuse: its approval stops counting, while its veto stays monotone (vetoes are never weighted). Pure over a trust snapshot, soStrategist/KinCouncilstay I/O-free.Strategist.route_authority/1made public — a single source of truth for "who is the specialist", shared by routing and weighting.Testing (actual, not looks-right)
54 ExUnit, 0 failures (was 39) under Elixir 1.14, mix-format-clean:
live?/expired?, and a FileStore round-trip (acquire → rival conflicts → release frees → rival takes it). Plus a Jason-guarded pass over the real a5valid-held.jsonfixture.(0.9·0.6 + 0.5·1.0)/1.4), an end-to-end demote (aproofPR whose only approval is a zero-trust bot →confidence 0.0→:flag), authority-derived-from-change-class, and the GoT snapshot reader.I verified scanner-cleanliness against Hypatia's own
code_safetyrules before pushing (the one flagged pattern,:erlang.binary_to_term, is in the dep-free test codec only, andtest/iscode_safety-exempt perscanner_suppression.ex).Scope / safety
lib/, your review.route_authority(was privatecond, now a public function used by both routing and weighting).Where this leaves it
Items 2 + 3 of the
2 → 1 → 3operationalisation. Item 1 (the token-bearing observation producer) lands separately in.git-private-farm— it holds the PAT; the brain doesn't. The remaining work is wiringFileStore+KinCompetenceinto the live operational loop (producer → store → sense → decide → gate → actuate).Generated by Claude Code