Repository navigation
Commit b8dff3d
Gate knowledge PRs the service did not open, and issue human-approved verdicts
Two paths from the design that had no service side yet. Human-written
knowledge PRs (source 4) need a signed verdict from the gate. PRs that the
auto gate cannot pass (knowledge/tools, skills, ...) need a knowledge
maintainer's approval turned into a human-approved verdict. Until now every
such PR failed kb-gate forever.
- external.poll_external runs from the scheduler (lease held, not globally
paused). It takes each open, non-draft PR that touches knowledge/ and was
not opened by the service, and judges it once per head and path (auto or
human), so a head sent to people on the auto path is judged again as soon
as a maintainer approves it, without a new push:
- kb:human-approved with a knowledge maintainer's (CODEOWNERS of
.github/kb-gate/ on main) standing approval of the CURRENT head: L1 on
the governed pages (the approval replaces the whitelist and L2, never the
rest of L1), then a signed human-approved verdict bound to those reviews.
A later review by the same person replaces an earlier one, read across
every page of reviews;
- otherwise, all paths governed: the full gate (L1, L2, consistency) on
current main plus the PR's changes; a pass gets an auto verdict. The PR's
pre-images must equal main's, or the author is asked to rebase;
like the service's own PRs, an auto verdict needs a current passing
judge calibration (calibration_required otherwise, re-judged only once
calibration is current, so no repeated paid judge calls);
- anything else goes to people once per head.
- The verdict manifest comes straight from git (the full merge-base..head raw
diff), so it covers non-governed paths; context_base_sha is main at judging.
Tests run the real kb-gate verifier on both kinds of verdict.
- An external change set follows the ordinary merge flow. A new head
(head_changed) or a moved context (stale_context) is judged again at the
next poll instead of going to people, and an author closing their own PR
does not trip the overturn breaker.
- A withdrawn approval stops the PR. After signing, every pass re-checks that
each named maintainer's latest review still approves the signed head; if
not, it goes to people and a pause item dequeues it and makes it a draft.
It keeps its status, and so the repository's queue slot, until that pause
is acked (a failed pause is retried), and only then becomes
approval_withdrawn. Until then it keeps holding the queue slot even if it
was verdict_posted with an enqueue in flight, since it may have been queued
meanwhile. A pause acked while an earlier signed enqueue could still run
(the publisher may execute them in either order) does not complete it: the
pause is repeated once that enqueue has certainly expired (plus a clock-skew
margin). Completion is decided by when the acked pause was ISSUED (recorded
on the pending item), never by when its ack arrived. The enqueue expiry is
recovered at withdrawal from every durable record (the recorded value, the
pending item, and unacked signed enqueue items still in the outbox), so a
restart or a pre-upgrade change set cannot lose it. Remaining approvals
never re-stage that head. The kb-gate verifier (bundle
regenerated) now also checks each reviewer's latest review, not only that
the bound review still reads APPROVED.
- External change sets carry no operations, so the rules L1 finds them
retiring or purging are stored and entered in the retirement ledger on
merge, like our own, so later release sweeps can purge them.
- KnowledgeRepo gains fetch_pull (a PR head fetched as data, never checked
out), merge_base, show and raw_manifest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent 87ebb46 commit b8dff3d
11 files changed
Lines changed: 900 additions & 8 deletions
File tree
- .github/kb-gate
- doc/architecture/SPEC
- src/infermatrix_copilot
- kb_service
- knowledge_service
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
547 | 560 | | |
548 | 561 | | |
549 | 562 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
0 commit comments