Repository navigation
fix(calm): mirror pi 1.0.0's stock call header for outcome tool rows - #45
Merged
Merged
Conversation
CI installs pi with no version, so upstream 1.0.0 publishing moved CI by itself; the red shards landed in files the change under test never touched. Pi 1.0.0 renders a tool call's own header as title plus arguments (createCallFallback now calls formatToolCallWithArgs), so the outcomes tools' renderCall no longer matched Pi's stock fallback byte for byte and the stock-render fixture went red. Mirror that shape here, because pi does not export the helper and this repository's extensions import only the public entry; the byte-equality fixture still guards it. Pin the pi version in the workflow, and widen fm-wake-queue's wait bound from 4 to 15 seconds: bounded, with room for runner load.
…s/fm-calm-pi-extension.test.sh at "calm mode was not off by default (missing: 'CALM_E2E_OUTPUT')". Root cause: pi 1.0.0 changed the default TUI to fullscreen/alternate-screen, so `tmux capture-pane -S -600` no longer returns the transcript rows above the viewport; the fixture's first snapshot therefore began mid-transcript (at CALM_EXPORT_FIND) and lost the earlier CALM_E2E_OUTPUT/CALM_EXPORT_GREP rows. Fix: pin `tuiMode: "regular"` in that fixture's e2e-config/settings.json (the same mode bin/fm-spawn.sh already pins for real pi launches), restoring the scrollback the capture helper was written against. No assertion was changed. Verified locally on pi 1.0.0: the previously failing CALM_E2E_OUTPUT assertion and all subsequent calm-off, Ctrl+O, and /calm snapshot assertions now pass, and the run advances to the test's Chrome-required export step; this host has no Chrome, so I could not run past that gate. Left unchanged: the other three pi launches in the file and the assertions themselves — those would only need edits if a separate 1.0.0 behavior beyond TUI mode breaks an assertion after the Chrome gate
… (tests/fm-calm-pi-extension.test.sh, assertion "rendered export DOM violated the Calm conversation boundary"). Root cause: this PR pins pi to 1.0.0, and 1.0.0 contains upstream commit b2bd111f2 ("add hidden-message toggle to HTML exports"). Before that commit, `display:false` custom_message entries were omitted from the HTML transcript; from 1.0.0 on they are emitted inside a CSS-hidden `<div class="hook-message hook-message-hidden">` shell that still carries the `[firstmate-synthetic-input]` type label (the H toggle reveals them). The old raw check `messages.includes("[firstmate-synthetic-input]")` therefore fired even though the row is not visible, so it no longer matches pi's contract. I confirmed this by reproducing the exact fixture: built the failure session, exported it with the installed pi 1.0.0 `exportFromFile` template, executed the template JS in jsdom, and ran the test's node block. Every other DOM check passes; the single failing condition is that label present in the hidden shell. The pre-edit line exits 1 on that DOM, and the edited line exits 0. Fix (smallest root-cause change; no assertion deleted): the boundary is visibility, not presence, so the check now requires every `[firstmate-synthetic-input]` occurrence to sit inside a `hook-message-hidden` shell (count of label occurrences equals count inside hidden hook-type shells). It still fails on a visible hook row or a label anywhere outside a hidden shell, and still accepts absence, so it keeps guarding the boundary while matching pi 1.0.0. No pi-side or Calm-side export hook exists to alter the exported DOM, so adapting this generated-artifact assertion is the only correct fix. Verified: `bash -n` OK; the extracted edited node assertion passes against the jsdom-rendered pi 1.0.0 export DOM. I also ran the full fm-calm-pi-extension.test.sh locally with a downloaded Chrome for Testing: all assertions before the export step pass (including the render-guard), but this aarch64 host's Chrome hangs on `--dump-dom` (even a trivial page never returns), so the post-Chrome assertions could not be executed locally; CI's Chrome did render in the failing run, so the fixed assertion is the one CI evaluates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Ship through the pipeline the same diff a hand-opened PR carried: pin pi in CI so upstream cannot move it (three sites get @earendil-works/pi-coding-agent@1.0.0), align the outcomes tools' renderCall in .pi/extensions/fm-branch-supervision.ts with pi 1.0.0's stock call header (createCallFallback now formats the title plus its arguments via formatToolCallWithArgs, which pi does not export, so the shape is mirrored here and the existing byte-equality fixture keeps guarding it), and widen fm-wake-queue's wait_for_exit bound from 4 seconds to 15 (still bounded). No assertion is widened or deleted. Local self-proof: bash tests/fm-pi-branch-extension.test.sh exits 0 with 42 ok and no failures on pi 1.0.0.
What Changed
@earendil-works/pi-coding-agent@1.0.0at all three CI install sites so upstream releases can no longer move the pi version the extension tests run against.fm_branch_outcomesandfm_branch_processed'srenderCallto emit pi 1.0.0's stock call header — the title plus its arguments (key=valuecollapsed at 100 chars, tab-indented lines when expanded) — mirroring the unexportedformatToolCallWithArgsshape so Calm-off rows stay byte-identical to Pi's own fallback;docs/calm.mdanddocs/calm-mode-feasibility.mdare updated for the header parity and thefm_branch_processedhidden-shell entry.tests/fm-wake-queue.test.sh'swait_for_exitbound from 40 to 150 deciseconds (4s to 15s) in all five cases; the wait is still bounded and no assertion is changed or removed.Risk Assessment
✅ Low: The change is tightly scoped: it pins one CI dependency, mirrors a small pi-internal header formatter that was verified byte-identical to pi 1.0.0's actual source, and widens one already-bounded test timeout from 4s to 15s.
Testing
Drove the change's two live surfaces end-to-end against the real installed pi 1.0.0. The author's stated self-proof passes exactly as claimed:
tests/fm-pi-branch-extension.test.shexits 0 with 42 ok and no failures. The tool-call header change was exercised through pi's realToolExecutionComponentwith the extension'srenderCallversus pi's stock fallback: bothfm_branch_outcomesandfm_branch_processedrender byte-identical in collapsed and expanded states (visual ANSI-stripped rows captured), and mutant variants that drift the mirrored shape red the in-suite byte-equality comparison, so the guard is not vacuous.tests/fm-wake-queue.test.shexits 0 with 48 ok under the widened bound, and a direct probe confirms the 150-tick bound remains bounded (rc=124 + kill for a never-exiting process). The CI pin resolves: the exact pinned spec installs 1.0.0 in an isolated npm prefix, and a semantic YAML parse finds exactly three pinned install sites and zero unpinned. The changed surface is a terminal TUI header, so there is no browser/Electron screenshot; the rendered rows are terminal text and were captured ANSI-stripped as the reviewer-visible artifact. The only non-live aspect is that GitHub Actions itself cannot be executed on this host, so the workflow wiring is reported untested with the semantic parse as supporting evidence.npm view @earendil-works/pi-coding-agent@1.0.0 version-> 1.0.0.Evidence: Rendered call header, extension vs pi 1.0.0 stock fallback (both tools, collapsed+expanded, identical)
Source: Rendered call header, extension vs pi 1.0.0 stock fallback (both tools, collapsed+expanded, identical)
Evidence: Adversarial header byte-guard: real passes, collapsed/expanded mutants are caught
Source: Adversarial header byte-guard: real passes, collapsed/expanded mutants are caught
Evidence: Replicated in-suite whole-row fixture: real PASS, mutants FAIL (guard non-vacuous)
Source: Replicated in-suite whole-row fixture: real PASS, mutants FAIL (guard non-vacuous)
Evidence: tests/fm-wake-queue.test.sh under the widened bound (48 ok, EXIT=0)
Source: tests/fm-wake-queue.test.sh under the widened bound (48 ok, EXIT=0)
Evidence: wait_for_exit limit=150 remains bounded (rc=124 + kill; prompt rc=0)
Source: wait_for_exit limit=150 remains bounded (rc=124 + kill; prompt rc=0)
Evidence: Semantic .github/workflows/ci.yml parse: 3 pinned pi install sites, 0 unpinned
Source: Semantic .github/workflows/ci.yml parse: 3 pinned pi install sites, 0 unpinned
Evidence: Pinned spec installs exactly 1.0.0 in an isolated npm prefix
Source: Pinned spec installs exactly 1.0.0 in an isolated npm prefix
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
npm view @earendil-works/pi-coding-agent@1.0.0 version-> 1.0.0.bash tests/fm-pi-branch-extension.test.sh-> EXIT=0, 42 ok, 0 not ok on installed pi 1.0.0 (author's self-proof)Real installed-piToolExecutionComponentheader byte-comparison: extension renderCall vs stock fallback forfm_branch_outcomesandfm_branch_processed, collapsed and expanded -> identical (6/6 cases)Adversarial mutant replication of the in-suite byte-equality fixture: trailing-space collapsed drift and extra-indent expanded drift each red the comparison; unmutated extension passesbash tests/fm-wake-queue.test.sh-> EXIT=0, 48 ok, 0 not ok under the widened limit=150 (15s) boundBounded probe oftests/wake-helpers.shwait_for_exitat limit=150: never-exiting process -> rc=124 and killed; immediate-exit -> rc=0Semantic js-yaml parse of.github/workflows/ci.ymlwalk of jobs/steps/run -> 3 pinned sites, 0 unpinnednpm view @earendil-works/pi-coding-agent@1.0.0 version-> 1.0.0; isolated-prefixnpm install ...@1.0.0-> install_exit=0, resolved version 1.0.0Diff review: the test-file delta is only the fivewait_for_exit ... 40->150timeout arguments; no assertion widened or deleted✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.