code wiki / _hdl_build / nx_conductor_recall.nx
nx_conductor_recall.nx source
↩ module page · 49 lines · 3144 B
1// nx_conductor_recall.nx -- RUNG 3 of the recall-or-RED guarantee: wires the KNOWN-ISSUE catalogue
2// into the live self-heal give-up path so the team never SILENTLY says "can't identify/fix this" for
3// an issue it has SEEN before. ADDITIVE: nx_self_heal_conductor stays BYTE-IDENTICAL (the GALX-PROD-
4// FULL additive-sibling precedent); this composes it with ki_recall.
5//
6// RACI-correct (the fixer never blesses its own work): recall does NOT auto-apply. It RECOGNIZES +
7// ROUTES + REPORTS -- converting a silent COND_UNFIXABLE into a NAMED COND_SEEN (id + remedy +
8// status) that the Council/operator can act on. Auto-apply would bypass Warden/Council, so it stays
9// out of band. The decision is factored into a PURE function (cond_recall_verdict) so the gate proves
10// the give-up->recall conversion hermetically (no compiler needed); the live wrapper just feeds it the
11// Engineer's captured diagnostic.
12// license_tier: ORIGINAL
13import "nx_self_heal_conductor.nx" // cond_heal_beat + COND_CLEAN(100)/COND_UNFIXABLE(101)
14import "nx_known_issue_store.nx" // ki_recall + KI_PREFIX + KI_HIT/KI_UNKNOWN
15import "nx_syscalls.nx"
16
17const COND_SEEN: i64 = 102 // primary loop gave up, but the catalogue RECALLED it -> named + routed
18
19// PURE decision layer (hermetic-testable). If the primary heal verdict is NOT a give-up, pass it
20// straight through -- recall never meddles with CLEAN / council / success outcomes. If it gave up
21// (COND_UNFIXABLE), consult the catalogue under `prefix`: a HIT means we have SEEN this signature ->
22// COND_SEEN with the recalled id/remedy/status in the outs (route for Council/operator); UNKNOWN
23// means genuinely novel -> COND_UNFIXABLE stays legal. THIS is the no-unseen-repeat law at give-up.
24func cond_recall_verdict(prefix: *u8, prim: i64, diag: *u8, dlen: i64, outid: *u8, outrem: *u8, outstat: *u8) -> i64 {
25 if prim != COND_UNFIXABLE { return prim }
26 let r: i64 = ki_recall(prefix, diag, dlen, outid, outrem, outstat)
27 if r == KI_HIT { return COND_SEEN }
28 return COND_UNFIXABLE
29}
30
31// LIVE recall-gated beat: run the standard Warden->Engineer->Doctor->Engineer->Council beat; if it
32// gives up, RECALL against the production catalogue (knowledge/store/ki-) using the diagnostic the
33// Engineer captured to /tmp/cond.err. Composition of two gated parts (cond_heal_beat is proven by the
34// self-heal gate; cond_recall_verdict by nx_conductor_recall_gate).
35func cond_heal_beat_recall(compiler: *u8, orig: *u8, candidate: *u8, out: *i64, outid: *u8, outrem: *u8, outstat: *u8) -> i64 {
36 let prim: i64 = cond_heal_beat(compiler, orig, candidate, out)
37 if prim != COND_UNFIXABLE { return prim }
38 let lenp: *i64 = sys_mmap(16) as *i64
39 let diag: *u8 = sys_read_file("/tmp/cond.err" as *u8, lenp)
40 var dlen: i64 = lenp[0]
41 if dlen < 0 { dlen = 0 }
42 return cond_recall_verdict(KI_PREFIX, prim, diag, dlen, outid, outrem, outstat)
43}
44
45// human-readable verdict name (extends cond_beat_name with the recall outcome)
46func cond_recall_name(v: i64) -> *u8 {
47 if v == COND_SEEN { return "SEEN (recalled from catalogue -> routed)" as *u8 }
48 return cond_beat_name(v)
49}