mesh-knowledge: review every proposal in a judgement of its own, and serve no review verb (hq issue 425, ADR 0290 as updated)
mesh/merge-gate pass: builds mesh-knowledge → novox; no bus step; every machine composes with the change as it did without (4 of 4 compose)
mesh/repo-check pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-check-typescript.sh (typescript)
mesh/delivery superseded: a newer head of the same pull request
mesh/merge-gate pass: builds mesh-knowledge → novox; no bus step; every machine composes with the change as it did without (4 of 4 compose)
mesh/repo-check pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-check-typescript.sh (typescript)
mesh/delivery superseded: a newer head of the same pull request
The mesh proves which machine called, not which agent on it (hq issue 365), so a review verb could not tell a reviewer from the author. Each version proposed is now judged by claude-code.claude_code_judge in a separate call that sees only the record, the records it links and the rules: approve accepts (or asks the operator for a needs-operator record), changes keeps it proposed with the findings for its author, and a judgement that cannot be had or read leaves it proposed, says so, and never counts as approval.
This commit is contained in:
@@ -234,11 +234,18 @@ func (tr *tracker) reserve(kind, title string) (int, error) {
|
||||
}
|
||||
|
||||
// judge is the agent's judgement, played: it drafts a clause from each sentence of a section that says "is", "are"
|
||||
// or "decid", confirms every clause but those whose text holds "NOT EXACT", and names clause 1 for a change.
|
||||
// or "decid", confirms every clause but those whose text holds "NOT EXACT", names clause 1 for a change, and
|
||||
// approves every record it reviews unless told otherwise.
|
||||
type judge struct {
|
||||
mu sync.Mutex
|
||||
questions []string
|
||||
fail bool
|
||||
// review is the answer a review gets, raw; approve when empty. reviewFail fails every review. during runs
|
||||
// inside a review's judgement, while the knowledge base waits for it.
|
||||
review string
|
||||
reviewFail bool
|
||||
reviews []string
|
||||
during func()
|
||||
}
|
||||
|
||||
func (j *judge) judge(question string, schema map[string]any, model string) (json.RawMessage, string, error) {
|
||||
@@ -250,6 +257,21 @@ func (j *judge) judge(question string, schema map[string]any, model string) (jso
|
||||
}
|
||||
props := schema["properties"].(map[string]any)
|
||||
switch {
|
||||
case props["verdict"] != nil:
|
||||
j.reviews = append(j.reviews, question)
|
||||
if during := j.during; during != nil {
|
||||
j.during = nil
|
||||
j.mu.Unlock()
|
||||
during()
|
||||
j.mu.Lock()
|
||||
}
|
||||
if j.reviewFail {
|
||||
return nil, "", fmt.Errorf("nothing answers claude-code.claude_code_judge")
|
||||
}
|
||||
if j.review != "" {
|
||||
return json.RawMessage(j.review), "the agent on test (" + model + ")", nil
|
||||
}
|
||||
return json.RawMessage(`{"verdict":"approve","findings":[]}`), "the agent on test (" + model + ")", nil
|
||||
case props["verdicts"] != nil:
|
||||
var verdicts []map[string]any
|
||||
for _, line := range strings.Split(question[strings.Index(question, "The drafted clauses:"):], "\n") {
|
||||
@@ -410,6 +432,36 @@ func imported(t *testing.T, s Store) *world {
|
||||
return w
|
||||
}
|
||||
|
||||
// reviewAll takes every review waiting, as the background work does, and answers what each step said.
|
||||
func (w *world) reviewAll(t *testing.T) []string {
|
||||
t.Helper()
|
||||
var said []string
|
||||
for i := 0; i < 20; i++ {
|
||||
s, err := w.k.ReviewStep()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if s == "" {
|
||||
return said
|
||||
}
|
||||
said = append(said, s)
|
||||
}
|
||||
t.Fatalf("the reviews never ended: %v", said)
|
||||
return nil
|
||||
}
|
||||
|
||||
// accepted proposes a valid record under a reserved number and has the knowledge base's review approve it.
|
||||
func (w *world) accepted(t *testing.T, author string, p ProposeAsk) {
|
||||
t.Helper()
|
||||
if _, err := w.k.Propose(author, p); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
w.reviewAll(t)
|
||||
if e := mustGet(t, w.k.Store, Key{p.Kind, p.Number}); e.Pending != nil || !e.Current.Accepted() {
|
||||
t.Fatalf("%s not accepted after its review: %s, %+v", Key{p.Kind, p.Number}, e.Current.Status, e.Working().Judging)
|
||||
}
|
||||
}
|
||||
|
||||
// reserved reserves a decision number and answers it.
|
||||
func (w *world) reserved(t *testing.T, caller string) int {
|
||||
t.Helper()
|
||||
|
||||
Reference in New Issue
Block a user