← Commit history
AI Flow 0.2.91: overlapping saves keep the newer step (#219)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
14 files changed
+120−28
Cargo.lock+10−10Cargo.toml+1−1SKILL.md+1−1bin/adom-aiflowcrates/adom-aiflow/src/export.rs+1−1crates/adom-aiflow/src/main.rs+3crates/adom-aiflow/src/preboard.rs+18−1crates/aiflow-run/src/lib.rs+60docs/release-0.2.91.md+12package.json+1−1page.json+1−1skills/adom-aiflow/SKILL.md+1−1skills/aiflow-sourcing/SKILL.md+2−2tests/dashboard-workflow.py+9−9Cargo.lock+10−10@@ -4,7 +4,7 @@ version = 4 [[package]] name = "adom-aiflow"-version = "0.2.90"+version = "0.2.91" dependencies = [ "aiflow-analyze", "aiflow-board",@@ -25,7 +25,7 @@ dependencies = [ [[package]] name = "aiflow-analyze"-version = "0.2.90"+version = "0.2.91" dependencies = [ "aiflow-board", "serde",@@ -35,7 +35,7 @@ dependencies = [ [[package]] name = "aiflow-board"-version = "0.2.90"+version = "0.2.91" dependencies = [ "roxmltree", "serde",@@ -44,7 +44,7 @@ dependencies = [ [[package]] name = "aiflow-bridge"-version = "0.2.90"+version = "0.2.91" dependencies = [ "aiflow-board", "serde",@@ -53,7 +53,7 @@ dependencies = [ [[package]] name = "aiflow-copper"-version = "0.2.90"+version = "0.2.91" dependencies = [ "aiflow-board", "aiflow-grid",@@ -63,7 +63,7 @@ dependencies = [ [[package]] name = "aiflow-grid"-version = "0.2.90"+version = "0.2.91" dependencies = [ "aiflow-board", "serde",@@ -72,7 +72,7 @@ dependencies = [ [[package]] name = "aiflow-place"-version = "0.2.90"+version = "0.2.91" dependencies = [ "aiflow-board", "serde",@@ -81,7 +81,7 @@ dependencies = [ [[package]] name = "aiflow-pours"-version = "0.2.90"+version = "0.2.91" dependencies = [ "aiflow-board", "aiflow-copper",@@ -91,7 +91,7 @@ dependencies = [ [[package]] name = "aiflow-router"-version = "0.2.90"+version = "0.2.91" dependencies = [ "aiflow-board", "aiflow-grid",@@ -101,7 +101,7 @@ dependencies = [ [[package]] name = "aiflow-run"-version = "0.2.90"+version = "0.2.91" dependencies = [ "serde", "serde_json",
Cargo.toml+1−1@@ -14,7 +14,7 @@ members = [ ] [workspace.package]-version = "0.2.90"+version = "0.2.91" edition = "2021" license = "MIT" repository = "https://wiki.adom.inc/adom/adom-aiflow"
SKILL.md+1−1@@ -588,7 +588,7 @@ The plan needs provenance: the plan `pour` wrote (its hash is recorded in the ru ### Silk-only adoption keeps copper evidence -`adopt-board` compares the copper fingerprint of the current and adopted boards: tracks, vias, zones with settings, pads with geometry, net and drill, footprint placement, outline, stackup, nets and project rules, but not silkscreen, fab, courtyard, text or 3D models. When it is unchanged, gate, land, measure, the analyses, place verify and the Fields report are kept, with a carry record holding both board hashes and the fingerprint. Every board-hash check accepts the older board only through that record, re-verified from both snapshot files. Any copper change, an unreadable rule file or a non-KiCad board invalidates the evidence as before. The silkscreen and export proofs are always dropped; record them again.+Before `adopt-board` on a board your own scripts built, declare the step whose work it carries (`step placement` for placed parts, `step routing` for routed copper, `step pours` for zones), so the adoption and the commands after it are charged to that step. `adopt-board` compares the copper fingerprint of the current and adopted boards: tracks, vias, zones with settings, pads with geometry, net and drill, footprint placement, outline, stackup, nets and project rules, but not silkscreen, fab, courtyard, text or 3D models. When it is unchanged, gate, land, measure, the analyses, place verify and the Fields report are kept, with a carry record holding both board hashes and the fingerprint. Every board-hash check accepts the older board only through that record, re-verified from both snapshot files. Any copper change, an unreadable rule file or a non-KiCad board invalidates the evidence as before. The silkscreen and export proofs are always dropped; record them again. ### Holes with no copper
bin/adom-aiflow⋯ 1 unchanged line ⋯
crates/adom-aiflow/src/export.rs+1−1@@ -422,7 +422,7 @@ pub fn order_files(board_path: &str, stem: &str, profile: Option<&str>, sourcing let video_line = format!("A video of this board: now that it is finished, offer the human a narrated walkthrough video for their project page and YouTube, `{video_init}` then `adom-aiflow-video next`{video_install}. They can narrate it themselves, with their face in a corner and drawings on the film. It is an offer, not a step: skip it when they say no."); let mut hints = vec![format!("{stem}-bom.csv and {stem}-cpl.csv are AI Flow's review files (KiCad rotations and origins), not a fab's upload format: no fab's assembly upload takes them as they are. {} says which file goes where.", ORDER_NOTE)]; hints.extend([jlc_line.clone(), pcbway_line.clone(), other_line.clone(), video_line]);- let fab = match profile { Some("jlcpcb") => "jlcpcb (JLCPCB parts preferred)", Some(_) => "fab (the 3rd party fab profile)", None => "not named in the spec or requirements" };+ let fab = match profile { Some("jlcpcb") => "jlcpcb (JLCPCB parts preferred)", Some("self") => "self (built and assembled by the user)", Some(_) => "fab (the 3rd party fab profile)", None => "not named in the spec or requirements" }; let note = format!("# Order files for {stem}\n\nWritten by `adom-aiflow export`. Fab profile of this run: {fab}.\n\n\ | File | For |\n|---|---|\n\ | `gerbers/` (copper, mask, paste, silkscreen, Edge.Cuts; Excellon drill) | Every fab: zip the folder for the upload. |\n\
crates/adom-aiflow/src/main.rs+3@@ -7934,6 +7934,9 @@ fn main() { let vh = json!({"board": vh_b, "spec": vh_s}); if let Some(v) = prev.as_deref().and_then(|p| r.data["steps"][p]["visits"].as_array_mut()).and_then(|a| a.last_mut()) { if v["end"].is_null() { v["endHashes"] = vh.clone(); } } r.step_set(name, back_eff, why.as_deref());+ // issue #219: saved at once, before the clip work below (which can take seconds over the bridge), so a+ // command started meanwhile already reads the new step+ r.save().unwrap(); // issue #130: a return names the ranking item it is about if let Some(a) = about.as_deref().filter(|_| back_eff) { let sp_ = spec_soft(&r);
crates/adom-aiflow/src/preboard.rs+18−1@@ -18,7 +18,10 @@ pub fn named_profile(v: &Value) -> Option<String> { } pub fn normalise_profile(raw: &str) -> String {- if raw.to_ascii_lowercase().contains("jlc") { "jlcpcb".into() } else { "fab".into() }+ let l = raw.to_ascii_lowercase();+ // issue #219 (Skyler): a board the user builds and assembles themself buys every part, no fab stocks any+ if l.contains("self") || l.contains("diy") || l.contains("hand") { return "self".into(); }+ if l.contains("jlc") { "jlcpcb".into() } else { "fab".into() } } /// A CSV file as rows of fields (quoted fields, doubled quotes and quoted newlines).@@ -156,6 +159,7 @@ pub fn sourcing_check(bom: &str, board: Option<&(BTreeSet<String>, BTreeSet<Stri if adom { adom_rows += 1; } else { distributor_rows += 1; } let customer = src_l.contains("customer") || src_l.contains("consign") || src_l.contains("own stock") || src_l.contains("supplied"); let preferred = match profile {+ "self" => true, "jlcpcb" => !lcsc.is_empty() || is_lcsc_number(&vpn), _ => src_l.contains("mouser") || adom, };@@ -1106,4 +1110,17 @@ mod bom_parts_tests { assert_eq!(brief_text("A 12 V buck"), "A 12 V buck"); let _ = std::fs::remove_file(&f); }++ /// Issue #219: a self-built board (sourcing.profile "self-built") gets no consigned-parts warning.+ #[test]+ fn a_self_built_board_has_no_fab_to_consign_to() {+ assert_eq!(named_profile(&json!({"sourcing": {"profile": "self-built"}})).as_deref(), Some("self"));+ assert_eq!(normalise_profile("hand assembly"), "self");+ let bom = "ref,value,mpn,manufacturer,source,vendor_pn,stock_checked_2026-09-29,note\nU2,ABC,ABC,Maker,DigiKey,123,500,\n".to_string();+ let fab = sourcing_check(&bom, None, "fab", 1);+ assert!(fab["warnings"].to_string().contains("does not stock"), "{fab}");+ let own = sourcing_check(&bom, None, "self", 1);+ assert!(!own["warnings"].to_string().contains("does not stock") && !own["warnings"].to_string().contains("consigned"), "{own}");+ }+ }
crates/aiflow-run/src/lib.rs+60@@ -85,6 +85,39 @@ pub struct Run { pub data: Value, } +/// Issue #219 (Skyler): two commands that overlap (a `step X` still stopping the last step's clip while the+/// next command already runs) each save the run, and the later save carried its own stale `currentStep`+/// and step visits, so `step X` was taken back and every later command was charged to the old step. Step+/// visits are now merged by their number (an end the other writer recorded is kept), and the current step+/// is the step of the latest visit, whichever writer recorded it.+fn merge_steps(m: &mut serde_json::Map<String, Value>, d: &serde_json::Map<String, Value>) {+ let Some(theirs) = d.get("steps").and_then(|v| v.as_object()) else { return };+ if !m.get("steps").is_some_and(|v| v.is_object()) { m.insert("steps".into(), json!({})); }+ let mine = m.get_mut("steps").and_then(|v| v.as_object_mut()).unwrap();+ for (name, t) in theirs {+ let Some(e) = mine.get_mut(name) else { mine.insert(name.clone(), t.clone()); continue };+ if let (Some(eo), Some(to)) = (e.as_object_mut(), t.as_object()) {+ for (k, v) in to { if !eo.contains_key(k) { eo.insert(k.clone(), v.clone()); } }+ }+ let tv = t["visits"].as_array().cloned().unwrap_or_default();+ if !e["visits"].is_array() { e["visits"] = json!([]); }+ let mv = e["visits"].as_array_mut().unwrap();+ for v in tv {+ match mv.iter_mut().find(|x| x["n"] == v["n"] && x["at"] == v["at"]) {+ Some(x) => {+ for k in ["end", "endHashes"] { if x[k].is_null() && !v[k].is_null() { x[k] = v[k].clone(); } }+ }+ None => mv.push(v),+ }+ }+ mv.sort_by(|a, b| a["at"].as_str().unwrap_or("").cmp(b["at"].as_str().unwrap_or("")));+ }+ let latest = mine.iter().flat_map(|(name, e)| e["visits"].as_array().into_iter().flatten().filter_map(move |v| v["at"].as_str().map(|at| (at.to_string(), name.clone())))).max();+ if let Some((_, name)) = latest {+ if m.get("currentStep").and_then(|c| c.as_str()) != Some(name.as_str()) { m.insert("currentStep".into(), json!(name)); }+ }+}+ impl Run { pub fn open(dir: &Path) -> Option<Run> { let f = dir.join("run.json");@@ -207,6 +240,7 @@ impl Run { if key == "turns" { merged.sort_by_key(|e| e["n"].as_u64().unwrap_or(0)); } m.insert(key.to_string(), Value::Array(merged)); }+ merge_steps(m, d); } } let tmp = self.dir.join("run.json.tmp");@@ -748,4 +782,30 @@ mod tests { assert_eq!(parse(&iso(t)), Some(t)); assert_eq!(parse("2026-09-13T15:38:04Z").map(iso).as_deref(), Some("2026-09-13T15:38:04Z")); }++ /// Issue #219: a command that loaded the run before `step routing` saved must not take the step back.+ #[test]+ fn an_overlapping_save_keeps_the_newer_step() {+ let dir = std::env::temp_dir().join(format!("aiflow-run-219-{}", std::process::id()));+ let _ = std::fs::remove_dir_all(&dir);+ let mut r = Run::create(&dir, "b.kicad_pcb", "s.json", "test", "2026-11-19T00:00:00Z", "t", None, None).unwrap();+ r.step_set("sourcing", false, None);+ r.save().unwrap();+ // `gate` loads the run while `step routing` is still working+ let mut gate = Run::open(&dir).unwrap();+ std::thread::sleep(std::time::Duration::from_millis(1100));+ let mut step = Run::open(&dir).unwrap();+ step.step_set("routing", false, None);+ step.save().unwrap();+ // then `gate` finishes and saves its stale copy+ gate.data["outcomes"]["gate"] = json!({"pass": true});+ gate.save().unwrap();+ let disk = Run::open(&dir).unwrap();+ assert_eq!(disk.data["currentStep"], "routing", "{}", disk.data);+ assert_eq!(disk.data["outcomes"]["gate"]["pass"], true, "the other writer's own change is kept");+ assert!(disk.data["steps"]["sourcing"]["visits"][0]["end"].is_string(), "sourcing's visit closed by the step change");+ assert_eq!(disk.data["steps"]["routing"]["visits"].as_array().map(|a| a.len()), Some(1));+ let _ = std::fs::remove_dir_all(&dir);+ }+ }
docs/release-0.2.91.mdadded+12@@ -0,0 +1,12 @@+# AI Flow 0.2.91++- **A step change is never taken back by an overlapping command** (#219, Skyler). Once `step sourcing` was declared+ again late in a run, every later command was charged to sourcing, even right after another `step`: `currentStep`+ stayed at sourcing, the timeline's per-step times were wrong, and every command warned "still in sourcing". A+ command that loaded the run before `step X` saved (the step change stops the last step's clip over the bridge, which+ takes a moment) saved its stale copy afterwards. The run's save now merges step visits with the file and takes the+ current step from the latest visit, and `step` saves as soon as it switches. Test added.+- **A self-built sourcing profile** (#219). `"sourcing": {"profile": "self-built"}` for a board the user builds and+ assembles themself: `sourcing check` gives no consigned-parts warning, since every part is theirs to buy.+- **Which step before `adopt-board`**: the skill says to declare the step whose work the adopted board carries.+- **The dashboard workflow test** uses `sessions` where it used `status`, which no longer opens the dashboard (PR #113).
package.json+1−1@@ -1,7 +1,7 @@ { "slug": "adom-aiflow", "type": "app",- "version": "0.2.90",+ "version": "0.2.91", "title": "AI Flow", "description": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. One Rust binary with a crate per step (placement helpers, a grid router with Kelvin taps, pours with keepouts, KiCad's DRC gate, live landing through the KiCad Bridge, copper measurement, current and thermal analysis) and a finish line that refuses an unfinished board. Every command answers with hints for the AI; every turn, its thinking time and every rework loop go into run.jsonl, so Claude, Codex and any other engine are compared on the same flow. KiCad, Fusion 360 and Altium Designer today (the same steps and gates through each tool's bridge); Adom's own web apps next.", "summary": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. The AI thinks its way from placement through routing, pours, current and thermal analysis to a delivered video; the binary does the fast, deterministic parts of every step, hands back hints, and keeps a ledger of every turn, every return to an earlier step, and the clock from the prompt to done.",
page.json+1−1@@ -1,7 +1,7 @@ { "slug": "adom-aiflow", "type": "app",- "version": "0.2.90",+ "version": "0.2.91", "title": "AI Flow", "description": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. One Rust binary with a crate per step (placement helpers, a grid router with Kelvin taps, pours with keepouts, KiCad's DRC gate, live landing through the KiCad Bridge, copper measurement, current and thermal analysis) and a finish line that refuses an unfinished board. Every command answers with hints for the AI; every turn, its thinking time and every rework loop go into run.jsonl, so Claude, Codex and any other engine are compared on the same flow. KiCad, Fusion 360 and Altium Designer today (the same steps and gates through each tool's bridge); Adom's own web apps next.", "summary": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. The AI thinks its way from placement through routing, pours, current and thermal analysis to a delivered video; the binary does the fast, deterministic parts of every step, hands back hints, and keeps a ledger of every turn, every return to an earlier step, and the clock from the prompt to done.",
skills/adom-aiflow/SKILL.md+1−1@@ -706,7 +706,7 @@ The plan needs provenance: the plan `pour` wrote (its hash is recorded in the ru ### Silk-only adoption keeps copper evidence -`adopt-board` compares the copper fingerprint of the current and adopted boards: tracks, vias, zones with settings, pads with geometry, net and drill, footprint placement, outline, stackup, nets and project rules, but not silkscreen, fab, courtyard, text or 3D models. When it is unchanged, gate, land, measure, the analyses, place verify and the Fields report are kept, with a carry record holding both board hashes and the fingerprint. Every board-hash check accepts the older board only through that record, re-verified from both snapshot files. Any copper change, an unreadable rule file or a non-KiCad board invalidates the evidence as before. The silkscreen and export proofs are always dropped; record them again.+Before `adopt-board` on a board your own scripts built, declare the step whose work it carries (`step placement` for placed parts, `step routing` for routed copper, `step pours` for zones), so the adoption and the commands after it are charged to that step. `adopt-board` compares the copper fingerprint of the current and adopted boards: tracks, vias, zones with settings, pads with geometry, net and drill, footprint placement, outline, stackup, nets and project rules, but not silkscreen, fab, courtyard, text or 3D models. When it is unchanged, gate, land, measure, the analyses, place verify and the Fields report are kept, with a carry record holding both board hashes and the fingerprint. Every board-hash check accepts the older board only through that record, re-verified from both snapshot files. Any copper change, an unreadable rule file or a non-KiCad board invalidates the evidence as before. The silkscreen and export proofs are always dropped; record them again. ### Holes with no copper
skills/aiflow-sourcing/SKILL.md+2−2@@ -10,7 +10,7 @@ A part that is not in stock is not a design choice, and a model with the wrong s ## 1. The fab profile states preferences -Read `fab.target` from requirements.json (aiflow-intake) and set `sourcing.profile`. Do not wait for the human to say it.+Read `fab.target` from requirements.json (aiflow-intake) and set `sourcing.profile`. Do not wait for the human to say it. A board the user builds and assembles themself (milled or ordered bare, parts hand-soldered) takes `"sourcing": {"profile": "self-built"}`: every part is theirs to buy, so `sourcing check` gives no consigned-parts warning. | Profile | When | Preferred source | Anything else | |---|---|---|---|@@ -57,7 +57,7 @@ Every reference in the netlist must have a BOM row, including contacts, machine The binary gates this: ```bash-adom-aiflow --ai-thread "<thread>" sourcing check --bom design/bom.csv [--profile fab|jlcpcb] [--qty <boards>]+adom-aiflow --ai-thread "<thread>" sourcing check --bom design/bom.csv [--profile fab|jlcpcb|self-built] [--qty <boards>] ``` It reads the profile from the spec or requirements.json (`fab` by default), refuses a row without an MPN, a reference listed twice, a distributor row without a stock check, and a stock column without its check date; it warns on stock under twice the build quantity. A source is never an error: rows not from the profile's preferred source (Mouser or Adom stock on `fab`, a row with an LCSC number on `jlcpcb`) pass with one warning that lists them as consigned parts, recorded as `consignedRows` in the outcome. A customer-supplied row (`customer supplied`, `consigned`) with no stock count is a warning too.
tests/dashboard-workflow.py+9−9@@ -67,23 +67,23 @@ else:print('{}') assert tl['title']=='one' and tl['aiThread']=='astra' and tl['runFolder']=='one' and tl['engine']=='KiCad',tl assert 'adom-aiflow' not in json.dumps({k:tl[k] for k in ['title','label']}) e=entry(runs['one']);assert e['aiThread']=='astra' and e['label']=='one' and e['finished'] is False and e['port']==a['port'],e- run(runs['one'],'status');assert opens()==1,'repeated command must reuse tab'+ run(runs['one'],'sessions');assert opens()==1,'repeated command must reuse tab' # --- proxy change navigates the named tab s=json.loads(state.read_text());s['panes']['right'][-1]['url']='http://old-proxy/';state.write_text(json.dumps(s))- run(runs['one'],'status');assert opens()==1 and tabs()[DOT+'one'][1]==a['url'],'proxy change must navigate the existing named tab'+ run(runs['one'],'sessions');assert opens()==1 and tabs()[DOT+'one'][1]==a['url'],'proxy change must navigate the existing named tab' # --- closed tab reopens s=json.loads(state.read_text());s['panes']['right']=[t for t in s['panes']['right'] if not t['name'].startswith(DOT)];state.write_text(json.dumps(s))- run(runs['one'],'status');assert opens()==2,'closed tab must reopen'+ run(runs['one'],'sessions');assert opens()==2,'closed tab must reopen' # --- the label follows the ORIGINAL board's stem; the tab is renamed in its pane edit(runs['one'],lambda d:(d.__setitem__('sourceBoard','/boards/buck-12v5v.kicad_pcb'),d.__setitem__('boards',[str(runs['one']/'board-3.kicad_pcb')])))- run(runs['one'],'status');ft=flow_tabs();assert list(ft)==[DOT+'buck-12v5v'] and ft[DOT+'buck-12v5v'][0]=='right',ft+ run(runs['one'],'sessions');ft=flow_tabs();assert list(ft)==[DOT+'buck-12v5v'] and ft[DOT+'buck-12v5v'][0]=='right',ft tl=json.loads((runs['one']/'timeline'/'timeline.json').read_text());assert tl['title']=='buck-12v5v' and tl['board']=='buck-12v5v.kicad_pcb',tl # --- migration: a 0.2.19 tab "AI Flow ยท <hex>" in the left pane is replaced in the same pane hexname=DOT+a['runId'][:8] s=json.loads(state.read_text());s['panes']['right']=[t for t in s['panes']['right'] if not t['name'].startswith(DOT)];s['panes']['left'].append({'name':hexname,'url':a['url']});state.write_text(json.dumps(s)) c=cfg(runs['one']);c['name']=hexname;(runs['one']/'dashboard.json').write_text(json.dumps(c)) r=json.loads((home/'dashboards.json').read_text());r['dashboards']=[];(home/'dashboards.json').write_text(json.dumps(r))- n0=len(log());run(runs['one'],'status');new=log()[n0:]+ n0=len(log());run(runs['one'],'sessions');new=log()[n0:] o=[c for c in new if c[:3]==['hydrogen','webview','open-or-refresh']];rm=[c for c in new if c[:3]==['hydrogen','workspace','remove-tab']] assert len(o)==1 and o[0][o[0].index('--panel-id')+1]=='left' and o[0][o[0].index('--name')+1]==DOT+'buck-12v5v',new assert rm==[['hydrogen','workspace','remove-tab','--name',hexname]],rm@@ -95,7 +95,7 @@ else:print('{}') # --- stopped server is restarted behind the same tab for line in subprocess.check_output(['ps','-eo','pid,args'],text=True).splitlines(): if binary in line and str(runs['one']) in line and 'timeline serve' in line:os.kill(int(line.split()[0]),signal.SIGTERM)- time.sleep(.2);run(runs['one'],'status');assert opens()==count,'server restart should reuse the tab'+ time.sleep(.2);run(runs['one'],'sessions');assert opens()==count,'server restart should reuse the tab' assert alive(a['url'])==a['runId'] # --- CLI -> HTTP control -> SSE updates an existing view, and reconnect replays it@@ -122,7 +122,7 @@ else:print('{}') count=opens();res=run(runs['two'],'intake','--prompt-time','2026-10-09T10:00:00Z','--engine','claude') assert opens()==count and 'name' not in cfg(runs['two']),res.stderr assert 'WARNING: no new AI Flow tab for this run' in res.stderr and DOT+'buck-12v5v' in res.stderr and '--reuse-tab' in res.stderr and '--new-tab --why' in res.stderr and 'keeps the human' in res.stderr,res.stderr- res=run(runs['two'],'status');assert opens()==count and 'WARNING: this run has no dashboard tab' in res.stderr,res.stderr+ res=run(runs['two'],'sessions');assert opens()==count and 'WARNING: this run has no dashboard tab' in res.stderr,res.stderr res=run(runs['two'],'timeline','open',code=2);assert 'ERROR' in res.stdout+res.stderr and '--reuse-tab' in res.stdout+res.stderr and opens()==count res=run(runs['two'],'timeline','open','--new-tab',code=2);assert '--why' in res.stdout+res.stderr and opens()==count # --- --new-tab --why opens and records the reason@@ -169,8 +169,8 @@ else:print('{}') # --- headless override and visible UI failure off=dict(env,AIFLOW_DASHBOARD='off');run(p/'headless','intake','--prompt-time','2026-10-09T10:00:00Z',extra=off);assert not (p/'headless'/'dashboard.json').exists()- mock.write_text('#!/bin/sh\nexit 1\n');run(runs['four'],'status',thread='nova')- res=run(runs['four'],'status',thread='nova');assert 'Dashboard unavailable'in res.stderr+ mock.write_text('#!/bin/sh\nexit 1\n');run(runs['four'],'sessions',thread='nova')+ res=run(runs['four'],'sessions',thread='nova');assert 'Dashboard unavailable'in res.stderr print('PASS: intake tab named for the run, reuse, navigate, closed-tab recovery, label from the original board with rename in place, hex tab migrated in its pane, resume, server restart, SSE + replay, same-thread challenge, --new-tab --why, close --run with verified server stop, finished-tab reuse, other-thread warning, name collision adds the thread, list, close --finished/--name guard, headless override, visible UI failure') finally: # Only terminate test-owned timeline processes identified by exact temporary run path.