code wiki / _hdl_build / nx_issue_intake.nx

nx_issue_intake.nx source

↩ module page · 80 lines · 5581 B

1// nx_issue_intake.nx -- AUTOMATIC issue -> PM assignment intake (operator: "have the team automatically 2// pickup assignments when we see issues to get tutored on fixing, like the nondeterministic"). Any monitor, 3// gate, or loop that OBSERVES an issue files it here; the PM auto-prioritizes (WSJF = severity*impact/effort 4// via the decision matrix), routes it (TEAM-OWNED -> work now | NOVEL -> tutor), logs it as a tracked 5// assignment, and the team auto-picks the top. This is the standing intake the monitors call. Composes 6// nx_pm_decision_matrix + nx_pm_review_log. license_tier: ORIGINAL 7import "nx_pm_decision_matrix.nx" 8import "nx_pm_review_log.nx" 9import "nx_syscalls.nx" 10 11func ii_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 12func ii_num(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=48+(m%10);m=m/10;k=k+1}; var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1}; sys_write(1,b,k); return 0 } 13 14func main() -> i64 { 15 ii_puts("=== ISSUE INTAKE -> PM auto-assignment (team auto-picks up; tutored where novel) ===\n\n" as *u8) 16 let N: i64 = 2 17 let title: *i64 = sys_mmap(8*N) as *i64 18 let sev: *i64 = sys_mmap(8*N) as *i64 // severity/impact 0..10 (how bad if unfixed) 19 let eff: *i64 = sys_mmap(8*N) as *i64 // build-units 20 let owned: *i64 = sys_mmap(8*N) as *i64 // 1 = team OWNS the fix capability (work now) ; 0 = pure tutor 21 let tutor: *i64 = sys_mmap(8*N) as *i64 // 1 = needs Claude tutoring on the fix approach 22 let fix: *i64 = sys_mmap(8*N) as *i64 // the routed fix approach 23 24 // --- Issue #1 (operator-named): nondeterministic compiler emits large-but-broken .s --- 25 title[0]="nondeterministic known-good compiler: large-but-broken .s (runs, exit 0, NO output)" as *u8 as i64 26 sev[0]=8; eff[0]=3; owned[0]=1; tutor[0]=1 27 fix[0]="TEAM builds a SMOKE-VERIFY+retry guard into nx_build_run: after link, run a tiny self-check of the ELF; if a known-good module produces no expected marker, recompile (current retry only catches EMPTY .s, not large-but-broken). Claude tutors the smoke-marker design." as *u8 as i64 28 29 // --- Issue #2 (observed): daemon build 10.72s slightly over the <10s target --- 30 title[1]="sites daemon build 10.72s > 10s target (baked wiki content bloats the translation unit)" as *u8 as i64 31 sev[1]=4; eff[1]=4; owned[1]=1; tutor[1]=0 32 fix[1]="TEAM moves the baked wiki/article BODY_* consts to FILES served by the router (data-driven); the daemon shrinks below the <10s threshold and content becomes hot-swappable. Already have the router." as *u8 as i64 33 34 // auto-prioritize: WSJF = (severity as Cost-of-Delay) / effort 35 let wsjf: *i64 = sys_mmap(8*N) as *i64 36 var i: i64 = 0 37 while i < N { wsjf[i] = dm_wsjf(sev[i]*10, eff[i]); i = i + 1 } 38 39 let ifd: i64 = sys_openat_append("/tmp/nishi_issues.log" as *u8, 0x1a4) 40 pm_w(ifd, "\n# ISSUE INTAKE 2026-06-06 (auto -> PM assignments)\n" as *u8) 41 let pm: i64 = pm_open("/tmp/nishi_pm_review.log" as *u8) 42 43 let picked: *i64 = sys_mmap(8*N) as *i64; i=0; while i<N { picked[i]=0; i=i+1 } 44 let ready: *i64 = sys_mmap(8*N) as *i64; i=0; while i<N { ready[i]=1; i=i+1 } // all filed issues are workable 45 var rank: i64 = 0 46 while rank < N { 47 let pick: i64 = dm_next_pick(wsjf, picked, ready, N) 48 if pick < 0 { rank = N } else { 49 picked[pick]=1 50 ii_puts("ISSUE #" as *u8); ii_num(rank+1); ii_puts(" wsjf=" as *u8); ii_num(wsjf[pick]) 51 ii_puts(" sev=" as *u8); ii_num(sev[pick]); ii_puts("\n " as *u8); ii_puts(title[pick] as *u8); ii_puts("\n -> FIX: " as *u8); ii_puts(fix[pick] as *u8) 52 if tutor[pick]==1 { ii_puts("\n -> ROUTING: TEAM works it + CLAUDE TUTORS the approach.\n\n" as *u8) } 53 else { ii_puts("\n -> ROUTING: TEAM-OWNED (no tutoring needed).\n\n" as *u8) } 54 pm_w(ifd, "ASSIGN " as *u8); pm_w(ifd, title[pick] as *u8); if rank==0 { pm_w(ifd, " status=AUTO-PICKED\n" as *u8) } else { pm_w(ifd, " status=QUEUED\n" as *u8) } 55 if tutor[pick]==1 { 56 pm_flag(pm, "ISSUE-TUTOR" as *u8, "auto-intake" as *u8, "NEEDS-TUTOR" as *u8, title[pick] as *u8, fix[pick] as *u8) 57 } else { 58 pm_flag(pm, "ISSUE-ASSIGN" as *u8, "auto-intake" as *u8, "TEAM-OWNED" as *u8, title[pick] as *u8, fix[pick] as *u8) 59 } 60 rank = rank + 1 61 } 62 } 63 sys_close(ifd); sys_close(pm) 64 65 // auto-pickup: the top issue is now the team's next work item 66 var top: i64 = 0; var bs: i64 = 0-1; i=0 67 while i<N { if wsjf[i] > bs { bs = wsjf[i]; top = i } i=i+1 } 68 ii_puts(">>> TEAM AUTO-PICKS UP: " as *u8); ii_puts(title[top] as *u8); ii_puts("\n" as *u8) 69 if tutor[top]==1 { ii_puts(">>> Claude will TUTOR the fix; Engineer gates it before it lands.\n" as *u8) } 70 71 // self-check: intake ranks the higher-severity-per-effort issue first and files every issue 72 let r: *i64 = sys_mmap(8*4) as *i64 73 r[0]=0; if top==0 { r[0]=1 } // nondeterministic (sev8/eff3=266) outranks daemon-size (sev4/eff4=100) 74 r[1]=0; if wsjf[0] > wsjf[1] { r[1]=1 } 75 r[2]=0; if tutor[0]==1 { r[2]=1 } // novel-fix issue correctly flagged for tutoring 76 var pass: i64=0; var j: i64=0; while j<3 { pass=pass+r[j]; j=j+1 } 77 ii_puts("---- intake self-check passed " as *u8); ii_num(pass); ii_puts("/3 ----\n" as *u8) 78 if pass==3 { sys_exit(0); return 0 } 79 sys_exit(1); return 1 80}