Skip to content

feat(bin): show the Ollama Cloud reserve on the Pi worker footer - #2682

Open
Kallas95 wants to merge 4 commits into
kunchenguid:mainfrom
Kallas95:fm/fm-pi-ligne-statut
Open

feat(bin): show the Ollama Cloud reserve on the Pi worker footer#2682
Kallas95 wants to merge 4 commits into
kunchenguid:mainfrom
Kallas95:fm/fm-pi-ligne-statut

Conversation

@Kallas95

Copy link
Copy Markdown

Intent

Add the Ollama Cloud reserve to the status line of Pi worker agents, and reimplement nothing that already exists.

Context established before the work started (as of 2026-08-19): Pi already renders, at the bottom of its panel, the working directory, the branch, context consumed against its ceiling (e.g. "18.9%/128k"), tokens exchanged, and the model (e.g. "glm-5.2:cloud"). FOUR of the five elements the captain asked for are already there and MUST NOT be reimplemented.

First required check: the captain asked for this line "like claude code", so he may simply not be seeing it. Establish whether the existing line is visible in his view (herdr backend) or hidden/truncated. If the real defect were masking, fixing that would have been the whole job, with the Ollama reserve as a bonus if the surface allowed it easily. FINDING: a live capture of a running Pi worker's pane shows the existing footer fully visible and untruncated in the captain's view, so masking was not the defect and the real gap was only the missing reserve. This finding is an explicit acceptance criterion and must appear in the PR.

What was missing: the Ollama reserve. quota-axi does not model this provider. The fleet already reads this reserve through the private srv-ollama-usage-watch probe, which writes state/ollama-usage.json with fields session_free, weekly_free, and fetched_at. The implementation must LEAN ON THAT EXISTING SOURCE and must not invent a second measurement that would diverge from it.

Hook surface to establish: pi --help exposes no statusline option. The serious lead was the auto-discovered extension system, since bin/fm-spawn.sh already passes a per-task extension to pi and pi-signed workers via -e state/.pi-ext.ts. The task required establishing whether that surface allows ADDING a segment to the line or only rewriting the line entirely.

ARBITRATION RULE given up front: if the only available route were rewriting the whole line - and therefore reproducing and maintaining the four existing elements at every Pi release - the worker must NOT do it, must post a needs-decision with the finding, and must stop, because that would be a bad trade and the decision belongs to firstmate. FINDING: the arbitration rule does not trigger. Pi's ctx.ui.setStatus(key, text) is a keyed, purely additive surface: it appends an extra footer line BELOW Pi's own lines and never replaces them. This was proven live against Pi 0.84.2 using the extension bin/fm-spawn.sh actually generates, not a hand-written stand-in. Therefore no existing segment is reproduced or maintained by this change.

Display requirements for the reserve, all mandatory:

  • Read from state/ollama-usage.json (the existing probe's output).
  • Explicit rendering when the data is ABSENT or STALE (fetched_at older than 1 hour): show "reserve?" or an equivalent, and NEVER a stale figure presented as fresh, because false assurance is worse than no information.
  • Compact, on the order of "olla 96%", because the line is already dense.

Acceptance criteria:

  1. The visibility finding (does the captain see the existing line?) is established and written in the PR.
  2. The Ollama reserve appears, read from the probe, with explicit absent/stale rendering. Colocated tests.
  3. The four existing elements are neither lost nor reimplemented.
  4. If the surface forced a full rewrite: needs-decision, no code.

Deliberate implementation decisions made while doing the work, which a reviewer reading only the diff would not know:

  • The displayed figure is the SMALLER of session_free and weekly_free, floored rather than rounded. Rationale: the tighter window is the one that actually stops work, and a reserve must never read larger than it is.
  • Staleness is judged in BOTH directions. A reading stamped far in the future is treated as stale too, because that is a clock disagreement rather than freshness, and trusting it would let an arbitrarily old number keep looking current forever. This directly serves the "never present a stale figure as fresh" requirement.
  • An unknown reserve renders "olla ?" with no digits, for absent, unreadable, malformed, and stale alike. The distinction is kept in the returned reason for diagnostics but deliberately not shown, to keep the segment compact.
  • The rendering module lives at .pi/extensions/lib/fm-ollama-reserve.ts, matching the repo's existing convention for Pi extension helper modules. It is NOT auto-discovered as an extension: Pi discovers only .pi/extensions/.ts and .pi/extensions//index.ts, and this placement was verified live to load nothing and warn about nothing.
  • The generated worker extension imports that module LAZILY, behind a shared promise with a catch that resolves to null. Rationale: the same generated extension carries the safety-critical busy-state and turn-end wiring that fleet supervision depends on, and a failed top-level import would stop that wiring from registering. A display module that cannot load must degrade to showing nothing, never take the supervision wiring down with it. There is a test for exactly this.
  • The reserve is refreshed on session_start, agent_start, and turn_end, plus an unref'd 60-second timer armed once. Rationale: a worker can idle for hours, and without the timer the last reading would stay on screen past its shelf life and read as current, which is the exact failure the requirements forbid. It publishes only when the rendered text changes, so the timer costs no redraw.
  • Two test layers, deliberately separate because they fail for different reasons. tests/fm-pi-ollama-reserve.test.sh is the portable regression: it runs the REAL fm-spawn and drives the generated artifact in a plain Node host with a recording Pi context, asserting among other things that the extension touches nothing but its own keyed status entry (which is how criterion 3 is enforced mechanically). tests/fm-pi-footer-live-e2e.test.sh is an opt-in, env-gated, self-skipping live guard that launches the real Pi and reads the rendered footer back, because only Pi decides where a status entry lands and a stub could only confirm the assumption written into it; it refuses to pass if Pi is not installed. This two-test split follows the repo's own rule for harness-dependent checks in the firstmate-coding-guidelines skill.
  • Dated live evidence is recorded in docs/verification/runtime-backends.md under "Pi worker footer", and the architecture boundary (a display responsibility riding the same generated extension as the supervision wiring, isolated from it) is recorded in docs/architecture.md. AGENTS.md was deliberately NOT touched: the coding guidelines' size discipline routes situation-specific detail away from the always-loaded file.
  • Pre-existing failures observed locally and NOT caused by this change: two workflow-lint failures because actionlint is not installed on this machine (bin/fm-lint-workflows.sh deliberately exits non-zero naming the pinned version), and one one-off failure in tests/fm-spawn-dispatch-profile.test.sh that occurred only while a sibling test suite saturated the machine; that test passes in isolation both with and without this change, and twice more under self-inflicted parallel load.

This work touches firstmate's own shared, tracked material, so the firstmate-coding-guidelines skill was loaded before editing, and its rules were applied: one owner per contract, inline-stub discipline, AGENTS.md size discipline, one sentence per line in tracked Markdown, plain dash instead of em dash, no agent co-author, shellcheck-clean bin scripts via bin/fm-lint.sh, and colocated tests that assert behavior through executable interfaces rather than implementation-source bytes.

What Changed

  • bin/fm-spawn.sh now embeds an Ollama Cloud reserve segment in the Pi worker extension it generates: it reads the existing srv-ollama-usage-watch probe output (state/ollama-usage.json) instead of measuring the quota a second time, and publishes through Pi's keyed ctx.ui.setStatus, which appends a line below Pi's own footer, so the working directory, branch, context, tokens, and model Pi already renders are neither replaced nor reproduced. The rendering module is imported lazily behind a shared caught promise so a failed load degrades to no segment without stopping the safety-critical busy-state and turn-end wiring, and the reserve refreshes on session_start, agent_start, and turn_end plus a once-armed unref'd 60-second timer that republishes only when the rendered text changes.
  • New .pi/extensions/lib/fm-ollama-reserve.ts owns parsing and formatting: it renders the floored smaller of session_free and weekly_free as a compact olla 96%, and renders an explicit olla ? when the reading is absent, unreadable, malformed, or stale (staleness is judged in both directions, so a future-stamped reading from a clock disagreement is never presented as fresh; the reason stays in the returned value for diagnostics).
  • Two colocated test layers plus documentation: tests/fm-pi-ollama-reserve.test.sh runs the real fm-spawn and drives the generated extension in a plain Node host, asserting among other things that it touches nothing but its own keyed status entry, while the env-gated, self-skipping tests/fm-pi-footer-live-e2e.test.sh (registered in bin/fm-test-run.sh's live-e2e family) launches real Pi and reads the rendered footer back. docs/verification/runtime-backends.md records the dated live evidence against Pi 0.84.2, including the visibility finding that a running Pi worker's existing footer is fully visible and untruncated in the captain's view, so the only missing element was the reserve; docs/architecture.md and the harness-adapters skill record the display-vs-supervision boundary of the generated extension.

Risk Assessment

✅ Low: Both accepted fix-round changes are correctly applied at the prescribed shared boundary (session_start resets the publish cache; the test settle wait is now bounded polling), the new regression test provably fails before the fix and cannot false-pass, and a full re-pass over all seven changed files surfaced no new issues or intent violations.

Testing

Round 2 : le fix documentaire du round 1 est vérifié appliqué à HEAD conformément aux instructions, puis les deux couches de test ont été re-exécutées - la régression portable (8/8) et la garde live env-gated contre le vrai Pi 0.84.2 (2/2), cette dernière prouvant en bout en bout que le segment « olla NN% » lu depuis la sonde s'ajoute sous le footer intact de Pi et qu'une lecture absente ou périmée rend « olla ? » ; les preuves visuelles du round 1 (PNG/HTML/panes) restent valides car seul le doc a changé depuis, et l'arbre de travail est resté propre.

Evidence: Rendu HTML des trois panes avec annotations

Source: Rendu HTML des trois panes avec annotations

<!doctype html>
<html lang="en"><head><meta charset="utf-8">
<title>Pi worker footer - Ollama reserve segment (live Pi 0.84.2)</title>
<style>
  body { background:#0d1117; color:#c9d1d9; font-family:-apple-system,'Segoe UI',sans-serif; margin:24px; }
  h1 { font-size:19px; font-weight:600; }
  p.sub { color:#8b949e; font-size:13px; max-width:900px; }
  .card { background:#161b22; border:1px solid #30363d; border-radius:8px; margin:18px 0; overflow:hidden; max-width:1080px; }
  .bar { background:#21262d; padding:7px 12px; display:flex; align-items:center; gap:6px; }
  .dot { width:11px; height:11px; border-radius:50%; display:inline-block; }
  .r { background:#ff5f57; } .y { background:#febc2e; } .g { background:#28c840; }
  .title { margin-left:8px; color:#8b949e; font-size:12px; font-family:ui-monospace,Menlo,monospace; }
  pre { margin:0; padding:12px 14px; background:#1e1e1e; color:#d4d4d4; font:12px/1.45 ui-monospace,Menlo,Consolas,monospace; overflow-x:auto; }
  .caption { padding:9px 14px; margin:0; font-size:13px; color:#8b949e; border-top:1px solid #30363d; }
</style></head><body>
<h1>Pi worker footer - Ollama Cloud reserve segment</h1>
<p class="sub">Real Pi 0.84.2 panes captured over tmux, each running the extension actually generated by
bin/fm-spawn.sh. Pi's own footer (working directory + branch, context %/ceiling, tokens, model) is
untouched; the reserve is a keyed status line appended below it.</p>

  <section class="card">
    <div class="bar"><span class="dot r"></span><span class="dot y"></span><span class="dot g"></span><span class="title">pi worker - fresh probe reading</span></div>
    <pre> <span style="font-weight:700"></span><span style="color:rgb(138,190,183);font-weight:700">pi</span><span style="color:rgb(102,102,102)"> v0.84.2</span>
 <span style="color:rgb(102,102,102)">escape</span><span style="color:rgb(128,128,128)"> interrupt · </span><span style="color:rgb(102,102,102)">ctrl+c/ctrl+d</span><span style="color:rgb(128,128,128)"> clear/exit · </span><span style="color:rgb(102,102,102)">/</span><span style="color:rgb(128,128,128)"> commands · </span><span style="color:rgb(102,102,102)">!</span><span style="color:rgb(128,128,128)"> bash · </span><span style="color:rgb(102,102,102)">ctrl+o</span><span style="color:rgb(128,128,128)"> more</span>
 <span style="color:rgb(102,102,102)">Press ctrl+o to show full startup help and loaded resources.</span>

 <span style="color:rgb(102,102,102)">Pi can explain its own features and look up its docs. Ask it how to use or extend Pi.</span>

<span style="color:rgb(240,198,116)">[Extensions]</span>
<span style="color:rgb(102,102,102)">  olla-evidence-fresh.pi-ext.ts</span>


 <span style="color:rgb(255,255,0)">Warning: No models available. Use /login to log into a provider via OAuth or API key. See:
</span> <span style="color:rgb(255,255,0)">  /Users/max/.local/share/fnm/node-versions/v22.23.2/installation/lib/node_modules/@earendil-works/pi-coding-agent/docs/providers.md
</span> <span style="color:rgb(255,255,0)">  /Users/max/.local/share/fnm/node-versions/v22.23.2/installation/lib/node_modules/@earendil-works/pi-coding-agent/docs/models.md</span>

 <span style="color:rgb(255,255,0)">Warning: tmux extended-keys is off. Modified Enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.</span>

<span style="color:rgb(80,80,80)">────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
</span><span style="color:#1e1e1e;background:rgb(80,80,80)"></span><span style="color:#1e1e1e;background:#d4d4d4"> </span>
<span style="color:rgb(80,80,80)">────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
</span><span style="color:rgb(102,102,102)">/private/var/folders/5q/snmnm0_926ddy6xlmggzx1g80000gn/T/fm-pi-footer-evidence.VkG9Dk/fresh/wt (wt-fresh)</span>
<span style="color:rgb(102,102,102)">0.0%/0 (auto)                                                                                                                        unknown
</span>olla 85%</pre>
    <p class="caption">Fresh probe (session_free 0.851, weekly_free 0.924): the footer appends 'olla 85%' - the floored tightest of the two windows - below Pi's own cwd/branch, context and model line.</p>
  </section>

  <section class="card">
    <div class="bar"><span class="dot r"></span><span class="dot y"></span><span class="dot g"></span><span class="title">pi worker - probe file absent</span></div>
    <pre> <span style="font-weight:700"></span><span style="color:rgb(138,190,183);font-weight:700">pi</span><span style="color:rgb(102,102,102)"> v0.84.2</span>
 <span style="color:rgb(102,102,102)">escape</span><span style="color:rgb(128,128,128)"> interrupt · </span><span style="color:rgb(102,102,102)">ctrl+c/ctrl+d</span><span style="color:rgb(128,128,128)"> clear/exit · </span><span style="color:rgb(102,102,102)">/</span><span style="color:rgb(128,128,128)"> commands · </span><span style="color:rgb(102,102,102)">!</span><span style="color:rgb(128,128,128)"> bash · </span><span style="color:rgb(102,102,102)">ctrl+o</span><span style="color:rgb(128,128,128)"> more</span>
 <span style="color:rgb(102,102,102)">Press ctrl+o to show full startup help and loaded resources.</span>

 <span style="color:rgb(102,102,102)">Pi can explain its own features and look up its docs. Ask it how to use or extend Pi.</span>

<span style="color:rgb(240,198,116)">[Extensions]</span>
<span style="color:rgb(102,102,102)">  olla-evidence-absent.pi-ext.ts</span>


 <span style="color:rgb(255,255,0)">Warning: No models available. Use /login to log into a provider via OAuth or API key. See:
</span> <span style="color:rgb(255,255,0)">  /Users/max/.local/share/fnm/node-versions/v22.23.2/installation/lib/node_modules/@earendil-works/pi-coding-agent/docs/providers.md
</span> <span style="color:rgb(255,255,0)">  /Users/max/.local/share/fnm/node-versions/v22.23.2/installation/lib/node_modules/@earendil-works/pi-coding-agent/docs/models.md</span>

 <span style="color:rgb(255,255,0)">Warning: tmux extended-keys is off. Modified Enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.</span>

<span style="color:rgb(80,80,80)">────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
</span><span style="color:#1e1e1e;background:rgb(80,80,80)"></span><span style="color:#1e1e1e;background:#d4d4d4"> </span>
<span style="color:rgb(80,80,80)">────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
</span><span style="color:rgb(102,102,102)">/private/var/folders/5q/snmnm0_926ddy6xlmggzx1g80000gn/T/fm-pi-footer-evidence.VkG9Dk/absent/wt (wt-absent)</span>
<span style="color:rgb(102,102,102)">0.0%/0 (auto)                                                                                                                        unknown
</span>olla ?</pre>
    <p class="caption">No state/ollama-usage.json: the footer renders the explicit unknown 'olla ?' instead of guessing a figure.</p>
  </section>

  <section class="card">
    <div class="bar"><span class="dot r"></span><span class="dot y"></span><span class="dot g"></span><span class="title">pi worker - stale probe reading (3h old)</span></div>
    <pre> <span style="font-weight:700"></span><span style="color:rgb(138,190,183);font-weight:700">pi</span><span style="color:rgb(102,102,102)"> v0.84.2</span>
 <span style="color:rgb(102,102,102)">escape</span><span style="color:rgb(128,128,128)"> interrupt · </span><span style="color:rgb(102,102,102)">ctrl+c/ctrl+d</span><span style="color:rgb(128,128,128)"> clear/exit · </span><span style="color:rgb(102,102,102)">/</span><span style="color:rgb(128,128,128)"> commands · </span><span style="color:rgb(102,102,102)">!</span><span style="color:rgb(128,128,128)"> bash · </span><span style="color:rgb(102,102,102)">ctrl+o</span><span style="color:rgb(128,128,128)"> more</span>
 <span style="color:rgb(102,102,102)">Press ctrl+o to show full startup help and loaded resources.</span>

 <span style="color:rgb(102,102,102)">Pi can explain its own features and look up its docs. Ask it how to use or extend Pi.</span>

<span style="color:rgb(240,198,116)">[Extensions]</span>
<span style="color:rgb(102,102,102)">  olla-evidence-stale.pi-ext.ts</span>


 <span style="color:rgb(255,255,0)">Warning: No models available. Use /login to log into a provider via OAuth or API key. See:
</span> <span style="color:rgb(255,255,0)">  /Users/max/.local/share/fnm/node-versions/v22.23.2/installation/lib/node_modules/@earendil-works/pi-coding-agent/docs/providers.md
</span> <span style="color:rgb(255,255,0)">  /Users/max/.local/share/fnm/node-versions/v22.23.2/installation/lib/node_modules/@earendil-works/pi-coding-agent/docs/models.md</span>

 <span style="color:rgb(255,255,0)">Warning: tmux extended-keys is off. Modified Enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.</span>

<span style="color:rgb(80,80,80)">────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
</span><span style="color:#1e1e1e;background:rgb(80,80,80)"></span><span style="color:#1e1e1e;background:#d4d4d4"> </span>
<span style="color:rgb(80,80,80)">────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
</span><span style="color:rgb(102,102,102)">/private/var/folders/5q/snmnm0_926ddy6xlmggzx1g80000gn/T/fm-pi-footer-evidence.VkG9Dk/stale/wt (wt-stale)</span>
<span style="color:rgb(102,102,102)">0.0%/0 (auto)                                                                                                                        unknown
</span>olla ?</pre>
    <p class="caption">Probe reading stamped 3 hours ago (past the 1h shelf life): 'olla ?' again - the stale 85% figure is never presented as current.</p>
  </section>
</body></html>
Evidence: Transcription pane - sonde fraîche (olla 85%)

Source: Transcription pane - sonde fraîche (olla 85%)

 pi v0.84.2
 escape interrupt · ctrl+c/ctrl+d clear/exit · / commands · ! bash · ctrl+o more
 Press ctrl+o to show full startup help and loaded resources.

 Pi can explain its own features and look up its docs. Ask it how to use or extend Pi.

[Extensions]
  olla-evidence-fresh.pi-ext.ts


 Warning: No models available. Use /login to log into a provider via OAuth or API key. See:
   /Users/max/.local/share/fnm/node-versions/v22.23.2/installation/lib/node_modules/@earendil-works/pi-coding-agent/docs/providers.md
   /Users/max/.local/share/fnm/node-versions/v22.23.2/installation/lib/node_modules/@earendil-works/pi-coding-agent/docs/models.md

 Warning: tmux extended-keys is off. Modified Enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
/private/var/folders/5q/snmnm0_926ddy6xlmggzx1g80000gn/T/fm-pi-footer-evidence.VkG9Dk/fresh/wt (wt-fresh)
0.0%/0 (auto)                                                                                                                        unknown
olla 85%
Evidence: Transcription pane - sonde absente (olla ?)

Source: Transcription pane - sonde absente (olla ?)

 pi v0.84.2
 escape interrupt · ctrl+c/ctrl+d clear/exit · / commands · ! bash · ctrl+o more
 Press ctrl+o to show full startup help and loaded resources.

 Pi can explain its own features and look up its docs. Ask it how to use or extend Pi.

[Extensions]
  olla-evidence-absent.pi-ext.ts


 Warning: No models available. Use /login to log into a provider via OAuth or API key. See:
   /Users/max/.local/share/fnm/node-versions/v22.23.2/installation/lib/node_modules/@earendil-works/pi-coding-agent/docs/providers.md
   /Users/max/.local/share/fnm/node-versions/v22.23.2/installation/lib/node_modules/@earendil-works/pi-coding-agent/docs/models.md

 Warning: tmux extended-keys is off. Modified Enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
/private/var/folders/5q/snmnm0_926ddy6xlmggzx1g80000gn/T/fm-pi-footer-evidence.VkG9Dk/absent/wt (wt-absent)
0.0%/0 (auto)                                                                                                                        unknown
olla ?
Evidence: Transcription pane - sonde périmée de 3 h (olla ?)

Source: Transcription pane - sonde périmée de 3 h (olla ?)

 pi v0.84.2
 escape interrupt · ctrl+c/ctrl+d clear/exit · / commands · ! bash · ctrl+o more
 Press ctrl+o to show full startup help and loaded resources.

 Pi can explain its own features and look up its docs. Ask it how to use or extend Pi.

[Extensions]
  olla-evidence-stale.pi-ext.ts


 Warning: No models available. Use /login to log into a provider via OAuth or API key. See:
   /Users/max/.local/share/fnm/node-versions/v22.23.2/installation/lib/node_modules/@earendil-works/pi-coding-agent/docs/providers.md
   /Users/max/.local/share/fnm/node-versions/v22.23.2/installation/lib/node_modules/@earendil-works/pi-coding-agent/docs/models.md

 Warning: tmux extended-keys is off. Modified Enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
/private/var/folders/5q/snmnm0_926ddy6xlmggzx1g80000gn/T/fm-pi-footer-evidence.VkG9Dk/stale/wt (wt-stale)
0.0%/0 (auto)                                                                                                                        unknown
olla ?
Evidence: Sortie de la garde live re-exécutée à HEAD (Pi 0.84.2)
$ FM_PI_FOOTER_LIVE_E2E=1 bin/fm-test-run.sh tests/fm-pi-footer-live-e2e.test.sh
ok - Pi 0.84.2 appends the reserve below its own footer segments and keeps all of them
ok - Pi 0.84.2 renders an absent or stale reserve as an explicit unknown
all fm-pi-footer-live-e2e tests passed (Pi 0.84.2)
- Outcome: 🔧 1 issue found → auto-fixed ✅ across 2 runs (13m5s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 2 issues found → auto-fixed ✅
  • ⚠️ bin/fm-spawn.sh:2473 - The generated Pi extension's publish-on-change guard (reserveText) survives Pi in-process session replacement while Pi clears its extension-status store, so the reserve segment silently disappears after /new, /resume, or fork. Proven against installed Pi 0.84.2 source: teardownCurrent -> beforeSessionInvalidate -> resetExtensionUI() -> footerDataProvider.clearExtensionStatuses() empties the footer store; the replacement runtime reuses the module-level extensionCache factory (same cwd and generation, loader.js), so the same module instance keeps reserveText; the re-emitted session_start (agent-session.js:1761) then renders unchanged text and renderReserve returns before setStatus, leaving the segment absent for the whole new session until the percentage changes or goes stale (possibly hours). Minimal durable fix at the shared boundary: reset reserveText = null in the session_start handler before renderReserve(ctx), keeping the timer's no-redraw optimization intact.
  • ℹ️ tests/fm-pi-ollama-reserve.test.sh:324 - drive_ext waits a fixed 400ms for the lazy module import to settle before reading the recorded calls. Under machine saturation (a failure mode the author already observed on a sibling suite) the import can exceed 400ms and the assertions would flake. Polling the recorded calls for the expected setStatus/register entries with a bounded deadline (e.g. up to 5s) is a mechanical, strictly more robust replacement.

🔧 Fix: republish reserve on session_start and poll test settle
✅ Re-checked - no issues remain.

🔧 **Test** - 1 issue found → auto-fixed ✅
  • ⚠️ docs/verification/runtime-backends.md:947 - docs/verification/runtime-backends.md:947 tells the reader to refresh 'this harness-dependent proof before accepting a Pi upgrade' but the command it gives runs the portable regression (bin/fm-test-run.sh tests/fm-pi-ollama-reserve.test.sh), which drives a stub Node host and cannot detect a Pi rendering change. The actual harness-dependent guard is the env-gated live test, and every other section of that file follows the env-gated convention. The command should be: FM_PI_FOOTER_LIVE_E2E=1 bin/fm-test-run.sh tests/fm-pi-footer-live-e2e.test.sh. Doc-only fix, outside the test phase, so reported instead of applied.
  • bash tests/fm-pi-ollama-reserve.test.sh (régression portable : 8 cas, vrai fm-spawn + artefact généré piloté dans un hôte Node enregistreur)
  • FM_PI_FOOTER_LIVE_E2E=1 bash tests/fm-pi-footer-live-e2e.test.sh (garde live : vrai Pi 0.84.2 + vrai tmux, footer relu depuis le pane rendu)
  • Vérification manuelle live : 3 panes Pi 0.84.2 réels (sonde fraîche → olla 85%, sonde absente → olla ?, sonde datée de 3 h → olla ? sans le chiffre périmé) avec l'extension réellement générée par bin/fm-spawn.sh, captures conservées en évidence
  • Contrôle visuel que les quatre segments existants de Pi (cwd + branche, contexte %/plafond, tokens, modèle) restent rendus par Pi au-dessus de la réserve dans les trois panes
  • git status --porcelain propre après les runs, répertoires temporaires des tests nettoyés par leurs traps

🔧 Fix: point Pi footer refresh command at env-gated live guard
✅ Re-checked - no issues remain.

  • bin/fm-test-run.sh tests/fm-pi-ollama-reserve.test.sh - régression portable : fm-spawn réel + artefact généré piloté dans un hôte Node avec contexte Pi enregistreur, 8/8 ok (plus petite des deux fenêtres avec plancher, rendu « olla ? » pour absent/malformé/périmé/horodaté dans le futur, la clé de statut propre est la seule chose touchée, le câblage de supervision survit à un module d'affichage qui ne charge pas)
  • FM_PI_FOOTER_LIVE_E2E=1 bin/fm-test-run.sh tests/fm-pi-footer-live-e2e.test.sh - garde live env-gated contre le vrai Pi 0.84.2 via tmux : 2/2 ok, la réserve s'ajoute SOUS les lignes de footer propres de Pi (répertoire, branche, contexte/tokens/modèle conservés) et une sonde absente ou périmée rend « olla ? »
  • Vérification manuelle du diff de 65cea37 contre les instructions user_chose_to_fix du round 1 : édition doc uniquement, commande de rafraîchissement pointée sur la garde live, phrase de justification conservée, rôles des deux tests désambiguïsés, convention env-gated identique aux autres sections (lignes 87, 732, 915 du même fichier)
  • Vérification que les preuves visuelles du round 1 (PNG, HTML, 3 transcriptions de pane) restent représentatives de HEAD : seul un changement de 3 lignes de doc a atterri depuis la capture, le code produit est identique
  • Contrôles de propreté : git status --porcelain vide, aucun processus pi orphelin, aucun serveur tmux vivant après les tests
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 127)
✅ **Push** - passed

✅ No issues found.

Pi's own footer already renders the working directory, the branch, context
consumed against its ceiling, tokens exchanged, and the model, and a live
capture of a running Pi worker confirmed all four are visible in the captain's
view rather than hidden or truncated. So the gap was never visibility: it was
the one number Pi cannot know, the Ollama Cloud reserve, which quota-axi does
not model.

Pi exposes an additive hook for exactly this. ctx.ui.setStatus(key, text)
appends a keyed line BELOW Pi's own footer lines instead of replacing them, so
none of the four existing segments is reproduced or maintained here. Verified
live on Pi 0.84.2 with the extension fm-spawn actually generates.

The reserve comes from the probe file the home's own usage check already
writes; it is never measured a second time. The displayed figure is the
smaller of the session and weekly free fractions, floored, because the tighter
window is the one that stops work and a reserve must not read larger than it
is. A reading that is absent, unreadable, malformed, or past an hour old
renders "olla ?" instead of a figure, including one stamped in the future,
which is a clock disagreement rather than freshness. An idle worker re-reads
on a timer so a number cannot outlive its shelf life on screen.

The module loads lazily behind a guard: a footer nicety must never keep the
busy-state and turn-end wiring supervision depends on from registering.

Tests colocated in tests/fm-pi-ollama-reserve.test.sh drive the real fm-spawn
and its generated artifact; tests/fm-pi-footer-live-e2e.test.sh is the opt-in
guard that re-proves the append-not-replace placement after a Pi upgrade,
since only Pi decides where a status entry lands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant