Repository navigation
fix(asktool): keep card drafts across session switches - #1776
Merged
vastsa merged 79 commits intoOct 22, 2026
Merged
Conversation
The AskTool card kept its question index and draft answers in component state, so switching sessions unmounted the card and returning to the same pending ask reset every answer. Store the draft by requestId instead and let the card read and write that entry, dropping it when the ask is resolved, dismissed, or removed. Amends the asktool card spec's request-transition rule and adds E2E-ASKTOOL-draft-survives-session-switch.
liubai0106
force-pushed
the
fix/asktool-draft-survives-session-switch
branch
from
October 20, 2026 08:20
aa5ed1e to
b6863ae
Compare
An isolated session's files live in its worktree, but chat references can still carry a path from the parent checkout: project instructions, MCP tools, or a reference captured before isolation. The resolver rejected that path as outside its roots, and the renderer then handed the file view a relative path that it resolved against the parent checkout, so the click either failed or opened the main-branch copy. Rebase an absolute parent-checkout reference onto the same relative path in the worktree when that file exists, and keep the worktree's absolute path in the renderer so the file view opens the branch copy. Paths that exist only in the parent still report outside-allowed-roots. fixes vastsa#1747
Follow mode can still read pinned when a send or retry hid the pane. On the next reveal the scroll hook then bottomed the transcript before the reading-position hook could restore the recorded bookmark, so a reader who had scrolled up returned to the newest turn. Route the reveal through one shared ownership rule: an unpinned bookmark or a pending restore keeps the edge, a genuinely pinned pane bottoms, and an unpinned pane without a bookmark reapplies its retained offset. Both hooks now agree on which one acts. fixes vastsa#1771
Move the five direct Pi dependencies (agent-runtime's pi-agent-core, pi-ai and pi-coding-agent; Desktop's pi-ai and pi-mcp) to exactly 1.3.0 so the release group stays internally consistent. The three Desktop compatibility patches are rebased onto the published 1.3.0 tarballs, preserving hosted-search streaming, bounded Anthropic OAuth handling, DeepSeek reasoning replay, local request errors, and native session estimation. Adopt the upstream behavior changes that the upgrade makes reachable: foreign model thinking is no longer replayed, malformed final tool-argument JSON is rejected before Host execution, and the extension startup event carries the user discriminator the new SDK expects. Desktop's own command-argument parser gains the same empty-argument handling so quoted blanks no longer shift later positional arguments. Anthropic strict-tool fallback now re-enters local request preparation on each attempt, keeping callback and serialization failures classified instead of leaking raw payloads. Provider projection gaps that this upgrade does not close are recorded as deliberate follow-up work rather than silently enabled.
chore(deps): upgrade Pi kernel packages from 1.1.0 to 1.3.0
The file index keeps only the shallowest 8000 entries, so in a large workspace — a Unity project, where every asset has a .meta sibling — a script several folders down matches no query at all, even though the truncation note invites the reader to refine it (vastsa#1781). While the snapshot is truncated, a non-empty query is now also searched over the workspace's full listing through the read-only fs/search channel, after a short typing pause, and the best rows merge with the index's own matches. The listing is the git list the index already builds, or a deeper ignore-set walk when the index came from the walk. A complete index never searches, and a remote session keeps its snapshot because the remote file protocol has no search operation. fixes vastsa#1781
The macOS main window stacked the native `sidebar` vibrancy material behind a transparent Electron surface. WindowServer recomposites that material on every frame the window stays dirty, so an idle focused window held GPU near 40% on Apple Silicon while a minimized one returned to the desktop baseline (issue vastsa#1064). Bounding idle indicator animations reduced the load but could not remove it, because the material itself kept the window in the compositor's per-frame path regardless of what the renderer painted. macOS now paints the same opaque native background the other platforms already use. The frameless `hiddenInset` titlebar, the inset traffic-light position, and the renderer's sidebar tint and sheen are unchanged, so the surface still reads as glass over the host palette. `applyNativeThemeSource` no longer re-applies a material, and the `window.setBackgroundColor` IPC no longer returns early on darwin, which means a granted `windowAppearance.backgroundColor` plugin theme is applied on macOS like everywhere else (ADR 0248). ADR 0330 records the decision and the measurement; the specs that described the vibrancy plate are updated in the same change. (cherry picked from commit 1a535a2)
An opaque macOS surface keeps the window out of WindowServer's per-frame recomposition path (vastsa#1064), but it also drops the live wallpaper blur some users want. The surface is now one explicit choice: opaque by default, and Settings > General > Appearance > Translucent window restores the sidebar vibrancy material. Electron fixes `transparent` when a window is created, so the preference is read before `new BrowserWindow` and applies on the next launch. The settings row asks the main process which surface it actually created (window control getState) and shows a restart hint while the two disagree, rather than mutating a live window or faking the switch. `macosWindowSurfaceOptions` is now the only declaration of the macOS surface, so a theme change keeps repainting the opaque window while a translucent one keeps its material, and ADR 0332 records the revised decision.
…ency-setting feat(macos): make the translucent window surface an opt-in setting
The window was created with the vibrancy material and then had the opaque host colour painted over it immediately after creation, because the post-creation background paint did not know about the surface choice. Turning translucency on therefore looked inert even after a restart. That paint now skips a translucent macOS window, the same way the background IPC and the theme path already did. Translucency is also the shipped look again: an absent preference means the material, only an explicit `false` opts into the cheaper opaque surface, and the stored flag defaults to translucent so a boot that cannot read settings still paints the window the user expects. Docs and tests follow the corrected default (ADR 0332, D667).
…ow-default fix(macos): keep the translucent window surface on by default
vastsa#1782: when discovery returns no registration endpoint, the login flow fell back to a literal client id: } else { clientId = "pi-desktop"; } No authorization server has ever registered that id, so the app opened `<authorize>?client_id=pi-desktop` and the user landed on a bare 404 — with no explanation and no way forward. It is not a GitHub-specific failure: any OAuth MCP server without Dynamic Client Registration is affected. Throw before opening anything, naming what is missing and the two real ways out. A settings field for a client id does not exist yet, so the message does not promise one. The test drives the real startLogin through a mocked discovery that omits registration_endpoint, and asserts both the message and that openExternal was never called. Verified against the old code: the test does not merely fail, it hangs until the 300s timeout, because the previous flow waited for a callback that could never arrive — the same experience the report describes. Verification: mcp-oauth.test.mjs 20/20, mcp-oauth-discovery.test.mjs pass, tsc --noEmit clean.
…astsa#1785) * feat(plugins): offer one line of composer suggestion from a plugin A plugin that reacts to a finished turn often knows what the user plausibly types next, but every surface it has today interrupts: a toast, a notification, or a rewrite of a draft the user already wrote. Add `pi.composer.suggest` and `pi.composer.clearSuggestion`, gated by the new `composer.suggest` permission, which put one dismissible line into the placeholder layer of the Composer for the session on screen. The decision is split along the ownership the host already has. The main process refuses a session that is not the one on screen and a turn that a newer turn overtook, because it owns both facts; the renderer refuses a draft that is not empty, because only it owns the draft, and answers the waiting caller. A plugin therefore learns `shown: false` with a reason instead of guessing, which is what lets it stop spending completions on a user who is not looking. Main never writes renderer state: it sends a message, like `pi.ui.revealView` does. Nothing a plugin offers becomes draft text on its own. `Tab` writes the line into the draft with the caret at the end, `Esc` drops it, and typing, sending, a session switch, a new turn, a plugin stop, a reload or a window close all end it; the `@` / `/` completion list keeps `Tab` and the first `Escape`. See ADR 0332. * refactor(plugins): keep only the facts the suggestion slot reads The suggestion bridge kept the composer handle inside its live-draft value, but it already reaches the newest handle through its own registry. Drop the duplicate so the value describes only what the decision needs: the session, the text and how many references the draft holds. * fix(plugins): give the suggestion slot a server snapshot React requires a third snapshot when a component is rendered to a string, and the app-shell snapshot fixtures render the Composer that way. Without it React threw "Missing getServerSnapshot" and the three shell-render tests failed on CI even though the browser path was fine. A suggestion is a live-window fact, so the server snapshot is simply "none". --------- Co-authored-by: v_wyxgwang <[email protected]>
Keep each assistant turn behind one process disclosure while allowing shell calls to remain independent or join their surrounding activity group. Read the presentation preference during rendering so cached turns update immediately, and preserve disclosure choices across parent toggles. Add regression coverage for settings persistence, outcome states, visibility, alignment, hit targets, and rendered scroll stability.
vastsa#1751's Electron E2E job ran 30m18s and was cancelled by the job budget with no failing step to read. The cause is this runner's only timeout: const timer = setTimeout(() => child.kill(), 60_000); SIGTERM is a request. An Electron child still initialising its renderer can ignore it, and the 'close' event this script awaits then never arrives, so the step holds the job until GitHub cancels it. The runner's own 60s budget is never enforced. Escalate: SIGTERM at 60s, SIGKILL at 65s, and report which one fired. A probe that cannot start now fails this step in about a minute with its output attached, instead of burning the job budget. Verified: normal path still passes ("provider client certificate E2E passed"); with a child that ignores SIGTERM the escalation force-kills it at ~800ms in an isolated harness, so the timeout path terminates rather than hanging.
Long sessions accumulate one system-transcript snapshot per instruction change. Unless a model declares mid-conversation system support, every adapter folds them into a single leading message, but the output-cap estimate charged each superseded snapshot again. The clamp collapsed to 1 and the provider floor (16) went on the wire while the request was far from the window, so reasoning models were cut off and the turn ended as EMPTY_MODEL_RESPONSE without compaction ever triggering. The parent and subagent stream paths now fold the transcript the way the adapter will before clamping, and hand that same transcript to pi-ai so its own streamSimple clamp agrees. Context calibration and the compaction budget keep their existing basis.
Add a persisted ranscriptDisplayMode setting with flat, command-first, and fully-folded layouts. Fully-folded keeps the v0.20.0 command grouping, command-first keeps run rows standalone, and flat removes nested activity groups while preserving one outer process. Make Thinking rows default expanded in flat and command-first, collapse to a whole-run TextShimmer indicator, and use the same shimmer for the hidden reasoning live indicator. Keep fully-folded's existing Thinking defaults. Deprecate keepCommandsExpanded; it remains readable for compatibility. Cover mode segmentation, settings normalization and sync, and renderer wiring; update transcript and settings specs and ADRs.
Open the completed process and Thinking disclosure before asserting the retained reasoning text now that a collapsed Thinking row shows only its label. Also assert flat mode keeps one outer process without nested activity groups or standalone run wrappers.
… set
The sidecar merges the operating system's trust store into Node's default CA
set at startup. Those stores are a cache and keep entries that already
expired: Windows still lists Let's Encrypt's `ISRG Root X2` and `R3` with a
2025-09-15 expiry long after the fact.
Merging one of those makes OpenSSL accept an expired certificate as the anchor
for any chain that names it as issuer. A chain like
leaf -> YE2 -> Root YE -> ISRG Root X2 -> ISRG Root X1
stopped at the expired `ISRG Root X2` instead of walking up to the valid
`ISRG Root X1`, so the handshake failed with `CERT_HAS_EXPIRED` even though
the provider's own chain was valid. The failure is reported as a TLS category
error and is correctly not retried, so the provider is unusable until the
expired entry leaves the store.
Every provider behind such a chain failed, which is why the report looked
provider-specific (issue vastsa#1393). Reproduced on Windows 11 with Electron 43.6.0:
`tls.getCACertificates("system")` returned 146 certificates, 17 of them
expired, and the same host handshakes fine with the bundled roots alone.
An anchor that has already expired can verify nothing, so it is never merged.
The bundled and `NODE_EXTRA_CA_CERTS` sets are untouched, and chain,
expiration and hostname validation stay enabled - this narrows the merge, it
never disables verification.
- `system-ca.ts`: filter the system store by `validTo` before merging.
- `system-ca.test.ts`: assert no expired system anchor reaches the defaults.
- `e2e-provider-certificates.mjs`: the trust probe now measures the usable
system roots, because the previous "every system certificate is present"
expectation cannot hold once expired entries are excluded.
The shared transcript module now imports the Thinking shimmer. Keep the session-reference renderer probe's dependency table complete so it can continue exercising message references without loading the app store.
feat(transcript): add display modes and thinking shimmer
Bring the contributor branch onto the current integration base before validating and merging the OAuth fix.
Bring the transcript reading-position fix onto the current integration base before validation and merge.
The PR reused D665 after current main assigned that decision to the macOS window surface. Integrate the latest base and keep the deep-search decision uniquely traceable as D669.
The shallow workspace index could hide deep files from the @ menu. Search the full bounded listing while the snapshot is truncated, and discard stale query results.
Current main adds a second search handler in the same workspace IPC module. Keep that handler and the contributor's worktree reference mapping together in the integration candidate.
Absolute references from the parent checkout missed the isolated session's worktree. Resolve the matching file in the worktree and pass that exact path to the file view.
Integrate the reviewed transcript reveal change with the latest main before candidate validation.
Restoring a session could let stale pinned state send a reader to the latest turn. Let the saved unpinned reading bookmark own the pane reveal.
chore(release): v0.21.0-beta.6
A review-backed Edit or Write now renders as a single tool-level review row: the file header is the only disclosure header, with its diff body directly beneath it. This removes the duplicate generic tool row while keeping rollback and adding a copy action for the hunks. The command-first and fully-folded group bodies restore the released v0.20.1 12px child indent and left hover/focus collapse rail, so non-command tools keep their two-level hierarchy without adding a third disclosure.
feat(transcript): flatten edit rows and restore group hierarchy
Keep translated display-mode labels on one line instead of squeezing them into the fixed field column. Allow settings controls and whole options to wrap when the available pane width is limited.
…ay-width fix(settings): size segmented controls to their content
Repeated provider IDs were mistaken for replayed history, dropping real results and freezing the outgoing request. Assign execution IDs before Pi journals each response and retain completed pairs at the request boundary. Keep identity reservations across compaction and model fallback. Fixes vastsa#1815
Gemini rejects the additionalProperties keyword in its setup Schema. Use its supported schema subset while keeping OpenAI and Host validation strict. Reject failed setup immediately and retain the first socket failure's diagnostics in the provider log without exposing them over IPC. Fixes vastsa#1812
Anchor the global toast stack to the live main-content bounds so docked and resized work panels remain usable while notifications are visible. Preserve viewport fallback placement outside the chat shell and cover resize and horizontal-shift geometry in the question-notification journey. Refs vastsa#1820
…ini-live fix(runtime): preserve repeated tool executions and repair Gemini Live setup
Refresh the toast fix candidate after the runtime changes landed so its head contains the current integration base.
Drive the focus and blur lifecycle through explicit DOM events so the countdown coverage does not depend on operating-system window activation. Keep native keyboard input coverage in Electron.
…overlap fix(desktop): keep toasts clear of the work panel
The pull request was based on an earlier main revision. Merge the current production tree into the shared branch so review and landing use the latest main without rewriting the contributor's commits.
…t-tab-stacking fix(window): 修复窗口恢复后残留置顶导致的窗口遮挡问题
The pull request was based on an earlier main revision. Merge the current production tree into the shared branch so review and landing use the latest main without rewriting the contributor's commits.
…y-disclosure fix(transcript): keep activity details visible after turns settle
The pull request was based on an earlier main revision. Merge the current production tree into the shared branch so review and landing include the latest changes without rewriting the contributor's commits.
…ferences fix(chat): parse positioned and ambiguous file references safely
Keep a revisited transcript near the reader's last position when virtualization omits the anchor row instead of leaving it at the initial viewport.
A bookmarked anchor can be outside the mounted window while its bounded history lookup is pending. Start viewport alignment only after the lookup succeeds so the fallback deadline cannot cancel it. Cover delayed lookup and document the approximate offset behavior.
Restore the saved absolute scroll offset when a bookmarked row is loaded but outside the mounted window. Wait for bounded history lookup to finish before starting alignment, so slow reads are not canceled by the fallback deadline.
Windows system stores can retain expired certificates, and merging one as a trusted anchor can make otherwise valid provider chains fail validation. Filter only expired system entries while preserving bundled and extra certificates, and keep the behavior covered by a deterministic regression case.
…nchors fix(agent-runtime): skip expired OS trust anchors when merging the CA set
Long sessions retain superseded system snapshots even though adapters send only the current instructions. Measuring the folded request keeps the configured output budget from collapsing to the provider floor, while model-declared mid-conversation support preserves its existing transcript.
…sed-system fix(runtime): size the output cap from the folded request transcript
…codex/review-pr1776
Owner
|
Thanks for the focused fix. I verified that AskTool drafts and the question index survive a session switch while remaining isolated by request ID. The candidate containing current |
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.
What this changes
The AskTool card kept its open question index and draft answers in component state.
Composerrenders the card only while the active session has a head ask, so switching sessions unmounts it; returning to the same pending ask remounted a fresh card at question one with every answer cleared. The ask survived because it lives in the store — only the in-progress answers were lost.This moves the draft into the app store, keyed by
requestId(askDrafts), and makesAskToolCarda controlled view over that entry:pending-asks.tsgainsAskDraft/AskDraftsplus set/drop helpers.AskToolCardreads and writes the store entry instead of owninguseState; a missing entry falls back lazily at read time (no seeding during render).Tests
pnpm test:e2e:asktool-cardgainsE2E-ASKTOOL-draft-survives-session-switch: select an option, advance to question two, unmount, remount with the samerequestId, assert the open question and the earlier selection survive. It passes locally ({"ok":true,"resolutions":5}).pnpm typecheck(desktop) andpnpm lintpass.Notes for review
The existing spec explicitly froze the old behavior ("Unsubmitted card drafts are local to the mounted card and are reset when it is replaced"), so this changes a documented decision; the ADR records it. Happy to switch to the module-level map alternative if you prefer that shape.
Fixes #1765