Rolled partial file appends back to their pre-write size and marked malformed resumed sessions for an atomic rewrite.
Retried transient persistence failures from in-memory state and surfaced the first failure in the interactive TUI.
Fixes#8596
- Replaced time-based sleeps and polling loops with event-driven promise resolvers and fake timers across agent and tool tests.
- Migrated test suites to share in-memory auth storage and fixtures using lifecycle hooks.
- Updated catalog model definitions, metadata, and configurations.
- Stage transcript initialization inside a detached TranscriptContainer to keep existing messages visible during incremental rendering.
- Add fallback state restoration in InteractiveMode.renderInitialMessages when chat rendering is aborted or fails.
- Update render-initial-messages tests to assert that old transcripts remain visible until replacements are fully committed.
setModel() invalidates the render cache but doesn't schedule a paint.
The initial forced startup paint (line 1104) may have already rendered
the old model, so the catch-up #updateWelcomeModel() must explicitly
request a render — matching #updateWelcomeLspServers().
Address review feedback: init-time model switches (#reconcileModeFromSession,
#enterPlanMode for plan.defaultOnStartup) fire model_changed before the
subscription exists, leaving the banner stale for those cases too.
Adds a catch-up #updateWelcomeModel() call right after the subscription is
installed, mirroring how the sessionName listener is registered before
those same init steps (line 1094-1095 comment).
Also adds a regression test for the catch-up path and comments tying the
component test to the wiring gap it covers.
The welcome banner (WelcomeComponent) captures the session's active
model name at init time but never receives updates when the model
changes. Its setModel() method already existed but was never called
after construction.
This wires the model_changed agent session event to a new
#updateWelcomeModel() method in InteractiveMode, mirroring the
existing #updateWelcomeLspServers() pattern. The banner now reflects
the live model after:
- delayed config/modelRoles load (the startup race where an
alphabetically-first provider is picked before config resolves)
- explicit /model switches
- retry-fallback model swaps
/handoff mints a fresh session via newSession(), producing a new
artifactsDir and an empty local/ root. The handoff document routinely
references plans and scratch files under '/data/workspaces/can1357__oh-my-pi__8261/.omp-session/2026-08-11T16-39-09-489Z_019ff1b1-31b1-7000-81f5-c540f4ebf43d/local/,' so every reference
became a dangling pointer in the new session. The plan approve-and-execute
path already copies artifacts across the boundary; handoff did not.
Extracted the plan-approve copy helper into a shared copyLocalArtifacts()
in local-protocol.ts and invoke it across the handoff session switch
(best-effort, since the switch is already committed).
Fixes#8261
showHookCustom hardcoded the overlay geometry and never read
overlayOptions/onHandle, which regressed the v0.45.6 API (PR
badlogic/pi-mono#667). Forward overlayOptions to showOverlay (keeping the
full-cover defaults as fallback), invoke onHandle with the returned
OverlayHandle, widen the options type via a shared ExtensionCustomOptions,
and re-export OverlayHandle/OverlayOptions from the extension API.
`/plan <prompt> /skill:name` (and `/vibe`) delivered the skill token to
the agent as literal text. Mode commands strip their slash prefix and
resubmit the remaining prompt through onInputCallback ->
submitInteractiveInput -> session.prompt(), a path with no skill
dispatch, so the invocation was never interpreted.
Route mode-command inline prompts through a shared
#submitModeInitialPrompt helper that dispatches registered skills via
the same custom-message path as the editor submit flow, falling back to
a normal prompt otherwise.
Fixes#8137
Replayed idle transcripts in bounded message and time chunks, painting cleared scrollback between macrotasks so terminal input remains responsive during restore and tree navigation. Kept streaming rebuilds atomic and migrated every rebuild caller to await completion.
Fixes#8133
The persisted pre-vibe snapshot was applied on every reconciliation that
re-entered vibe mode, including cold resumes and switches in from a non-vibe
session. Those paths build their toolset from the current CLI flags and
settings, so replacing it with a historical snapshot silently drops tools the
session was started with: resuming a session that entered vibe under
--tools read with --tools read,bash restored only read on exit.
Gate the override on the one case the snapshot exists for: the vibe -> vibe
switch, where #clearTransientModeState kept the already-reduced live set.
`/goal <objective>`, `/plan <prompt>` and `/vibe <prompt>` promote the
composer draft into the first turn, but built their submission from the
draft *text* only:
this.onInputCallback(this.startPendingSubmission({ text: objective }));
The editor-submit path in `InputController` passes
`editor.pendingImages`/`pendingImageLinks` alongside the text; these four
call sites did not. A draft holding pasted screenshots therefore reached
the model with its positional `[Image #N, WxH]` markers intact and every
image payload missing, so the agent saw markers pointing at nothing and
`read "Image #1"` resolved against an empty list.
The payload was not only dropped, it also outlived the draft: the mode
commands cleared the composer with `editor.setText("")`, which leaves
`pendingImages` attached. The orphans then rode along with whatever the
user typed next, one index off, which is how a later message can attach a
screenshot the user never re-pasted.
Measured on 259 image-bearing user messages across 10 local session logs
(v17.2.x): 36 of 37 messages submitted as a goal objective lost every
image, against 190 of 198 preserved on the ordinary submit path.
Fix:
- `#takeDraftImages()` detaches the composer's pending images and links,
and all four mode-command submissions spread it into
`startPendingSubmission` (`cancelPendingSubmission` already restores
them when a submission is cancelled).
- `/goal`, `/guided-goal`, `/plan` and `/vibe` clear the draft with
`editor.clearDraft()` instead of `editor.setText("")`, so images can
never outlive the text they were pasted into (the streaming branch of
`/goal` never submits, so its draft must die whole).
Tests: two regression cases in `goal-mode-integration.test.ts` assert the
objective submission carries the image and empties the composer; both
fail on the previous behaviour with `images: undefined`. The `/plan`,
`/goal` and `/guided-goal` slash stubs now model `clearDraft`.
Entering /vibe snapshotted the live toolset into an in-memory field only.
When a session already in vibe mode switches into another session that is also
in vibe mode, #clearTransientModeState takes the removeVibeToolsPreservingActive
path, which deliberately keeps the live active set instead of applying the
source snapshot. #reconcileModeFromSession then re-enters vibe mode, and the
live toolset is by then the reduced vibe set, so the new snapshot was that
reduced set and exiting restored it instead of the target's real pre-vibe
toolset. bash, edit, write, grep, glob, task, and hub were silently gone for
the rest of the session.
Neither a cold start nor switching in from a non-vibe session is affected: the
teardown path does not run, so the live toolset is still the full one when the
snapshot is taken.
Record the snapshot on the vibe mode_change entry and read it back from
sessionContext.modeData on the re-entry path, mirroring how plan mode persists
planFilePath. Sessions written by older versions carry no snapshot and fall
back to the previous behaviour.
While the agent worked through a plan, every sub-todo rendered unchecked
no matter how far along the run was: the phase header highlighted, the
task rows below it looked untouched. Three separate causes, all on the
collapsed path that is the default view.
`selectCollapsedTodos` dropped every closed row while a phase held open
work, so finishing a task only ever *removed* a line — the panel never
rendered a checked box until the whole phase settled. That also made the
card's completion animation dead code: `details.completedTasks` drives a
14-frame strike reveal at 65ms with a component render per tick, against
a row the viewport had already discarded. The existing animation test
missed it by asserting on `expanded: true`.
The viewport now keeps the newest closed task as a checked lead row,
additive to the open-task cap so it never evicts open work, and the
strike sweep lands where users actually see it.
Second, the card gave a `done/total` count to every collapsed untouched
phase but not to the active one, so the phase being worked in was the
single phase reporting no progress. Extracted `formatPhaseProgress` and
put it on every phase header.
Third, the todo auto-clear (`tasks.todoClearDelay`, default 60s) armed
on any list holding a closed task and physically deleted those tasks
from the HUD's copy. An in-flight phase at `3/4` silently became `0/1`
sixty seconds later, fully-closed phases vanished, and stage roman
numerals renumbered off the filtered index — until the next `todo` call
restored the real snapshot. It now fires only once the whole list is
settled, which is the case the setting exists for; the walking viewport
already hides closed rows while work remains.
Progress counters also count closed tasks rather than only completed
ones. The viewport hides abandoned tasks too, so counting only
completions left a phase reading permanently stuck.
clearTransientSessionUi zeroed the command count and disposed the
preview container but left the queued components and their session id in
place, so a command run after a same-session reset previewed the stale
panel alongside the new one. Clear all three together.
Follow-up to the queued-count hint: show the panel itself, not just a count.
Since 17.0.1 (d3f4830ce, fixing #4806) panel commands queued their output
until the turn settled, so /usage and /advisor status could not answer while
the agent worked. Issue #4806's reporter explicitly offered two acceptable
fixes - output once, or show it in a separate overlaying window during
streaming - and only the first was built.
The panel now renders in the anchored container above the editor, which is
outside the transcript and therefore cannot duplicate rows in native
scrollback, and the full output still mounts in the transcript at the settle.
Capped at 40% of the viewport (min 6 rows) so a tall report cannot push the
prompt off screen.
/usage, /advisor status and every other panel command already queued their
output until the agent settled, but the deferral was silent, so mid-turn the
command was indistinguishable from a dead one.
The acknowledgment reverted in d9d911a58 used showStatus, which mounts into
the transcript; any mid-turn transcript mount re-renders rows below the
growing live block and duplicates them in native scrollback (#4806/#6767).
This uses an anchored container above the editor instead, cleared and rebuilt
in place, which is the same surface the ctrl+p role-cycle track uses for
exactly that reason.
- Reverted the status-line acknowledgment added for deferred panel
commands: showStatus mounts a Spacer+Text into the transcript, and any
mid-turn transcript mount re-renders rows below the growing live block,
duplicating them in native scrollback (issues #4806/#6767).
- The queue still flushes at every settle, terminal or not.
- Implemented in-house, zero-dependency utility modules in `pi-utils` covering DOM manipulation, markdown parsing, templating, browser automation helpers, and terminal buffers.
- Migrated packages across the repository to consume the new internal utilities and `omptype` schema validators instead of external dependencies.
- Removed multiple external runtime and development dependencies including Zod, Marked, LRU cache, Turndown, and Puppeteer browser packages.
Reaching the `isTerminal === false` branch means the superseded-turn guard
above it already passed, so `session.isStreaming` is false: a command
issued from that point mounts immediately while panels queued earlier in
the turn stay in `#pendingCommandOutput` until some later terminal
agent_end. Newer output rendered ahead of older, and the queued panel
could strand for minutes on an async fan-out that keeps settling
non-terminally.
Flush there too. The transcript is quiescent at a settle, which is the
condition #4806 wanted, and the notice now says "until the agent pauses"
rather than promising the current turn.
`presentCommandOutput` queues transcript panels while the agent streams,
so a growing turn cannot bury them, and flushes at turn end. It did that
silently, so `/usage` and `/advisor status` on a long multi-subagent turn
look like dead commands: nothing renders for minutes and the user retries
or assumes a crash. Acknowledge the deferral in the status line.
Reserve the plain b shortcut only after /btw has a completed answer or a branch is already pending. Running, empty, aborted, and failed panels now leave the key for the composer, while completed-but-refused branches still consume it with an explanation.
Fixes#7474
Branched session files preserve entry ids, so leaf-id equality alone let a stale /btw answer promote into a different loaded session. Capture the originating session id at /btw start and require it to match at both the controller gate and every branchFromBtw checkpoint.
Fixes#7474