From 5a9da0359f024f2fbf6ddd2251e5f5066ba74991 Mon Sep 17 00:00:00 2001 From: Chris Phillipson Date: Tue, 14 Jul 2026 14:43:53 -0700 Subject: [PATCH] fix(setup): inject statusline footer last so it can't silently miss MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `ak setup` ran fixStatusline at project step 2, right after `ruflo init`. If .claude/helpers/statusline.cjs wasn't settled yet, fixStatusline early-returns applied:false — and setup logged that as `info`, not a warning, so a missing footer (no AQE/SONA segments) went unnoticed. The reactive net (`ak sync` detecting "footer missing") caught it later, but setup itself never converged. Move the statusline heal to the final project step, after both `ruflo init` and `aqe init` have written the helper (verified: aqe init preserves an already-injected footer). fixStatusline is idempotent, so running it last guarantees convergence. A still-missing footer is now a `warn` pointing at `ak sync`, never silent `info`. --- src/commands/setup.mjs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/commands/setup.mjs b/src/commands/setup.mjs index 680bca49..ff705960 100644 --- a/src/commands/setup.mjs +++ b/src/commands/setup.mjs @@ -99,9 +99,10 @@ export async function run_project({ flags, cfg }) { (init.code === 0 ? ok : fail)('ruflo init --full'); if (init.code !== 0) return false; - // 2. statusline heal (footer + fallback version + legacy repoint) - const sl = fixStatusline(root); - (sl.applied ? ok : info)(`statusline: ${sl.applied ? 'footer injected' : sl.reason ?? 'in sync'}`); + // 2. statusline heal is DEFERRED to the end of project setup (see step 10): + // fixStatusline is a no-op until ruflo/aqe have finished writing + // .claude/helpers/statusline.cjs, so injecting the footer here can silently + // miss (helper not settled) — running it last guarantees convergence. // 3. strip committed MCP cruft (keep any agentic-qe entry) const mcpJson = path.join(root, '.mcp.json'); @@ -172,6 +173,14 @@ export async function run_project({ flags, cfg }) { const aqe = await runCmd('aqe', ['init', '--auto'], { cwd: root, timeout: 300_000 }); (aqe.code === 0 ? ok : warn)('agentic-qe initialized'); } + + // 10. statusline footer — LAST, after ruflo + aqe have settled the helper. + // A still-missing footer is a WARN (not silent info): it means the AQE / + // SONA segments won't render and `ak sync` is needed to heal it. + const sl = fixStatusline(root); + if (sl.applied) ok(`statusline: footer injected (v${sl.version})`); + else if (sl.reason) warn(`statusline: ${sl.reason} — run \`ak sync\` to re-inject`); + else ok('statusline: footer in sync'); return true; }