Repository navigation
fix(chat): refresh context usage between model calls - #1058
Merged
Merged
Conversation
Change-Id: I423982a12d024afebc8da1e67836722a6e2aae3b
This was referenced Oct 4, 2026
The shared request id let any newer usage read invalidate older ones, even when the newer read failed (non-ok reply or network error). A good reply from an in-flight poll was then dropped, and usage stayed stale until the next assistant message, poll tick or agent_end. Track the last applied id instead: a reply applies only when it is newer than the last one applied, so delayed replies still cannot overwrite newer usage. Each mount marks the reads started before it as stale, which keeps the unmount invalidation without reading a ref in effect cleanup. Co-Authored-By: Claude Opus 5.5 <[email protected]>
dreadster3
added a commit
to dreadster3/pi-web
that referenced
this pull request
Oct 9, 2026
* fix(subagents): reject unsupported resume option overrides Reject effective creation options before resuming an existing child. Preserve empty defaults, including max_turns: 0, and document the continuation contract. Reuse the existing SDK integration harness to verify rejection before dispatch and compatible continuation. * Render write() tool content as readable file text (agegr#1024) * Render write tool content as readable file text (cherry picked from commit 8476b85b6579054a61a7da97592deb0eb7646dd0) * fix(chat): keep write's JSON view when the file text would hide arguments Show the file text only for a write whose input is just path/file_path and content, so another argument (a mode, a title) stays visible. Streamed input, which is still incomplete JSON, and an empty file keep the generic view too. Drop the duplicate tool-call-expansion import the merge with main left in the test file, which stopped MessageView.test.mjs from loading. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> * feat(chat): show extension command buttons in the status bar (agegr#1030) * feat(chat): render extension action chips in the composer footer Extensions can declare a clickable action chip via a status entry whose key starts with "chip:": ctx.ui.setStatus("chip:/mode toggle", "🔨 Build"). The chip renders in the composer footer to the left of the reasoning-level control (directly visible on mobile too), and clicking it sends the command part of the key through the normal send path. Extension commands execute immediately server-side and are not recorded as user messages, so the chip acts as a lightweight remote control (mode toggles, quick prompts). - chip statuses are hidden from the bottom extension status shelf to avoid duplication - chips are disabled while the session is streaming, matching other footer controls * feat(chat): show extension command buttons in the status bar Move the action buttons from the composer footer into the extension status bar, where setStatus text already lives, and rename the convention: ctx.ui.setStatus("command:/mode toggle", "Build") is a button cell that sends /mode toggle. - Only keys whose command starts with "/" make a button. Anything else would reach the model, and "!" would run a shell command; those stay plain text. - Every status is its own cell, in key order, divided by vertical rules like the widget triggers. A command cell is a button as tall as the bar with no box border, so the whole cell is clickable. Statuses with nothing visible get no cell. The text is cleaned of ANSI and whitespace as before. - The widget triggers and the status line share one row that scrolls sideways as a whole; the expanded widget panel stays above it, outside the scroll. - Buttons are disabled while the session is busy. Touch screens get 44px cells (widget triggers included) when the bar has a button. - Document the convention in docs/agents/sessions.md and register the two components in AGENTS.md. The ChatInput footer chips and their source-regex test are dropped. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --------- Co-authored-by: ddonggit <[email protected]> Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> * fix(chat): let extension dialogs and the custom panel be widened (agegr#947) (agegr#1032) * fix(chat): let extension dialogs and the custom panel be widened (agegr#947) Extensions showing long content - a formatted SQL confirmation, a diff, a read-only side panel - were boxed into the hardcoded min(560px, 100%) dialog with no way to get more room, and every wrapped line also costs height (agegr#947). - ctx.ui select/confirm/input/editor accept an optional dialogSize ("sm" | "md" | "lg" | "full") hint. "sm" keeps the historical 560px dialog, so default behavior is unchanged; unknown values fall back to it instead of poisoning the request. - The extension dialog and the custom panel get a maximize/restore button next to the collapse chevron. "full" fills the content region above the composer while the overlay keeps its own 20px breathing room, so the composer stays visible. - Without a request-level hint the user's maximize choice persists in localStorage across openings; a hint wins over the stored preference, and toggling a hinted dialog never writes back into it. * fix(chat): fit extension dialogs to their content instead of taking a size hint (agegr#947) Drop the dialogSize option from ctx.ui.{select,confirm,input,editor}. It was a pi-web-only field that no stock pi extension sends, and the problem is purely how the dialog is shown, so the browser should decide. A dialog now opens at its usual 560px and grows only when a code block or table inside it would scroll sideways (formatted SQL, diffs, logs): it takes exactly the missing width, rounded up to 40px, capped at the content region above the composer. Prose wraps and never triggers it. It only grows, and re-measures when highlighted code replaces its plain fallback. The maximize/restore button stays as the user's override for the dialog on screen. Nothing is stored: a later dialog starts from its own content. The custom panel's maximize button is gone. Its lines are already wrapped to the width the extension asked for, so widening the box never changed the wrapping. The panel is now as wide as its widest line (at least its usual 920px, at most the content region), so lines wider than 920px no longer scroll sideways. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --------- Co-authored-by: yanshinan <[email protected]> Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> * docs(agents): extensions must behave the same here as in the pi CLI State the principle behind agegr#1032 in AGENTS.md: display problems are fixed in the web client, never with pi-web-only options or fields on the extension API, and pi's TUI is the reference for what an extension's request means. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * perf(sidebar): replace SMIL spinner with compositor-friendly CSS animations (agegr#1042) The running-session spinner and unread-activity ripple used SMIL <animateTransform>/<animate> with repeatCount=indefinite. SMIL geometry animations force a main-thread repaint of the whole page every frame while any agent is running (measured 12-19% GPU on RTX 2080 at 2560x1080 vs ~2% with the animation paused, A/B/A verified reversible). - RunningSessionIndicator + project activity badge: SVG <animateTransform> -> Tailwind animate-spin (CSS transform rotate, already used by AgentSessionPanel/AppShell spinners). Same 14px/10px arc path. - UnreadSessionIndicator: SMIL r/opacity ripple -> .unread-ping CSS opacity-only keyframes, with prefers-reduced-motion fallback. Co-authored-by: userliwq <[email protected]> * fix: preserve failed uploads and authorize git diff targets (agegr#1039) Fixes agegr#1038 and agegr#1037. Add regression coverage for failed replacements, junction access, and deleted-file diffs. Co-authored-by: Elvis <[email protected]> * fix(models): preserve the catalog API protocol for models-only providers (agegr#1050) * fix(models): preserve catalog protocol for models-only providers * test(e2e): restore desktop state before model discovery --------- Co-authored-by: jidekaixin2dian <[email protected]> * feat(subagents): preload named skills from profiles (agegr#1034) * feat(subagents): preserve named skill scopes in profiles and snapshots * feat(subagents): preload named skills across spawn resume and reopen * fix(subagents): keep profiles readable and match pi's skill switch - Parse `skills:` leniently. An empty value, a trailing comma or an empty or non-string item made the profile throw, so it vanished from the Agents panel and `Agent` reported it unknown. Empty and non-string items are now dropped, as pi-subagents does, and an empty value means no list. - `true` / `all` / `none` / `false` stay switch spellings that a save keeps in step with `load_skills`, as on main; `skills: none` alone switches skills off. - `load_skills: false` is pi's `noSkills` again, which keeps the skills an extension provides; the override no longer hides them. - A malformed snapshot list narrows to the names it holds instead of throwing, so session reads and reload keep working; it never widens to the catalog. Drop the validate-only call before resume. - Drop the name-pattern check: names are only looked up among discovered skills, and it could only block real ones. - Return nothing from before_agent_start when there is no text to add. - Show a profile's skills list read-only under the skills switch. - Move the notes into docs/agents/subagents.md and fix the stale replace-mode sentence in docs/agents/tools.md. Replace mode without a list appending pi's catalog is kept and documented, as pi's --system-prompt does. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(subagents): load only the extensions a profile's extensions: list names (agegr#1091) A subagent profile's `extensions:` key was read as a switch only: a list such as `extensions: [codegraph]` loaded every extension, and so did `extensions: none`. pi-subagents, which reads the same profile files, loads only the listed extensions. - `scopeSubagentExtensions()` is an `extensionsOverride` that keeps the named extensions after the SDK loaded them, as pi-subagents does, and drops the provider, native provider and virtual model registrations the others queued. Dropped extensions bind no handlers, tools or commands; their factory has already run once, so this is a scope, not a sandbox. It uses only public loader options, and the SDK reapplies it on every reload. - Names resolve like `ext:` selectors (directory, file or package name, case-insensitive); a name two sources claim keeps neither. pi-web's own `<inline:...>` extensions always stay. Path entries load nothing, so a project profile cannot load code that project trust gates. - `*` keeps every extension, `none` / `false` switch extensions off, and `load_extensions: false` wins over a list. The list parses as leniently as `skills:`. - The child's snapshot keeps the names, so resume and RPC reopen apply the same scope (`subagentExtensionLoaderOptions()`, shared by both paths). - The Agents panel shows the list read-only under the extensions switch, and a save keeps it as authored. The skills line now says it lists skills, since the two lines sit side by side. Refs agegr#1035, agegr#955 Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(markdown): wrap long table cells without squeezing wide tables (agegr#1056) Bound header and data cells while preserving natural table sizing and horizontal scrolling. Cover long headings, prose, links, inline code, and wide tables in the existing desktop and mobile browser regression. Fixes agegr#1052. Co-authored-by: wayne.luo <[email protected]> * fix(subagents): keep turn limits and terminal outcomes at the SDK boundary (agegr#1093) * fix(subagents): preserve terminal outcomes at turn limits Use the awaited SDK finishTurn boundary for bounded runs, preserve natural completion and finalized tool termination, and retain partial output for budget failures. Keep cancellation and provider failures distinct. * fix(subagents): keep the turn limit when messages are queued Follow-up to the turn-limit lifecycle change from agegr#1054: - An `end` decision from finishTurn did not stop the run: AgentSession starts another run for anything still queued. A parent steer during the wrap-up turn led to a third model call with max_turns: 1. The limiter now clears the queues, lists those messages in the turn-limit error, and refuses steer_subagent from then on. - In one-at-a-time mode a steer queued before the wrap-up turn took that turn and held the instruction back, so a final answer was reported as a turn-limit failure. The wrap-up turn now takes everything queued. - Stop in the child's own chat ends the request with stopReason "aborted" without telling the controller; report it as aborted instead of failed, on start and resume. The test that claimed queued messages were kept for resume passed only because the extra call consumed them; it now checks they are reported. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: wayne.luo <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(markdown): preserve code backgrounds across theme changes (agegr#1060) * fix(markdown): preserve code backgrounds across theme changes * fix(demo): mirror the code block background fix Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(chat): refresh context usage between model calls (agegr#1058) * fix(chat): refresh context usage between model calls Change-Id: I423982a12d024afebc8da1e67836722a6e2aae3b * fix(chat): keep an older usage read when a newer one fails The shared request id let any newer usage read invalidate older ones, even when the newer read failed (non-ok reply or network error). A good reply from an in-flight poll was then dropped, and usage stayed stale until the next assistant message, poll tick or agent_end. Track the last applied id instead: a reply applies only when it is newer than the last one applied, so delayed replies still cannot overwrite newer usage. Each mount marks the reads started before it as stale, which keeps the unmount invalidation without reading a ref in effect cleanup. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(shell): restore desktop sidebar state after mobile resizing (agegr#1059) Change-Id: I3cd96254c43ddb59da17f60bd0e3d4e19de914f8 * test(e2e): wait for the desktop sidebar to settle after mobile resizing Returning from the mobile breakpoint now restores the desktop sidebar preference in an effect (agegr#1059), so the Show sidebar button could vanish between the visibility check and the click. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * feat(chat): drop files onto the chat to upload them and mention them (agegr#1094) Dropping a non-image file onto the chat did nothing. It now goes through the explorer's existing upload (POST /api/files/<cwd>?type=upload) into the working directory, and the composer gets an @mention per file. - conflict=skip: a drop never replaces a file. A name that already exists is still mentioned (often the very file dragged out of the project) and a notice says the mention points to the existing file. - Images still attach to the prompt; folders are left out with a notice, since the endpoint writes flat file names only. - uploadFiles() moves from FileExplorer to lib/file-upload-client.ts so the explorer and the chat share one client. - The explorer tree refreshes after a drop upload. Lighter take on agegr#1065: no new endpoint, no folder copy, no renaming. Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(models): list providers that extensions register at session_start (agegr#1071) pi-web builds a fresh ModelRuntime for every model listing and never starts a session in it. Extensions that register their provider only in the first runtime of a process and defer later ones to session_start (pi-claude-bridge) disappeared from the picker after the first listing, and a session could not start on their models. Remember the available models of every runtime pi-web builds and add back providers a runtime does not register at all. A session whose requested or restored model is deferred starts on the default and switches once its extensions are bound. Co-authored-by: Alex Yang <[email protected]> * fix(markdown): render emphasis next to CJK punctuation (agegr#1072) CommonMark leaves the asterisks visible when a CJK sentence ends in punctuation and the next sentence starts without a space. Use remark-cjk-friendly's parse-only extension in the shared message and preview pipelines. User messages inherit the same extension. Add coverage for adjacent CJK sentences, brackets, nested emphasis, code and escapes. The extension also tightens some existing ASCII and emoji boundaries, which can leave outer asterisks visible in previously emphasized text. This follows the extension's flanking rules and changes how those older messages render. Refs: commonmark/commonmark-spec#650, commonmark/commonmark-spec#839 * fix(sw): don't hold static responses behind the cache write (agegr#1089) Opening Pi Web intermittently showed the service worker's offline page ("Pi Web is offline") after an upgrade, even though the local server was perfectly healthy. Hard reloads sometimes recovered it, which made it look like a flaky server. The worker script URL is versioned (/sw.js?v=<app version>), so every upgrade starts a cold cache: the first load misses on every _next/static/* asset at once. cacheFirst() then awaited cache.put() before returning the response, so the worker held every response until its write landed. That congestion pushed navigations past NAVIGATION_TIMEOUT_MS (8000), whose only fallback is offline.html. Measured on one URL with one healthy server, only the worker differing: page controlled by the SW 8302 ms, and the offline page reproduced SW unregistered 716 ms after this change 652-2967 ms across 8 cold-cache navigations Return the response first and keep the write alive with event.waitUntil. A failed write now costs one network re-fetch instead of blocking the page. Adds "a cache miss responds before the cache write finishes", which stubs cache.put with a promise that never settles and asserts the response still resolves; the fetch-event harness now supplies waitUntil. * fix(sessions): don't force-navigate to an empty chat when the deleted session was already left (agegr#1083) handleSessionDeleted captured selectedSession in its useCallback closure, so the stale copy was still the deleted session when the DELETE request resolved after the user navigated away, and it forced an empty chat. Read the selection from selectedSessionRef (synced every render) and only take over when the session is still selected at resolution time; its cwd is then correct for the new draft. Co-authored-by: Alex Yang <[email protected]> * fix(security): rotate preview-mode secrets at startup to close proxy auth bypass The published npm tarball ships .next/prerender-manifest.json, whose preview.previewModeId is baked into every release. Next skips middleware (proxy.ts) for requests whose x-prerender-revalidate header equals that id, so anyone who reads the public tarball could bypass the password gate and the Host/Origin/Fetch-Metadata checks on any route proxy.ts covers. Rewrite the three preview secrets (id, signing key, encryption key) with fresh random values in bin/pi-web.js before launching next start, so the published values are useless and unique per launch. Done on the guaranteed launch path rather than a postinstall hook so it can't be skipped with --ignore-scripts; a read-only install warns instead of silently staying vulnerable. Reported by XlabAI Team of Tencent Xuanwu Lab. Co-Authored-By: Claude Opus 4.8 <[email protected]> * feat(settings): support custom font families and weights (agegr#1074) * feat(settings): support custom font families and weights Add separate interface/chat and monospace font preferences with live previews, browser persistence, fallback stacks, independent resets, and cross-tab synchronization. Update code rendering, draft sizing, and terminal fonts without restarting terminal sessions; add unit and browser regression coverage. * refactor(settings): one Fonts & layout section, every row shaped like the sliders Fonts, chat font size and content width move into one section after Appearance; Chat keeps its behavior switches. Each row is a header line (label, value, reset) over a full-width slider: a font row puts its name field in the header and uses the slider for its weight, so values, resets and sliders line up, and both name fields share one grid. The name field is drawn in the font it names, replacing the separate preview lines; labels and the description are shortened. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(settings): keep emphasis heavier than the base font weight; drop no-op font-load refit Base weights stop at Semi Bold (600). Headings and labels use 600 and bold text, highlighted bold and the terminal's bold use 700, so an 800 or 900 base made ordinary text heavier than the text meant to stand out. xterm's default bold (700) now always stays above the base weight. The terminal's document.fonts ready/loadingdone refit did nothing: xterm ignores an option set to its current value, so it never remeasured and only ran fit() whenever any font on the page loaded. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(chat): make file mentions undoable (agegr#1098) * fix(chat): make file mentions undoable * fix(chat): fall back to a plain edit when execCommand refuses a mention Without the fallback a refused execCommand('insertText') silently dropped the mention. setRangeText plus an input event keeps it landing, minus the undo entry. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> * feat(sidebar): project groups, pins and archive with a Sessions | Files split The sidebar showed one project at a time in a 54px two-line list, shared its height with the explorer, and offered no way to keep or hide sessions short of deleting them. It now lists every project in one virtualized tree: - A "Sessions | Files" tab row. Files holds the project dropdown, the worktree row and the explorer at full height; FileExplorer stays mounted while hidden. The vertical sessions/explorer split is gone. - All projects as collapsible groups: the six newest families plus any running, unread or selected one, "show more", running/unread counts when collapsed. Groups only toggle; they never change the cwd. A group that loses "current" stays open, so rows do not jump under the pointer. - Single-line rows (32px, 44px on phones) with a status slot, title, branch and short time; hover shows archive and a row menu (pin, rename, mark read/unread, archive, delete). Right-click dispatches pi-web:session-row-contextmenu first and opens the built-in menu only when nobody claims it. Phones get the menu as a bottom sheet kept inside the visual viewport. - Global pinned section, pinned projects, archive with a 10 s undo toast, an archive view and an "Archived" tag in search. Bulk "archive older than 7 days" per project, chunked to the 500-id request cap. - Worktrees: clicking a session switches to its worktree; the Files tab row is the only explicit switch; a group "+" asks which worktree (or creates one) when the project has several. Pins and archive times live in <agentDir>/pi-web-session-state.json, keyed by family root id, never in .jsonl (custom entries would move the leaf and be copied into forks; moving files breaks parentSession paths). Writes are queued, locked and atomic with a revision that /api/agent/running reports so every tab and device refetches. A family counts as archived while archivedAt >= root.modified, so a new message (also from pi CLI resume) brings it back; DELETE forgets the state. pi CLI's /resume still lists archived sessions. AppShell.handleNewSession takes the target projectKey and adopts the project before the cwd is reported, so starting a session in another project clears the previous project's file tabs like every other project switch. Tests: the new store, route, tree model, prefs, menu, toast and tree are covered; tests that pinned the old split, row height and SessionItem are rewritten; e2e selectors follow the new DOM. Docs: sessions.md, files-and-access.md, client-platform.md, README context-menu section, AGENTS.md file map. The unused lib/file-explorer-state.ts, the old subagent-nesting lib/session-tree.ts and sessionsForProject are removed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(sidebar): page "show more" by 20 and restyle session rows - "Show more" reveals 20 more sessions per click instead of the whole group; running, unread and selected sessions stay visible without using up the step. "Show less" appears once there is something to fold. - Hover and selection are a rounded box inset from both edges, with the collapse chevron after the group name. - The running spinner and the unread dot take the time's place on the right, so titles start further left. - The list keeps the scrollbar's room while everything fits (scrollbar-gutter: stable, overflow-y: scroll before Safari 18.2), and the measured width keeps the left and right margins equal, so rows neither narrow nor shift when the list starts to scroll. Co-Authored-By: Claude Opus 5.5 <[email protected]> * style(sidebar): 13px session titles, selection by color instead of weight Titles go from 12px to 13px on desktop (phones already used 13px, so their override is gone). Unselected titles take a softer mix of --text and the panel color; the selected one takes the full --text color and no longer turns semibold, as in the Claude Code sidebar. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(file-viewer): keep the source view background across theme switches The stock Prism themes color <pre> differently: `vs` with backgroundColor, vscDarkPlus with background. The highlighted source view also set background through customStyle, so switching between a light and a dark theme made React remove one property beside the other on the same <pre>. It warned about mixing shorthand and longhand, and the view lost its background (transparent after switching to dark, white after switching back to light). As CodeBlock does since agegr#1060, the source view now sets backgroundColor itself and uses vscDarkPlus without its <pre> background shorthand. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): pick the project and worktree above the new-session composer A group's "+" in the sidebar no longer asks which worktree to use: it starts the session at once, in the sidebar's worktree for the current project and in the project root for another one. The empty new-session page shows a quiet bar above the composer with the project and, at the top of a git checkout, the worktree. The project menu lists the sidebar's projects plus "Open another project…" (the folder picker); the worktree menu lists the checkouts plus "New worktree…". Picking one moves the fresh composer there: the draft (text and images) and the chosen model and reasoning level go along instead of being parked under the old folder. The sidebar keeps owning the cwd and project identity; it reports what the bar shows and carries out its moves through a small handle. The Files tab keeps its own project and worktree switcher. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(sidebar): fork a session from its row menu Fork (F) copies the session's current branch into a new session file whose header points at the source, then opens it. It is offered in the project groups, the pinned section and the archive view, also while the session runs: POST /api/sessions/[id]/fork works on disk with its own SessionManager (lib/session-fork.ts), takes the leaf the user sees (the open wrapper's, else the file's), and never starts, prompts or shuts down an AgentSession, so a running source keeps its run. Empty, unsaved and subagent sources are refused with a toast. The copy is selected like a row click and revealed in the tree through a small reveal request that SessionTree handles once (it keeps the row mounted until then and expires if the row never shows). If the user moved on while the fork was being made, they stay put; the copy is marked unread and the toast offers Open. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(sidebar): keep the project order fixed and reorder projects by hand Project groups no longer jump to the top when one of their sessions gets new activity. The order is stored as projectOrder in pi-web-session-state.json, shared by every browser and written through the same lock, revision and optimistic queue as pins and archive: - With nothing stored, the first sidebar that has the synced UI state and the full session details saves the current recent-activity order. - A project seen for the first time is added at the top (add-projects never moves or evicts a stored key, so saving never moves anything on screen). Activity never moves a saved project again. - Only a manual move changes the order: drag a group header (after a few pixels with a mouse, after a 350 ms long-press on touch or pen), or Move up / Move down in the group menu. A move is stored relative to one neighbour (move-project), so concurrent browsers do not overwrite each other. Pinned projects stay above the others; a drag stays in its band, a pin lands at the bottom of the pinned band and an unpin at the top of the rest. The drag lives in hooks/useGroupDrag.ts: pointer events with capture, a drop line computed from the tree model, a ghost outside the scroller, auto-scroll near the edges, Escape to cancel, and a header-only non-passive touchmove so list scrolling keeps working. A tap or click on a header still toggles the group. The moved group is revealed with the existing tree reveal request. Co-Authored-By: Claude Opus 5.5 <[email protected]> * style(chat): set the new-session project and worktree bar like the composer controls The bar above the new-session composer now uses the composer's own control style: the UI font for both buttons (the worktree no longer in code type, in the bar or its menu), 12.5px, 30px high, 9px radius, muted text that darkens on hover, dim icons, a thin divider between project and worktree, and a little more room above the composer. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(sidebar): name a fork after its source with a short random suffix The sidebar's Fork now writes a name into the copy (and only the copy): the title the sidebar shows for the source, " · ", and 4 random hex digits, e.g. "PR#1030 状态栏命令按钮 · 3f9a". A long first-message title is shortened to 40 code points first; forking a fork replaces its suffix instead of stacking another. A source with no title text (only shell output or images) gives an unnamed copy, as pi's /clone does. The chat's fork-from-message and /clone keep pi's behaviour. The row and the success toast cut the title before the suffix, never the suffix, so copies stay distinguishable in the narrow sidebar. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(sidebar): keep the drag ghost clear of the drop line While a project group is dragged, the floating name no longer covers the blue drop line. It is a small one-line pill that follows the pointer (8px above a mouse, 28px above a finger), placed by the pure ghostTopFor(): it moves only as far as it must to stay clear of the pointer and the line and inside the list, so it does not jump when the target changes. The line gets a 6px dot at its left end so it reads as an insertion marker. Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(sidebar): share one project/worktree picker between the Files tab and the new-session bar ProjectWorktreePicker holds the two buttons and both menus, and both places use it: the new-session bar as two inline chips (unchanged look), the Files tab as two full-width rows in the same type (no more code font): the project name with its path cut from the left, and the worktree's branch, "main" note and count. The menus are SidebarMenu everywhere, so the Files tab gains the phone bottom sheet and keyboard navigation. SidebarMenu gains a filter (from 8 choices, IME-safe, Escape clears then closes) and an optional secondary action per item. Both project menus offer "Use default directory" and "Open another project…"; both worktree menus offer "New worktree…"; only the Files tab can remove a linked worktree (with the force confirmation in the menu). Each place keeps its own behaviour through callbacks: a Files pick moves the sidebar's cwd and parks the draft as before, a bar pick moves the fresh composer and carries the draft. The old inline-styled Files dropdowns and their state are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): put the new-session project bar on the brand's row The empty new-session page's header now holds the brand, the project and worktree bar and the versions in one row. The bar stays beside the brand while its chips fit whole and otherwise takes a line of its own under it, with the full width below the floated versions: the room the names need decides, not the viewport. The brand gives way beside the versions (the update link's version is cut first) instead of dropping below them. The inline picker's project chip loses its 60% cap: the bar is now as wide as its chips, so the cap left a lone chip (a repo subdirectory, no worktree list) with its name 0px wide. The project never shrinks; the worktree button is cut first, down to its icons. The app update check runs once per page, so a fresh composer's header has the link in its first paint and a late link cannot push the bar down. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(sidebar): keep the files tab's buttons in view, in the project card The files tab is one card on the panel: the project and worktree rows, then the six buttons used most (terminal, open in the file manager, upload, refresh, file search, changes view), with no title row and no line across the sidebar between the tabs and the tree. A short line inside the card marks the buttons off from the rows. The buttons spread from the rows' icon column to their chevrons and are always the same ones: the changes view stays, disabled, while nothing is changed, so no button moves when an agent's edit or a commit flips the count. The folder's actions come first and the tree's two toggles last. They are a group of their own ("File actions"), outside the picker's, and give way together at the sidebar's 180px minimum. The file search field loses its line too. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(sidebar): search the files from the header's search button The files card loses its search button: on the files tab the header's search button opens the file search instead (its title, pressed state and aria-controls follow), and elsewhere, or on a files tab without a folder, it is the session search as before. The card keeps five buttons: terminal, file manager, upload, refresh and the changes view. Co-Authored-By: Claude Opus 5.5 <[email protected]> * style(sidebar): flatten the files tab's card into the sidebar's chrome The card under the Files tab, white with its own border, drew the eye away from the tree. The picker rows and the five buttons now sit flat on the panel like the tab row, as one more strip of the sidebar's chrome, and the tab row's line moves under them on that tab, so one line still runs between the tabs and the tree. The buttons take the tab row's ⋯ style: borderless, dim, bg-selected on hover. The folder's four start at the rows' icon column, and the changes view sits at the right end, where ⋯ is on the Sessions tab. With the tree's 4px sides, the icons line up with the tree's chevrons and the chevrons with its status letters. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(sidebar): one toolbar row for the sidebar, main's project and worktree boxes The sidebar's brand and its tab row become one toolbar row in the cells of the chat's top bar beside it: Sessions | Files, New and search, 36px with its line so the two bars read as one. The chosen tab and the open search take the bar's accent line. Labels give way where they do not fit (measured, since their widths change with the language): New keeps its +, then the tabs their icons. The view menu goes: collapsing and expanding every group moves to a group's menu and to Alt+click on its header; the archive is the tree's footer row. The project and worktree picker looks as the files tab drew it on main, in both places: grey boxes with the project's whole path and the worktree's branch in code type, cut at their left. The files tab stacks them over square, borderless file keys and a line to the tree; the new-session header shows them side by side without the box. Their menus on a desktop are main's dropdowns again: whole paths, "Custom path…", the "New worktree…" form under the list, a dirty checkout's question in its row. Phones keep the sheets. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(css): drop the unread ping the redesigned sidebar no longer uses main's compositor-friendly .unread-ping replaced the SMIL ripple of the old sidebar's unread indicator. The redesigned sidebar has no such indicator: its unread dot (.session-tree-unread, app/sidebar.css) already pulses with transform and opacity only and stops under reduced motion, so the rule had no element left. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(deps): upgrade pi to 1.1.0 Bump @earendil-works/pi-agent-core, pi-ai, pi-coding-agent and pi-tui from 1.0.0 to 1.1.0 (releases v1.0.1 to v1.1.0). pi no longer ships an npm-shrinkwrap.json, so pi-ai, pi-agent-core and pi-tui are one copy shared with pi-web. Adapt to the changes that reach pi-web: - Project overrides of global MCP servers (pi 1.0.1): a project entry without command, url or type changes only enabled, exposure and toolExposure of the global server of its name. Settings › MCP lists it as that global server with the changes, refuses one the loader skips in its words, and marks the global entry overridden. A global server's "This project" row turns it on or off for the project alone (set-in-project), as /mcp does. Writes keep enabled: true and exposure: "codemode" in an override, byte for byte as the SDK's editor. Test, sign-in and sign-out connect the merged entry, the host records it under the override's row, and the trust dialog says what an override changes. - MCP sign-in passes the flow's signal to signInMcpServer() (pi 1.1), so a cancel or expiry stops it at any step. - The paste importer reads oauth.clientRegistration and ports the validator's cimd rules. - A stopped run is not a finished one (agent_settled.aborted): no done sound, browser notification or "Task finished" push; prompt_done carries aborted. - Tool cards show the execution time pi now records (durationMs), as the CLI's "Took", instead of a timestamp difference that counted the model's generation; thinking blocks use the response's durationMs. - The Azure provider is now `azure`; its icon follows. - The ToolLoadout test stub gains getPromptGuidelines(). Settings › MCP selects draw their own chevron, inset like their text. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(settings): scroll the general page across the dialog's full width The general page's scroll box was capped at 680px, so its scrollbar sat in the middle of the dialog with blank space to its right. The page now fills the dialog and scrolls there; its children keep the 600px content column. Co-Authored-By: Claude Opus 5.5 <[email protected]> * style(settings): drop the general page's title, which repeats the active tab Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(files): explorer switch to show Git-ignored files, dimmed with the reason (agegr#1092) * feat(files): explorer switch to show Git-ignored files, dimmed with the reason The explorer bar's eye switch (off by default, kept in localStorage) lists directories with ?type=list&hidden=1. The route then also returns what Git ignores and what the name-list fallback hides, marked hidden: ignored|excluded; .git and .DS_Store stay out. The tree dims those entries, names the reason in the tooltip, and lets entries inside a hidden directory inherit it. * feat(sidebar): the ignored-files switch in the files tab's head The explorer bar the switch lived in is gone with main's Sessions | Files tabs. The switch is now a key in the files tab's head, next to the changes view: the folder's four actions from the left, the tree's two views (what it lists, then its changes) at the right end. - One label, "Show ignored files", with aria-pressed, like the changes view; the "Hide ignored files" string goes. - Kept per browser in lib/sidebar-prefs.ts (pi-web:sidebar-files-show-ignored) and restored in the mount effect with the tab, so the first client render still matches the server's HTML. lib/file-explorer-state.ts is gone on main. - Six keys fit the sidebar's 180px minimum: min-width 26px -> 21px. The push to the right end is a margin on the eye: a wrapper around both views took their icons' width as its size and squeezed them at any sidebar width. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * chore(deps): bump next to 16.3.8 and apply npm audit fix next 16.3.6 carried six advisories (SSG/ISR cache poisoning, dev MCP endpoint disclosure, image optimizer SSRF, among others). The pinned version is what npm users install, so the patch release matters. npm audit fix also refreshes js-yaml, sharp, dompurify, source-map-js and brace-expansion within their ranges; mermaid moves to 11.17.2. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Release v0.11.0 * docs(worktrees): document branch picker * docs(worktrees): fix branch menu scope --------- Co-authored-by: wayne.luo <[email protected]> Co-authored-by: draxxris <[email protected]> Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> Co-authored-by: ssr_acl <[email protected]> Co-authored-by: ddonggit <[email protected]> Co-authored-by: nsyan <[email protected]> Co-authored-by: yanshinan <[email protected]> Co-authored-by: userliwq <[email protected]> Co-authored-by: userliwq <[email protected]> Co-authored-by: Elvis <[email protected]> Co-authored-by: Elvis <[email protected]> Co-authored-by: jidekaixin2dian <[email protected]> Co-authored-by: jidekaixin2dian <[email protected]> Co-authored-by: acniray <[email protected]> Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Wayne <[email protected]> Co-authored-by: xuzijian2019 <[email protected]> Co-authored-by: Guillaume Legrain <[email protected]> Co-authored-by: keeword <[email protected]> Co-authored-by: 0xfa1e <[email protected]> Co-authored-by: Mitchell Kager <[email protected]> Co-authored-by: Liang Gong <[email protected]> Co-authored-by: Tiger <[email protected]> Co-authored-by: Matthias Kuchem <[email protected]>
agegr
added a commit
that referenced
this pull request
Oct 9, 2026
…ion switches (#988, #1031, #877, #896) (#1114) * fix(chat): clear the retry banner once the retried run starts (#988) pi emits a successful auto_retry_end only at the retry's first complete assistant message, so the banner said "Retrying" through the whole retried reply. pi's TUI drops its retry indicator when that run starts; clear it on the run's agent_start the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): read context usage when the event stream connects (#1031) Opening a session's event stream is what resumes a wrapper the idle timeout reaped, so the mount's state read often finds no runtime and leaves the context percentage blank. Since #1058 a run fills it in after its first reply; read it on `connected` too, through the same ordered usage read, so it shows as soon as the runtime is back. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): keep a streaming reply's t/s start across session switches (#877) The start of the tokens-per-second measurement lived in the message view, which a session switch remounts. Back on a running session, the new view took its start at the remount and divided every token streamed so far by half a second, showing thousands of t/s. Keep the start per reply (provider, model and request timestamp) outside the view; a reply joined with no record (a reload) times only the tokens that follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): reveal loaded rows the history window still hides (#896) The window keeps as many rows as messages are loaded, but a turn's answer and its thinking render as two rows, so a thinking-heavy session hides its oldest loaded rows behind "Load earlier messages". Since #587 the sentinel only fetched from the server, so with no older page there, reaching it did nothing. Widen the window in that case again, renew the observer when it grows, and observe the sentinel whenever it mounts, not only when the history cursor changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
dreadster3
added a commit
to dreadster3/pi-web
that referenced
this pull request
Oct 11, 2026
* fix(build): keep .claude worktrees out of Tailwind's source scan Tailwind's automatic detection scanned .claude/worktrees, so webpack snapshotted those directories too. A worktree whose node_modules is a symlink to another worktree's node_modules yields a context entry with no hash, and `next build --webpack` crashed in WasmHash.update with "Cannot read properties of undefined (reading 'length')". Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(markdown): stop clipping two-digit ordered list numbers The bold outside marker of "10." and up is wider than the list's 22px padding, and .markdown-body's overflow-x: hidden cut off its left side. Ordered lists now size their padding from the digit count of their largest number (at least two), which MarkdownBody passes as --ol-marker-digits. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): let the compaction error above the composer be dismissed (#784) (#1109) A failed or refused compaction ("Nothing to compact (session too small)") left its red banner above the input until the next compaction started, with no way to close it. The banner now has the same close button as other inline errors. Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(chat): hide display:false custom messages; anchor turns on pi-subagents' completion notice (#1043, #1075) (#1110) * fix(chat): hide custom messages sent with display:false (#1043) pi's TUI renders a custom message only when `display` is set; extensions use display:false for context meant for the model alone. pi-web drew each one as a collapsed "hidden extension message" card, and an extension that sends one on every session_start added a card on every idle restart. They stay in the history, so entry ids stay aligned, but render nothing, are not counted in Process details and never anchor a turn. The collapsed card and its two strings go with it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): anchor a turn on @tintinweb/pi-subagents' completion notice (#1075) @tintinweb/pi-subagents reports a finished background agent as a displayed custom message of bare type `subagent-notification`, sent as a follow-up that triggers a new run, exactly like pi-web's own `pi-web:subagent-notification`. It was not an anchor, so the reply to it became the turn's final answer and the earlier complete answer folded into Process details. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(models): list models in pi's /model order, not by name (#783) (#1111) The route and ModelSelector both sorted models by display name, so a models.json provider lost the order its file gives. pi's TUI selector never sorts by name: a scope keeps its enabledModels order, and the full list is sorted by provider id only, keeping the registry (file) order within each provider. The name sort came in as a side change of #80. Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(models): keep capability metadata from Fetch models (#856) (#1112) Fetch models kept only id and name, so a gateway's published context length, output limit and reasoning support never reached models.json and the added models fell back to pi's defaults with no thinking levels. Map only fields whose meaning does not vary between gateways onto contextWindow, maxTokens and reasoning, and an advertised effort list naming pi's levels onto thinkingLevelMap (other levels null, off left alone). max_tokens and default_effort stay out as ambiguous; junk values are dropped, and a list without metadata parses as before. Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(models): show Kimi For Coding usage quota (#848) (#1113) PROVIDER_USAGE_IDS gains kimi-coding with an adapter for GET https://api.kimi.com/coding/v1/usages, on the same origin as the provider's base URL. The overall quota and each rate-limit window become count buckets with their reset time; the parallel-request limit and membership level become metrics. Both an API key and a Kimi Code OAuth credential reach the endpoint as a Bearer token through the existing query path. The mapping follows the response sample in the issue; it was not checked against the live endpoint. Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(chat): retry banner, context %, t/s and history window after session switches (#988, #1031, #877, #896) (#1114) * fix(chat): clear the retry banner once the retried run starts (#988) pi emits a successful auto_retry_end only at the retry's first complete assistant message, so the banner said "Retrying" through the whole retried reply. pi's TUI drops its retry indicator when that run starts; clear it on the run's agent_start the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): read context usage when the event stream connects (#1031) Opening a session's event stream is what resumes a wrapper the idle timeout reaped, so the mount's state read often finds no runtime and leaves the context percentage blank. Since #1058 a run fills it in after its first reply; read it on `connected` too, through the same ordered usage read, so it shows as soon as the runtime is back. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): keep a streaming reply's t/s start across session switches (#877) The start of the tokens-per-second measurement lived in the message view, which a session switch remounts. Back on a running session, the new view took its start at the remount and divided every token streamed so far by half a second, showing thousands of t/s. Keep the start per reply (provider, model and request timestamp) outside the view; a reply joined with no record (a reload) times only the tokens that follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): reveal loaded rows the history window still hides (#896) The window keeps as many rows as messages are loaded, but a turn's answer and its thinking render as two rows, so a thinking-heavy session hides its oldest loaded rows behind "Load earlier messages". Since #587 the sentinel only fetched from the server, so with no older page there, reaching it did nothing. Widen the window in that case again, renew the observer when it grows, and observe the sentinel whenever it mounts, not only when the history cursor changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(subagents): admit tools extensions register at session_start (#883) (#1115) A child got a `tools` allowlist of the extension tools registered when it was built. The SDK fixes that list at session creation, so a tool an extension registers at session_start or later (pi's dynamic-tools example) was never callable, even with extensions loaded. A child that loads extensions without `ext:` selectors now gets no allowlist: `noTools: "builtin"`, its built-ins as `+name` entries, and the other built-ins and the reserved subagent tools excluded, so an extension still cannot switch on a built-in the profile leaves out. The snapshot records this so reload and reopen behave the same. `ext:` selectors keep the name allowlist: the SDK admits tools by name only and offers no source-aware hook. Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(worktrees): group a bare clone's worktrees under the clone (#1049) (#1116) A worktree's project root was the parent of its common git dir. For a bare clone (`parent/repo.git`) that parent is the folder holding every clone, so the worktrees of all repos there fell into one project (and that folder became an allowed file root), while the clone itself was a project of its own with none of its sessions. New worktrees were added from that parent too, which is no repository. A bare clone is now its own root, unless a `.git` file beside it points at it (the `project/.bare` layout keeps the enclosing folder). Removed worktrees under `repo.git-worktrees/` are still inferred back into it. Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(markdown): keep links to common desktop apps (obsidian://, vscode://, zoommtg://) (#1108) (#1118) The sanitize schema allowed only web, mail and file: links, so links such as obsidian://open?vault=... lost their href and rendered as dead text in chat and in the file preview. A fixed list of note, editor and meeting app schemes now passes both the schema and the URL transform. It is an allowlist rather than "anything but javascript:" because the text comes from the model and from repository files, and OS handlers such as ms-msdt: and search-ms: have been exploited through clicked links. These links open in a new tab with noopener/noreferrer like other external chat links. The file preview now does the same for its web and app links, which used to replace Pi Web in the current tab; relative, in-page and local file links are unchanged. Co-authored-by: Claude Opus 5.5 <[email protected]> * perf(server): start the pi SDK import at startup, not on the first request (#964) (#1117) Next preloads route chunks at start, but evaluates a route's code, and with it the externalized pi SDK, only on the route's first request. The first /api/sessions therefore paid for importing ~1600 SDK modules (seconds on Windows with antivirus scanning). register() now starts that import without awaiting it, so it overlaps the browser opening and routes reuse the cached module. Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(chat): clear errors for a deleted project folder and Chat only's extension models (#1061, #804) (#1119) * fix(chat): refuse prompts in a deleted project folder with a clear message (#1061) A session whose cwd was deleted outside pi-web still starts its wrapper (selecting it opens the event stream), and a prompt then went on to the model, whose tools all fail there; pi's write tool would even recreate the folder. The pi CLI does not resume such a session. The wrapper now refuses the prompt with "Directory does not exist: <cwd>", the text /api/agent/new already answers for a fresh composer, and the composer keeps the draft. That answer never reached the user either: ensureNewSession() threw a bare "HTTP 400". It now passes the server's error on. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): say when Chat only cannot load an extension's model (#804) Chat only loads no extensions, so providers they register are missing from the session while the model selector's listing still offers them. Picking one failed with a bare "Model not found", a chosen model was silently replaced at start, and a session left with no model at all failed with pi's "No API key found". The session now names the model as an extension's that Chat only cannot load: set_model and a start with the chosen model refuse it, and a prompt in a session that could start on no model names the one it wanted. The composer shows the server's reason when creating the session fails. Chat only still loads no extensions. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(chat): keep terminal QR codes in extension notices intact (#755) (#1120) pi-wechat-assistant's /wechat login sends a qrcode-terminal QR code (█ ▀ ▄ and runs of spaces) through ctx.ui.notify(). The toast's pre-line collapsed the runs of spaces, its UI font gave spaces and blocks different widths and its 1.5 line height opened gaps between rows, so the code came out garbled. Lines drawn with block characters now render as pi's TUI shows them: spaces kept, rows touching, one monospace font for spaces and blocks. Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(chat): stop re-rendering every answer on each custom panel keystroke (#1005) (#1121) Each key typed into an extension's custom panel round-trips to the server in a few ms, but the render it sends back re-renders ChatWindow, and a grouped turn handed MessageView fresh copies of its final message and a fresh written-files list on every render. That defeated MessageView's memo, so every visible answer ran its markdown again per keystroke (and per streamed chunk or notice). The copies and the list are now kept per stored message, so an unchanged transcript re-renders no MessageView: in a dev build with a 400-message session the key-to-paint time went from ~71 ms to ~20 ms, and real answers with code and math save far more. Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(chat): collapse the compaction summary by default, as pi's TUI does (#1026) (#1123) The compaction card always rendered the whole summary, which can run to pages. pi's TUI shows it collapsed to "Compacted from N tokens" and expands it on click; the card now does the same: the header, the title and the token count stay, and the title is a button (aria-expanded) that reveals the description, the summary and the file lists. Session search never targets a compaction entry, so nothing needs to force it open. Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(chat): attach any file from the composer's button, not only images (#1101) (#1122) On a phone there is no drag and drop, so the only way to give the chat a PDF or a log was the attach button, which took images only. The button's file input now has no accept list and hands the whole selection to ChatWindow, which runs it through the chat drop handler: images attach to the prompt as before (limits, compression, the image-support warning), other files are uploaded into the working directory with conflict=skip and mentioned, with the same notices, including the one when there is no working directory. No capture attribute, so phones still offer photos and the camera. The button reads "Attach files", and the no-directory notice says "adding" rather than "dropping" since it now covers both. Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(chat): stop prepending the same older page twice (#1149) Scrolling up a long session could show a page of older messages twice. The page lands, and loadingOlderRef clears, a moment before React renders the next cursor; a sentinel report in between (a renewed observer's first one) still held the old cursor and fetched the same page again. #1122's e2e failed on it (before=e4850 requested twice). The cursor asked for is now kept until another one renders, and the observer skips it; a page that failed, or a cursor a reload brings back, can still be asked for. Repeating the e2e's pagination steps in headless Chromium at 6x CPU throttling: main requested a page twice and showed 50-150 duplicate rows in 3 of 10 runs; this branch in 0 of 30. Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(chat): keep Process details open when a turn ends in an error (#906) (#1124) A turn of [text + trailing tool call] followed by empty error replies has no answer to show: the final answer lookup falls back to the last error, whose notice made the turn count as answered, so Process details started collapsed and hid the only text the turn wrote. They now start collapsed only when the shown answer has text or an image (collapsesProcessDetails); an error or truncation notice alone keeps them open. The notice itself renders as before. Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(sidebar): rename a project's display name from its group menu (#1047) (#1125) * feat(sidebar): rename a project's display name from its group menu (#1047) Deep project paths make poor labels. A project group's menu now offers Rename… (the header becomes the session row's inline field: Enter or blur saves, Escape cancels) and Reset name while one is set. The name is a label only, kept in pi-web-session-state.json as projectNames, keyed by projectKey like the pins: it never touches the folder, the sessions, the order, pins or expansion, and never selects the project. One shared rule (projectDisplayName) serves the request parser, the optimistic apply and the file: trimmed, one line, at most 80 code points; empty or null clears. The names keep to 1000 entries and 256 KiB as JSON; a new name with no room left is not stored and the route answers 409 "full". Old files load unchanged; a malformed field reads as none. The name replaces the folder name in group headers, the drag ghost, pinned rows and the archive's group headers, and the path in the project pickers' box (files tab and the new-session bar); their menus show it with the folder as the note. The full path stays the tooltip, so the filter matches name, folder and path. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(sidebar): a named project shows its name alone in the project pickers The pickers' menus no longer note a named project's folder, on a desktop or a phone: the name stands alone, the full path stays the tooltip (and the filter still matches it). On a desktop the name takes the paths' code type in the menu, and in the box everywhere, as the path it replaces did. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(files): restore file tabs when returning to a workspace (#1107) * fix(files): restore tabs when returning to a workspace Preserve project isolation from PR #281 while parking each workspace's tabs instead of discarding them. * fix(files): route a parked viewer's last state to its own workspace The unmount save looked the tab id up in every parked workspace and also in the live tabs, so with the same file open in two projects one project's mode/wrap/scroll overwrote the other's. Tag each report with the workspace generation the viewer rendered in (also part of its key), keep only left workspaces in the parked map, and note the behaviour in sessions.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * minimap: add lock toggle that disables the hover preview (#1128) * minimap: add lock toggle that disables the hover preview * minimap: center the lock button, enlarge it, and make it gold when locked * minimap: remember the lock and keep the last node clear of the lock button - The lock lived in component state, and ChatWindow remounts per session, so it reset on every session switch and reload. Keep it in localStorage (best-effort, lib/minimap-preview-lock.ts) with a test. - With many turns the last node sat at the bottom 12px of the rail, under the 30px lock button, so a click meant for the latest turn toggled the lock instead. Reserve the button's height below the nodes. - aria-pressed carries the state, so the accessible name stays constant. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(subagents): add opt-in codemode support (#1097) * feat(subagents): add opt-in codemode support * fix(subagents): keep Code mode on children without ext: selectors, and unselected MCP tools out of scripts Since #883 a child that loads extensions without `ext:` selectors gets `noTools: "builtin"` with its built-ins as `+name` entries. `codemode` registers inactive, so it never came on there; it is now named too. A child with an allowlist kept every MCP tool the list did not name registered: pi keeps them for codemode scripts and tool_search, as with `--tools`. A codemode script could then call an `mcp__*` tool from an extension the profile did not select. Such an allowlist now excludes the MCP tools it does not name. Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(subagents): trim the subagent Code mode wiring - `createSubagentCodemodeExtension()` replaces the general `createPiWebCodemodeExtension()`: normal sessions keep their original `builtin:codemode` entry, and the eager settings read that no caller reached is gone. It throws when the sandbox is unavailable. - Scripts keep codemode's `models` API, as in pi and normal sessions: it is not a tool and grants nothing the profile's tools limit. - The PUT route no longer repeats the codemode check `saveSubagentProfile()` already makes before writing. - docs: inherit, the MCP exclusion and the trimmed wiring. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(sessions): discover external session files without manual refresh (#1100) * fix(sessions): discover external session files without manual refresh * fix(sessions): reconcile file membership across watch event types * fix(sessions): find external sessions from the running poll instead of fs.watch Replace the recursive session-directory watcher with a filename check started from getSessionListVersion(), which the sidebar's running poll calls every 2.5 s. The check lists sessions/<cwd>/*.jsonl (directory reads only) at most once a second, one at a time, and invalidates the list only when the set differs from what the last scan listed. Appends never change a filename, so running sessions cause no rescans. A scan that records its listing while a check reads wins over that check, so a stale read never bumps the version. A recursive fs.watch on Linux is Node's JS layer: one inotify watch per file, a synchronous walk of the whole tree when it starts, and a silently partial watch at the inotify limit; on macOS it reports appends as rename. Keeps the contributor's real-route integration test (an independent SDK writer creating, appending and deleting) and adds unit tests for the check. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: arkk <[email protected]> Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(http): apply settings' httpIdleTimeoutMs to the Web UI (#1127) * fix(http): apply settings' httpIdleTimeoutMs to the Web UI `registerNodeInstrumentation` called `configureHttpDispatcher()` with no timeout, so the Web UI always used the built-in five minutes and ignored the user's `httpIdleTimeoutMs`. A provider stream that stayed quiet for longer was aborted with a bare `terminated`, while the same setting applied correctly to CLI sessions. Read the agent directory's `settings.json` the way the CLI does and pass the value to the dispatcher, so both surfaces honor one setting. * fix(http): resolve PI_CODING_AGENT_DIR exactly as pi's getAgentDir() The local resolver trimmed the value, expanded ~\ on every platform, and skipped pi's Windows shell-path and file: URL handling, so some values pointed the settings read at a different directory than the SDK uses. Port normalizePath()'s steps and check them against getAgentDir(). Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(chat): centre a one-line notice in its card (#1130) * fix(chat): centre a one-line notice in its card A notice's card is 60px tall - what its entrance and exit keyframes pin it to - while the text inside padded 14px above and below its 21px line box. Under flex-start there is nowhere for the 9px the min-height leaves over to go but below the text, so a one-line notice (an extension's ctx.ui.notify, "Default model: ...", a completed upload) drew its line 4.5px above the middle of the card: 15px above that line, 24px below it. The text's padding is what centres it now. Two 18.5px paddings and the 21px line box, between the card's two 1px borders, add up to exactly the 60px the keyframes pin, so the line lands dead centre; the type dot keeps its offset from the text's first line (padding + (21px line box - 7px dot) / 2) and goes with it. - Wrapped notices keep the dot on their first line and stay top-aligned; their padding grows by the same 4.5px per side, so their room above the first line and below the last is symmetric too (a three-line notice is 9px taller). - NOTICE_TEXT_MAX_HEIGHT_PX follows that padding, so the text area still fits the 500px card. - demo/components/ChatWindow.tsx carries the same NoticeShelf; kept in sync. Measured on the component in a dev render, with the pre-fix inline styles applied for the "before" row, one line: before - card 60px, 15px above the line and 24px below it, line centre 25.5 against the card's 30; after - card 60px, 19.5px / 19.5px, line, card and dot centres all 30. Tests: components/ChatWindow.notices.test.mjs adds the centring invariant (padding twice + line box + the two borders = the height globals.css pins, so the two cannot drift apart) and the dot's offset. Its existing span assertion read [^}]* up to overflowY, which the now-interpolated padding closes early, so it skips the braces lazily now. * fix(chat): let a long notice's text use the card's whole 500px cap Every box is border-box, so the text's max-height already holds its own padding; subtracting the padding again capped the card at 463px. Pin the 21px line box to the card's font size and line height in the test. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: leonjlfeng <[email protected]> Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(files): show CSV/TSV files as a table in the file viewer (#1150) * feat(files): show CSV/TSV files as a table in the file viewer A .csv or .tsv file now opens in the viewer's Preview mode as a table, the way markdown and HTML open rendered; Source stays one click away. - lib/delimited-table.ts: a small RFC 4180 parser (quoted delimiters, doubled quotes, line breaks inside quotes, LF/CRLF, BOM, blank lines skipped; lenient with stray quotes and ragged rows). .tsv splits on tabs; .csv detects ; / tab / | from its first records, else comma. - The gutter shows the file line each record starts on, so multi-line records do not shift the numbering. - Large files: the table also previews a truncated first chunk, leaving out the cut last record until "Load more" brings the rest. - Fixed-height rows, only those around the viewport rendered, inside the viewer's own scroll box (scroll position saved like the source view). No new dependencies. Adapted from the table part of #1136. Co-authored-by: Brynne Taylor <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(agents): record the CSV/TSV table view Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Brynne Taylor <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(chat): number minimap turns from the session's first turn (#791) (#1151) The minimap numbered turns by their index in the loaded page, so loading older history renumbered every node and nothing showed that earlier turns existed. Each context page now carries `turnsBefore`, the turn anchors on the branch above its oldest entry (counted with isMessageGroupAnchor()), and the minimap numbers loaded turns from it. While turns are unloaded the rail shows a dotted stub above its first node and the preview's first row says how many, scrolling the chat to the top when clicked. Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(chat): keep Stop clear of the slot compaction lands in (#1131) * fix(chat): keep Stop clear of the slot compaction lands in The bottom bar rebuilt itself at every run boundary: idle was `[reasoning][tools][compact][sound]`, streaming dropped tools and compact for `[reasoning][Stop][sound]`. Compact is wider than Stop and both anchored to the sound toggle's left edge, so the second click of a double click on Stop landed on Compact and rewrote the session context with nothing to confirm it. Stop is the cheap, recoverable action; compaction is the consequential one, and it had inherited the hot position. - Stop moves to the composer's right end, where Send and the queue controls already swap. Steer and Follow-up become one split button keyed to the defaults the keyboard already uses — Enter steers, Alt/Option+Enter follows up — so the row the eye is on holds one primary action plus the emergency square. Phones get the bigger win: Stop was inside the More controls popup during a run, two taps away. - The bottom bar no longer reflows. Tools and compact keep their slots and go inert while the run holds them, and a disabled button's wrapper carries the tooltip a disabled button cannot show. - The compaction control still aborts compaction rather than the prompt when a turn auto-compacts, which is the trap the old gate existed for. - Both hints name the delivery point pi actually reaches in `agent-loop.js`: the steering poll after the current reply's tool batch, and the follow-up drain where the loop would otherwise stop. The wording avoids "turn", which readers do not parse. - `docs/agents/sessions.md` gains the invariant — nothing may move under the pointer at a run boundary — with the two tests that fail if a refactor reintroduces the collision, since no note owned the composer's action row before. * fix(chat): ignore stray clicks on Compact right after a run ends (#1131) Stop and Compact both sit just left of the sound toggle, and Compact is wider than Stop, so when a run ends Compact covers Stop's whole slot. The second click of a double click on Stop (or a click aimed at Stop as the run ends on its own) started a compaction nobody confirmed. Keep the composer's layout and controls as they are and ignore pointer clicks on Compact and the tools button for 600 ms after a run ends. Keyboard activation (click detail 0) and Stop compaction are unaffected. The same handlers serve the phone's More controls popup, which stays open across the run end and had the same hazard. This replaces the composer redesign of the earlier commit: its split Steer/Follow-up button, the moved Stop and its i18n and docs changes are reverted to main. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(chat): collapse a custom message from its header (#1133) * feat(chat): collapse a custom message from its header A displayed custom message with no `details` could never be collapsed. One button served both roles: it toggled the body only for a hidden message and the details otherwise, and it appeared only when `details` existed — so every `display: true` notice with no details was stuck expanded for the whole transcript. - The header is the toggle (`aria-expanded`, a chevron like a tool card's), so the collapsed preview line is reachable for any message with text. - The footer button is about details only (`hasDetails && !isHiddenDisplay`), which is what its label says. - A test in `components/MessageView.test.mjs` pins the header toggle and the details-only footer. * docs(agents): record how custom messages collapse `sessions.md` gains the collapsing rule: the header is the toggle, the footer button is for details only, and why the old single button left some messages impossible to collapse. `AGENTS.md` points at the note. * style(chat): put the custom message's chevron at the far right of its header It sat right after the title while every tool card puts the toggle last, with the duration just before it. The timestamp moves inside the header button so the chevron can stay the final element. --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(sidebar): show a session parked on an extension dialog as awaiting input (#1145) * feat(sessions): report a run parked on an extension dialog A run blocked on an extension's ui.select/confirm/input/editor (or an open custom overlay) is still isRunning(), so the sidebar showed it as running forever: the spinner never stopped, and nothing said the session was waiting for a person. The pending requests were already in the wrapper; only the poll never mentioned them. AgentSessionWrapper.isAwaitingInput() gates on isRunning() and then asks the protocol's own classification (isBlockingExtensionUiRequest), so no extension has to adopt a pi-web convention, and notify/setStatus/setWidget/setTitle never read as awaiting. A custom overlay that outlives its turn is not a parked run. /api/agent/running and /api/sessions carry awaitingInputSessionIds beside runningSessionIds, the sidebar's two sources for the running set. The classification moves to lib/extension-ui-queue.ts, where the dialog queues live, and browser-notifications.ts re-exports it: the attention notification and the sidebar badge share one rule. * feat(sidebar): show a parked run with an amber breathing dot The right column says the one thing worth knowing, and for a parked run that is "this needs you", not "this is working". The row takes the unread dot's shape and 1.6s breath in warning amber (#d97706) and puts it in the spinner's slot: same size, same animation, so only the colour and the meaning change. The label is "Agent waiting for your input" in en, zh-CN and zh-TW, and the keyframes rename to session-tree-status-pulse, which both dots now share. It stays a running row everywhere else: is-running still keeps the meta beside the hover actions, still withholds the archive button, and the group and pinned-header counts still count it, while the archive predicate is untouched. Both sources of the running set (the 2.5s poll and the session-list fallback) carry the awaiting ids through the same sameIdsOr, so rows never rebuild just because a session started waiting. * docs(agents): note the awaiting-input poll and the amber row dot sessions.md gains the rule behind the poll's awaitingInputSessionIds: which methods count, the isRunning gate, why the wrapper's own pending requests are the source, and that a background session's own event stream has no listener. The row's right column now names the amber dot first. * refactor(sidebar): make awaitingIds optional so unrelated tests stay untouched The tree input's awaitingIds is now optional (absent means none), and familiesToArchive() no longer names it. That reverts the incidental edits to fork-route, useGroupDrag, SessionSidebar, SessionTree, session-tree and sidebar-actions tests and the unused isAwaitingInput fakes; only the fake a running poll actually calls keeps it. Also realigns the AGENTS.md file-map entry. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Mangome <[email protected]> Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(subagents): answer a removed worktree from the repo it branched from (#1137) * fix(subagents): answer a removed worktree from the repo it branched from A subagent run isolated in a worktree records that worktree as its session's cwd, and `cleanupWorktree()` removes the directory once the run reaches a terminal status. The session file outlives the directory, so opening a finished subagent asked two project-scoped questions about a folder that is no longer there: - `GET /api/models` stat'd it and answered 400 "Directory does not exist", which `useAgentSession` surfaces as a model error. The model was fine. - `GET /api/project-trust` refused it as 403 "Access denied", because `validateMcpProject()` authorizes a folder by resolving it (`isExistingFilePathAllowed()`), and a path that is gone resolves to nothing whichever root it sits under. It was not outside the roots: `getAllowedFileRoots()` derives a root from every session's own cwd, so the refusal came from the missing directory, not from the containment test. Both routes now answer for the repo the worktree branched from, reusing the `inferRemovedWorktree()` the session list already groups these sessions under: the models route reads that repo's model list and the trust GET its trust status, so a finished subagent resolves what a non-isolated one would and the trust banner stops logging a refusal it could not act on. That inference names exactly one folder — the cwd's parent with a `-worktrees` suffix stripped, where `addWorktree()` puts worktrees, and only when that sibling is a repository. It cannot be `git worktree list`: `git worktree remove` deletes the directory *and* its admin entry, so nothing is left to ask. Each route then authorizes the repo it landed on with the check it applies to any cwd, so the fallback answers for no project the caller could not already name, and never for a folder that is not an allowed root. Only the trust read falls back. POST still refuses a folder that is gone, since trusting records a decision about a directory that has to exist. `validateMcpProject()` is untouched: its "a folder outside the roots answers the same whether or not it exists" rule is what keeps `/api/mcp` and its test and sign-in routes from turning a status code into a probe for which paths exist. `app/api/models/route.test.mjs` is new — the route had no test, and the repo the fallback answers from, a repo it must not answer from, and a missing folder that is not a removed worktree are three different answers. * fix(project-trust): keep the trust read on the folder asked about Answering GET /api/project-trust for the repo a removed worktree branched from reported another folder's trust (trust is per path, and the repo does not contain `<repo>-worktrees/`). When that repo needs trust and is not trusted, the composer then offered a Trust button whose POST, still asked about the removed folder, is refused with 403 cwd-denied. On main the GET's 403 shows nothing, so the trust fallback is dropped; /api/models keeps it. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(subagents): let the profile decide the spawn parameters (#1138) * fix(subagents): let the profile decide the spawn parameters The `Agent` tool offered eleven parameters, but a model can choose only six of them correctly, and it never saw what a profile had configured: the tool description lists each profile's name, description, tools and model, while `max_turns`, `thinking`, `inherit_context` and `input_files` were accepted with no mention at all. The runtime resolved every one as `request ?? profile`, so a guess beat a configured profile — a guessed `max_turns: 8` replaced the turn budget the profile had set, and a guessed `thinking: "high"` short-circuited the `??` chain before the parent's level was ever read. `input_files` inlined whole files into the delegated task although a subagent's default tools already include `read` and `bash`. - The tool offers only `subagent_type`, `prompt`, `description`, `run_in_background`, `resume` and `isolation`, the last narrowed to a `"worktree"` literal since `"none"` was already dropped silently. - The runtime reads `model`, `thinking` (falling back to the parent's level), `max_turns` and `inherit_context` from the profile alone; resume still rejects the one remaining creation option. - The Agents panel and the profile file format are untouched: they remain the only place any of these values is edited. * fix(subagents): let a call override the subagent's model Withdrawing `model` with the other spawn parameters made a per-run model impossible: a profile pinned to one model had no way to send a single task to a different one, which is a real request — a cheap model for mechanical work, a stronger one for a review. - Restores exactly what that change took away, for `model` alone: the parameter on the `Agent` tool, the field on `StartSubagentRequest`, the pass-through to `runtime.start`, and `request.model ?? profile.model` in the runtime. The profile still decides when the call names no model, and the tool description already lists each profile's model, so the override is chosen with the information in hand. - `thinking`, `max_turns`, `inherit_context` and `input_files` stay withdrawn: a model's guess there only ever discarded what the profile had configured. - A resume keeps the session it continues, so `model` joins `isolation` in the creation options rejected before dispatch, through the same list the old code used. * fix(subagents): keep input_files as a per-call Agent parameter input_files is input preparation, not a profile setting, and stays on the Agent tool: restore lib/subagent-input.ts, its test, the schema entry and its resume rejection. Keep isolation a plain string so a model that fills optional fields with "" can still start or resume a subagent, as the resume contract documented. Pin that profile thinking, inherit_context and input files reach a real child session, and that calls still carrying the withdrawn keys validate. Revert the ADR 0002 note, update the subagents note and the demo's captured Agent schema. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(pwa): configure installed app name at runtime (#1147) (#1148) Co-authored-by: TossPig <[email protected]> * feat(agents): view sub-agent work in a right-panel tab (#1129) * feat(agents): view sub-agent work in a right-panel tab Sub-agent runs were only observable after the fact; opening one hijacked the main chat. The Agent tool card now opens the sub-agent's live transcript as a read-only tab stacked beside file previews and terminals: - SubagentViewer renders the sub-agent session through MessageView with its own cwd, a status badge, manual refresh, and upward pagination - Live updates poll GET /api/sessions/[id]/context every 2s while the sub-agent runs; the route reads the running wrapper's in-memory entries and never spawns an AgentSession for a viewer tab - AppShell keys tabs by agent:<sessionId> (deduped, bot icon, label), folds the panel when the last tab closes, and drops them on project switches together with file tabs - onOpenSession prop renamed to onOpenSubagent(sessionId, label); the card button opens the side tab instead of switching the main chat # Conflicts: # components/AppShell.tsx # components/ChatWindow.tsx # components/MessageView.tsx * fix(agents): subagent tab close fallback, paging and status in the viewer - Closing a file tab while another file tab stayed open crashed AppShell: `a ?? b ?? agentTabs.at(-1) ? `agent:…` : null` parses as a ternary over the whole ?? chain and read `.sessionId` of a missing agent tab (same in the terminal and agent close paths). lastAgentTabId() replaces it. - A new session in another project (handleNewSession) now drops subagent tabs too, as the other two project switches do. - Polls replaced the transcript with the newest page, discarding pages the user loaded with "Load more", and a page landing after a poll could be prepended over a gap. Polls now fold into the loaded pages (mergeTailPage), an older page is prepended only onto the cursor it was asked for (prependOlderPage), polls never overlap, and a prepended page keeps the scroll position. - The status badge stayed "Running" after the run ended (session info was fetched once); it is refetched when the running flag changes. - MessageView gets the session id, so deferred thinking blocks load instead of showing "thinking unavailable". - AGENTS.md file map and docs/agents/subagents.md describe the viewer tab. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(chat): send a new session's first prompt even after switching away (#1146) (#1152) Switching sessions while a fresh composer waited for its event stream's `connected` handshake closed the stream, so the send failed before the prompt was posted, and recovery drops an abandoned composer's draft: the text was lost and the session never appeared in the sidebar. Once the hook is unmounted, skip the stream wait and post the prompt anyway, as a switch during session creation already did; no stream is opened for an unmounted composer either. Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(files): reload the file tree while a run writes and on window focus (#1144) (#1153) The tree reloaded only when a run ended or on the refresh button, so files the agent wrote mid-run, or changed in an editor or terminal, stayed hidden. Now any top-level tool but read/grep/find/ls schedules a reload (at most one a second), and the explorer reloads when the window gets focus. No watcher, no polling. Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(cli): add version, update, status, stop and open commands (#1139) (#1154) * feat(cli): add version, update, status, stop and open commands (#1139) Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(cli): never signal a recycled pid; stop the whole tree on Windows A run record outlives a crash or reboot, and its pid may then belong to an unrelated process: stop would SIGTERM it. A record now counts as running only while its URL answers over HTTP (any status); a live pid that does not answer is skipped, and its record kept until the pid dies. On Windows process.kill() ended the launcher alone and left Next.js serving the port, so stop ends the launcher's process tree with taskkill there. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(cli): check run-record processes; stop orphaned Next.js; records in the agent dir - A recycled pid passed the old check whenever something answered on the record's port, so stop could SIGTERM an unrelated process. A record now counts only while its pid still is pi-web: the launcher's command line names pi-web, the server's is "next-server (vX)" (/proc on Linux, ps elsewhere, the node image name on Windows). When nothing can tell, the URL check decides as before. - A launcher killed with SIGKILL left Next.js serving the port while status said nothing ran. The record keeps nextPid; status lists such a server as "launcher gone", stop signals it directly and update refuses. - Records were keyed by port, so a second server on the same port with another hostname overwrote the first's. They are keyed by launcher pid now. - Records move from ~/.pi-web/run to <agentDir>/pi-web-run (default ~/.pi/agent/pi-web-run), where pi-web keeps its other state; pi-web wrote nothing under ~/.pi-web before. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(sidebar): files below the sessions on desktop, section-style project headers The multi-project tree was hard to scan: a project's name (12px, weight 500, muted) was smaller and lighter than the session titles under it. And the file browser, used as often as the sessions, sat behind a tab of its own. - Project headers read as section headers: a 14px folder icon (the current project's in the accent), the name at 13px/600, session rows and "show more" aligned with the name at 24px. The pinned and archive headers share the look. Row heights are unchanged. - The group that stops being current stays open for the page only. It used to be saved, so every project ever visited came back expanded. Saved choices move to pi-web:sidebar-groups-v2, keeping only the old collapses. - Desktop shows the files below the sessions by default: a resizable, keyboard-operable separator and a foldable "Files · N" section header with its own file search. The height is kept per browser; a short window shows less without saving it (useResizablePanel persistClamp: false), and the files section gives way before the sessions' minimum. - Settings › General › Sidebar › File browser: "Below sessions" or "Separate tab" (hooks/useFilesPlacement.ts). Phones always use tabs. Both layouts render one element tree, so switching never remounts the explorer, the tree or the picker; focus on a control that goes away moves to the toolbar. - The file tree remembers its open directories per cwd (page memory, 20 folders), so clicking a session in another project and back keeps it. Tests cover the merge and migration helpers, the prefs, the placement store, the resize hook's new option and the expansion memory; e2e checks both layouts and that the explorer survives a switch. Docs: sessions.md, files-and-access.md, settings-ui.md, AGENTS.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> * style(sidebar): restore the old sidebar's visual rules in the new layout Next to the sidebar before c7178c3d4 the new one looked flat and busy: two extra greys made the session titles paler than the project names, a folder on every project made the tree read like a second file tree, the chevrons trailed names of every length, the selected row barely showed, and the files section spent four bands before its first file. - Text takes three tokens only: content --text (titles 12px, 13px on phones), labels --text-muted (project names 12px/600, the current one --text), meta --text-dim at 11px. "Pinned" and "Files" are section labels: 11px/600, uppercase, spaced. - Chevrons lead in one 12px column (x 11) and every label and title starts at x 26; the project, pin and files folder icons are gone. The left inset is fixed, so a classic scrollbar only narrows the right side, where the time column, the file keys and the picker boxes end on one edge. - The selected session gets a 3px accent bar; the accent marks nothing else. - Project groups sit directly on each other, expanded or not; only the pinned section and the footer keep an 8px gap. The drop line follows the real gap. - With the files below the sessions: the toolbar shows the "Pi Web" brand with the old click-to-show-versions scramble (components/PiWebTitle.tsx, plain swap under reduced motion); the files header row holds the fold toggle, a changed-files chip and six keys (search, terminal, file manager, upload, refresh, ignored files); the project and worktree boxes share one row. The tabs layout keeps its tabs, head and key row. Co-Authored-By: Claude Opus 5.5 <[email protected]> * style(sidebar): 28px rows, files keys in the tab's order, fold and archive motion - Rows: sessions are 28px on desktop like the group, pinned, empty and footer rows (phones: sessions stay 44px, headers become 44px too). - The files header row lists its keys in the files tab's order (terminal, file manager, upload, refresh, ignored files, changes) with search last; the changes key replaces the count chip and the count is back as "Files · N", so no key ever moves. Keys are 22px; focus on the changes key moves to its neighbour when it turns disabled. - A folder outside any git repository shows no worktree box in either layout (a repo's subdirectory keeps its disabled hint); folders found not to be git are remembered per browser so the box does not flash again. - The file tree starts 4px under the picker (and under the tab's head line). - New has its own left line in both layouts, so New and search read as two cells next to the brand. - Folding the files section animates its height, entering and leaving the archive slides and fades (hooks/useSidebarMotion.ts, 180ms, nothing moves under prefers-reduced-motion). The archive view is stacked above the tree (position: relative; z-index: 1): unpositioned, it lost to the tree's positioned rows in the frame its entrance ended, which flashed the tree. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(sidebar): selecting a revealed session no longer shows an older one After "show more", picking the last revealed session in a group showed the next, older session below it. The window was a budget recounted on every render, and families that show anyway (running, unread, selected) did not use it up: the picked row turned selected, freed its slot, and the next family took it. A row turning unread or running did the same. The window is now a position, decided at the click: the more row offers `nextShown` (the window that SHOW_MORE_STEP more hidden families need, with the flags of that moment), handleShowMore() stores it, and the tree shows every family before it plus the flagged ones after it. Each click still adds 20 hidden rows; later flag changes never move the window. The pinned section shares the code. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(sidebar): folding a group drops its "show more" window A group opened again kept the rows "show more" had revealed before it was folded. Every explicit choice that folds a group (a toggle, Alt+click, collapse others) goes through saveGroupChoices(), which now forgets the folded groups' windows (forgetShownMoreOfFolded()); folding the pinned section forgets its own. Reopened, a group shows its first rows plus the running, unread or selected ones. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(new-session): brand above, project and worktree right over the composer The empty new-session header put the logo, "Pi Web", the update link, the project path box, the worktree box and two version lines floated right into one 40px row, held together by a float, inline boxes, line-height 0 and a calc() width; the path was cut in the middle of a hash and "main 主分支 3" said the same thing twice. - The brand stands alone, left-aligned: the logo (40px, 32px on phones) and "Pi Web" over one dim line, "web v<app> → v<latest> ↗ · pi v<pi>" (the update part only when a newer release exists; the pi version is the one cut when narrow). Nothing on the right. - The project and worktree become one row right above the composer, its folder icon on the logo's and the card's left edge: the project's name (its display name, a dim "parent/" only for twins, the parent cut first; the full path as the tooltip) and the branch cut at its left, with no "main" note and no count; the worktree gives way first on a narrow row. The menus, focus after a move and the carried draft are unchanged; the row hides while a phone's keyboard is up, the brand stays. - The old float, 40px boxes, calc() width and their compensating margins are gone; the update link's hover, focus and touch target no longer move the line. Co-Authored-By: Claude Opus 5.5 <[email protected]> * style(sidebar): larger files header keys, 13px icons The seven keys in the files section's header row (files below the sessions) were 22px with 14px icons. They now share what the toggle's content leaves, 18 to 26px wide and 26px high, with 13px icons: about 24px at the default 260px beside "文件 · 2", 26px from about 300px. The toggle keeps its label and count until the keys are at 18px, then lets them go whole, down to the chevron. The files tab's row and coarse pointers' 32px keys are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Release v0.11.1 Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * docs(release): push the tag by name, check prerequisites, note npm propagation Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * perf: streaming markdown, session list payload, push title, SSE image echo (#1176) * perf(push): title the completion push from the live session Each finished run with a push subscription called SessionManager.listAll() to look up one session's name: it parses every session file. On a 146 MB sessions folder that is 372 ms of CPU and about 250 MB more memory per run. The wrapper's own SessionManager has the same name (its newest session_info), so the run-complete listener now passes it along. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(sessions): cap the first message the session list carries GET /api/sessions sent every session's whole first message: an expanded skill or a pasted document made one row 325 KB and the list 3.2 MB (1.0 MB gzipped), and each tab fetches it again two or three times after every run. The row title shows 50 characters; the subagent filter needs no more than a few hundred. catalogFirstMessage() sends a skill expansion as its /skill: command, as the row shows it, and cuts other text to 500 code units without splitting a surrogate pair, for persisted and live rows alike. The list is now 385 KB (93 KB gzipped) on the same folder. Fork naming reads the source file itself and keeps the whole text. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(sse): send only the role of a non-assistant message_start The agent loop announces a tool result (and a delivered user message) with message_start and message_end back to back. The browser builds only an assistant reply from a start and reads nothing else of the others but the role, so an image read's base64 crossed the event stream twice. A non-assistant message_start now goes as { role } only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(chat): parse a streaming reply block by block Every streamed chunk parsed the whole reply's markdown again, so a long reply cost quadratic time. At 4x CPU throttling a 14k-character reply spent 8.8 s in react-markdown and its commits grew from 4.7 to 15.6 ms; the main thread was busy 40% of the run, with long tasks up to 350 ms. While streaming, MarkdownBody cuts the text with splitMarkdownBlocks() and renders a memo'd block per piece: finished blocks keep their parse and only the last one is parsed again. A cut goes only after a blank line, before a column-0 line that is not a list item, never inside a fence or $$ block, and not at all after raw HTML or in front matter. A finished message is one block, rendered exactly as before; MarkdownBody itself is memo'd too. Same prompt after the change: Markdown 1.5 s, commits a flat 2-3 ms. Every prefix of a mixed test document parses the same split as whole, as do the 60 longest replies of a real session folder. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(files): preview HTML files larger than one 256 KB chunk (#1155) * feat(files): preview HTML files larger than one 256 KB chunk * fix(files): keep the previous HTML preview up while a change refetches Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(files): no Load more bar over a whole-file HTML preview The preview shows the full file, so the chunk counter misled and each click refetched the whole page. Source keeps it. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Hu Chen <[email protected]> Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(terminal): keep input alive when the phone keyboard collapses the panel (#1160) Opening the soft keyboard on a phone shrinks --app-viewport-height, so xterm's fit can momentarily resize the terminal to one row. The resize API rejected rows < 2 with 400 "Invalid terminal command", and the writer's fail-closed rule then disabled input for good. Clamp rows to 2 on both the client and the route instead of rejecting. * feat(terminal): add Termux-style extra keys on portrait touch screens (#1166) * feat(terminal): add Termux-style extra keys on portrait touch screens Phones held in portrait get two rows of keys under the terminal: ESC / - HOME UP END PGUP and TAB CTRL ALT LEFT DOWN RIGHT PGDN. The row is part of the panel's grid, so the terminal refits above it instead of being covered, and tapping a key keeps the soft keyboard open. Keys send the same sequences as a physical keyboard, following xterm's application cursor mode. CTRL and ALT are one-shot and also apply to the next character typed on the soft keyboard. The arrows use Noto Sans Mono's up and down glyphs, rotated for left and right, so all four match. * test(terminal): pin the extra keys' sequences against xterm's Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * feat(sessions): open sidebar sessions in a new browser tab (#1169) * feat(sessions): open sidebar sessions in a new browser tab A saved session's title in the sidebar is now a real link (?session=<id>), so middle-click and Ctrl/Cmd-click open it in a new browser tab while the current tab keeps its session. A plain click and Enter still select it in place without a page load. The row's own click handler is unchanged. The row menu (right-click and ⋯) gets "Open in new tab" (T), just before Delete; never first, since a menu's first item takes focus when it opens. Transient sessions keep their button and get no link. When focus is put back into a row it now goes to its first a[href] or button, so a keyboard Fork focuses the copy's link, not its archive button. Closes #1167 * docs(sessions): describe row focus controls * test(e2e): open new tabs with Ctrl or Cmd, as the platform does On macOS Ctrl-click is a secondary click, so the Ctrl-only steps waited for a tab that never opened. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(e2e): open the row menu from ⋯, not Shift+F10 Shift+F10 opens no context menu in Chrome on macOS. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(sessions): guard the remaining in-flight-turn invalidation paths (#1173) * fix(sessions): guard the remaining in-flight-turn invalidation paths Reuses the existing isSessionRunningForReplacement() pattern (already used by clone/fork in rpc-manager.ts) for the paths that can still invalidate a live extension ctx mid-turn: - `reload` via the extension command API and the extension ctx callback object (rpc-manager.ts) - previously unguarded, unlike clone/fork - the cwd-scoped sweep destroyRpcSessionsForCwd() shut down every session in the target cwd, including running ones - DELETE /api/sessions/[id] shut down the deleted session's subagent descendants and the target even while they were mid-turn - a background subagent outlives its parent's turn, so the parent session could be idle-evicted while the run was still active; register a session-liveness provider for the parent for the run's lifetime (start()/resume() in subagent-runtime.ts), released when the run's promise settles Also updates the source-assertion test for the DELETE route to the guarded shutdown form. Verified against a locally built 0.11.1: a reload aimed at a session with an in-flight turn is now rejected and the turn completes; idle sessions still reload/delete normally; a parent holding a long background subagent survives the idle window and receives the completion notification without a stale-ctx failure. Refs #1172 * fix(sessions): keep the reload guard, drop the other teardown changes - An extension command runs inside its own prompt, so the isSessionRunningForReplacement() guard made every command that calls ctx.reload() fail even on an idle session. ctx.reload() now checks only streaming and compacting, as pi's TUI does, and warns instead of throwing. - The reload refusal uses pi's text. - DELETE: deleting a running session must still stop it; skipping the shutdown left the wrapper running and appending to the unlinked file. - destroyRpcSessionsForCwd: its only caller refuses a busy cwd first. - Background subagents: an evicted parent is reopened by notifyParent, and the child run completes after the parent is disposed, so the liveness provider is not needed. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> * perf(sessions): rebuild the list once per finished run (#1177) A run's agent_end already invalidates the server's session list before the event reaches any browser. Three client reloads around it did more: - the tab showing the session reloaded with force=1 (refreshKey), which invalidated again and started a second rescan; - the same tab's hydrateSelectedSession fetched the whole list once more for one row, starting a rescan the force then threw away; - every other visible tab, seeing the run finish in the background, reloaded with force=1 as well: one more rescan each, and a version bump that made all the other tabs reload again. With two tabs that was 5 list requests and 3 rebuilds per run (each 40-110 ms, including ~36 ms of synchronous subagent reads). These reloads are now plain loadSessions() calls, and handleAgentEnd no longer fetches: the sidebar's reload reaches the selected session through handleSessionsChange -> mergeCatalogRow(), which also clears a fresh session's transient flag. Measured after: 1 rebuild per run, 3-4 requests of which all but the first are cache hits. The fi…
windli2018
pushed a commit
to aiti-ai/aiti-ai
that referenced
this pull request
Nov 6, 2026
* fix(chat): refresh context usage between model calls Change-Id: I423982a12d024afebc8da1e67836722a6e2aae3b * fix(chat): keep an older usage read when a newer one fails The shared request id let any newer usage read invalidate older ones, even when the newer read failed (non-ok reply or network error). A good reply from an in-flight poll was then dropped, and usage stayed stale until the next assistant message, poll tick or agent_end. Track the last applied id instead: a reply applies only when it is newer than the last one applied, so delayed replies still cannot overwrite newer usage. Each mount marks the reads started before it as stale, which keeps the unmount invalidation without reading a ref in effect cleanup. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
windli2018
pushed a commit
to aiti-ai/aiti-ai
that referenced
this pull request
Nov 6, 2026
…ion switches (agegr#988, agegr#1031, agegr#877, agegr#896) (agegr#1114) * fix(chat): clear the retry banner once the retried run starts (agegr#988) pi emits a successful auto_retry_end only at the retry's first complete assistant message, so the banner said "Retrying" through the whole retried reply. pi's TUI drops its retry indicator when that run starts; clear it on the run's agent_start the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): read context usage when the event stream connects (agegr#1031) Opening a session's event stream is what resumes a wrapper the idle timeout reaped, so the mount's state read often finds no runtime and leaves the context percentage blank. Since agegr#1058 a run fills it in after its first reply; read it on `connected` too, through the same ordered usage read, so it shows as soon as the runtime is back. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): keep a streaming reply's t/s start across session switches (agegr#877) The start of the tokens-per-second measurement lived in the message view, which a session switch remounts. Back on a running session, the new view took its start at the remount and divided every token streamed so far by half a second, showing thousands of t/s. Keep the start per reply (provider, model and request timestamp) outside the view; a reply joined with no record (a reload) times only the tokens that follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): reveal loaded rows the history window still hides (agegr#896) The window keeps as many rows as messages are loaded, but a turn's answer and its thinking render as two rows, so a thinking-heavy session hides its oldest loaded rows behind "Load earlier messages". Since agegr#587 the sentinel only fetched from the server, so with no older page there, reaching it did nothing. Widen the window in that case again, renew the observer when it grows, and observe the sentinel whenever it mounts, not only when the history cursor changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
windli2018
pushed a commit
to aiti-ai/aiti-ai
that referenced
this pull request
Nov 8, 2026
* fix(chat): refresh context usage between model calls Change-Id: I423982a12d024afebc8da1e67836722a6e2aae3b * fix(chat): keep an older usage read when a newer one fails The shared request id let any newer usage read invalidate older ones, even when the newer read failed (non-ok reply or network error). A good reply from an in-flight poll was then dropped, and usage stayed stale until the next assistant message, poll tick or agent_end. Track the last applied id instead: a reply applies only when it is newer than the last one applied, so delayed replies still cannot overwrite newer usage. Each mount marks the reads started before it as stale, which keeps the unmount invalidation without reading a ref in effect cleanup. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Alex Yang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
windli2018
pushed a commit
to aiti-ai/aiti-ai
that referenced
this pull request
Nov 8, 2026
…ion switches (agegr#988, agegr#1031, agegr#877, agegr#896) (agegr#1114) * fix(chat): clear the retry banner once the retried run starts (agegr#988) pi emits a successful auto_retry_end only at the retry's first complete assistant message, so the banner said "Retrying" through the whole retried reply. pi's TUI drops its retry indicator when that run starts; clear it on the run's agent_start the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): read context usage when the event stream connects (agegr#1031) Opening a session's event stream is what resumes a wrapper the idle timeout reaped, so the mount's state read often finds no runtime and leaves the context percentage blank. Since agegr#1058 a run fills it in after its first reply; read it on `connected` too, through the same ordered usage read, so it shows as soon as the runtime is back. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): keep a streaming reply's t/s start across session switches (agegr#877) The start of the tokens-per-second measurement lived in the message view, which a session switch remounts. Back on a running session, the new view took its start at the remount and divided every token streamed so far by half a second, showing thousands of t/s. Keep the start per reply (provider, model and request timestamp) outside the view; a reply joined with no record (a reload) times only the tokens that follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): reveal loaded rows the history window still hides (agegr#896) The window keeps as many rows as messages are loaded, but a turn's answer and its thinking render as two rows, so a thinking-heavy session hides its oldest loaded rows behind "Load earlier messages". Since agegr#587 the sentinel only fetched from the server, so with no older page there, reaching it did nothing. Widen the window in that case again, renew the observer when it grows, and observe the sentinel whenever it mounts, not only when the history cursor changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Refs #1031 (the refresh gap while a run is busy).
During a multi-call agent run, the context usage indicator stays blank or at its pre-run value: running-state reconciliation returns for a busy wrapper before applying usage, and assistant
message_enddoes not request fresh usage.Apply usage from busy reconciliation replies and refresh it when each assistant message completes. Mount, message completion, reconciliation and
agent_endreads share a monotonic request id with session, run and mount checks so slow replies cannot overwrite newer usage. Remove the duplicate unguarded mount write and update the existing cleanup test fixture for the new ref.This adds one state GET per completed assistant message and keeps the existing polling cadence. It does not address #1031's separate idle-session mount/
connectedrace, so it should not close that issue in full.Validation
npm test: 2,288 tests passed.node_modules/.bin/tsc --noEmitandnpm run lintpassed.git diff --checkpassed.Adapted from the desktop fork's independent fix; original tracking: xuzijian2019/pi-agent-desktop#3. No desktop or fork UI dependencies.