Skip to content

fix(tests): keep the launch-resolver and sessionDir suites green on unprivileged Windows - #1803

Merged
vastsa merged 50 commits into
vastsa:mainfrom
SeanLiu326:fix/windows-unprivileged-test-suite
Oct 22, 2026
Merged

vastsa merged 50 commits into
vastsa:mainfrom
SeanLiu326:fix/windows-unprivileged-test-suite

Conversation

@SeanLiu326

Copy link
Copy Markdown
Contributor

What this fixes

Fixes #1802 (two deterministic failures on every unprivileged Windows checkout of current main):

  1. launch-resolver.test.ts hardcoded a POSIX scratchDir. Production builds it with join(dataDir, "scratch", sessionId) (launch-resolver.ts:380), so a Windows checkout produces \data\scratch\s1 and the assertion toBe("/data/scratch/s1") failed. The runtime itself already handles both spellings (formatScratchDirForShell), so the fix mirrors the production expression: toBe(join("/data", "scratch", "s1")) — byte-identical to the old expectation on POSIX.
  2. The [Bug] Session history does not respect custom project-local sessionDir #1732 tests from fix(agent-runtime): discover native sessions in configured sessionDir #1764 call raw symlinkSync for file aliases. File symlinks need the Windows symlink privilege, so both fixtures crashed with EPERM before any assertion. Following the repo's existing createSymlinkOrSkip convention (storage-directory-migration.test.mjs:34), the two creations now tolerate EPERM: the escape entry is then simply absent and every remaining assertion still holds, while privileged runs and CI keep the full coverage — including the symlink-escape and alias-dedupe behavior the tests exist for.

Verification

  • packages/host-runtime: vitest run src/launch-resolver.test.ts — 6/6 pass on this unprivileged Windows box (was 1 failure).
  • packages/agent-runtime: vitest run src/native-pi-session.test.ts -t sessionDir — 6 passed, 41 skipped (was 2 EPERM crashes).
  • tsc --noEmit clean for both packages. No product code touched; POSIX behavior of both assertions is unchanged.

Two commits, branched from current main (b73b6df).

liubai and others added 6 commits October 20, 2026 16:19
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.
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.
… 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.
…nmounted

Stacked on vastsa#1783, which fixes who owns the reveal edge but not this path.

A reveal mounts only a trailing slice of history (TRANSCRIPT_INITIAL_MOUNT 15,
then TRANSCRIPT_WINDOW_MIN 60, lib/transcript-window.ts:23-28), so an older
bookmark routinely names a row that is not in the DOM. restoreTranscriptReading
Position reported that as false, and the alignment loop returns on false without
arming the deadline that would clear pendingRef (use-transcript-reading-
position.ts:99). While a restore is pending, useTranscriptScroll discards every
scroll event (:384-387), so the reader cannot travel up to mount the row either:
no restore, no scrolling, permanently.

The bookmark already recorded the absolute offset it was taken at
(TranscriptReadingPosition.scrollTop, captured at :59/:68), but the restore path
never read it. Use it as the fallback: an approximate place is strictly better
than a pane that can neither scroll nor restore. A bookmark with no usable
offset (NaN, negative, infinite) still reports failure, and a pane with no
layout box is still refused outright.

Tests: transcript-reading-position-fallback.test.mjs (5) covers the mounted-row
path, the unmounted-row fallback, a zero-height row, unusable offsets, and the
no-layout refusal. Related suites: 42/42. typecheck clean after a workspace
build.
…h-resolver test

join(dataDir, ...) yields native separators and the assertion hardcoded the POSIX spelling, so the suite failed on every Windows checkout while Linux CI stayed green. Mirror the production expression instead.
…sionDir tests

The vastsa#1732 tests create real file symlinks, which EPERMs on an unprivileged Windows checkout and crashes the fixtures (storage-directory-migration already degrades the same way). Catch EPERM and keep the remaining assertions, which hold without the alias; privileged runs and CI keep the full coverage.
vastsa and others added 22 commits October 21, 2026 22:23
The background-tasks bar only opened a task's log through its "Output"
button, so the row itself — the state dot, the command and the meta text —
looked clickable but did nothing, and the click target was a few pixels
wide.

The row lead is now the toggle: mouse click, Enter and Space all flip the
log, with aria-expanded on the interactive region. Stop and dismiss keep
their own buttons outside that region, and a source test pins the split so
a later refactor cannot regress the click target.
The D669 decision row landed with three cells in a four-column table in
both languages, so `pnpm --filter @pi-desktop/docs test` fails on
`origin/main` with a page-structure error.

Fill in the rationale the decision actually records: the shallowest-8000
entry index matched nothing for a script several folders down, which is
what issue vastsa#1781 reported. The table parses again.
Electron's direct fetch rejects before reaching the TLS fixture on macOS,
but can stall at the same client-certificate negotiation on Linux. Bound
the baseline probe and accept its abort as the platform-specific outcome,
while still requiring that no HTTP request reached the fixture.

This keeps the certificate discovery, proxy, redirect, and cancellation
assertions running instead of letting the child process time out.
Electron's direct fetch can remain pending during client-certificate
negotiation on Linux, and its AbortSignal does not reliably interrupt
that platform request. Race the baseline probe against a short deadline;
keep the process alive for the remaining discovery checks, then exit
Electron after the fixture has been verified.

A successful fetch still fails the test, and the fixture must receive no
HTTP request before the certificate error or platform timeout.
feat(composer): toggle background task output from the whole row
Fixes vastsa#1722

Tested: pnpm lint && node --test apps/desktop/test/chat-links.test.mjs apps/desktop/test/chat-ref-resolve.test.mjs && pnpm --filter @pi-desktop/agent-runtime exec vitest run src/runtime.test.ts && node scripts/e2e-file-ref-line-scroll.mjs && pnpm docs:check
passed (exit code 0)
Fixes vastsa#1806

Tested: pnpm test:e2e:transcript && node --test apps/desktop/test/thinking-ui.test.mjs apps/desktop/test/transcript-display-modes-ui.test.mjs && pnpm typecheck
passed (exit code 0)
Bounds recovery could leave Windows and Linux windows always-on-top
because only the macOS watchdog releases the temporary recovery pin.
Keep pin acquisition on the platform that owns its cleanup.

Regression coverage protects normal focus and hidden or minimized state
while preserving the existing macOS recovery behavior.
The shimmer styles were inserted after the first half of the running-label selector, so the active label inherited inline-grid and the pulse marker became an auto-placed grid item. Separate the marker and shimmer selectors again so the marker stays in the label's inline flow and does not disturb truncation.
The live dot was generated content inside the running label. A selector collision with the shimmer rule turned that label into a grid and pushed the dot onto a second row; even with the selectors separated, the inline pseudo-element sat below the row centre and could be clipped by the label's ellipsis box.

Render the marker as a real flex sibling so the header's existing align-items centres it, and keep the label's text truncation untouched.
Refresh the bundled provider catalog so the 0.21.0-beta.5 test build packages the current models.dev snapshot.
The refreshed models.dev snapshot publishes a 1,048,576-token window for deepseek-v4-flash; update the endpoint metadata assertion so the release verification pins the shipped catalog.
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
AuhNijGnahz and others added 22 commits October 22, 2026 19:55
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
…ives-session-switch

fix(asktool): keep card drafts across session switches
@vastsa
vastsa merged commit d1df8bb into vastsa:main Oct 22, 2026
4 of 5 checks passed

vastsa commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Thanks for fixing both Windows-only test failures. The scratch path assertion now follows the platform join, and EPERM is tolerated only when the current account cannot create file symlinks, preserving the remaining assertions and full symlink coverage where supported. The current-main candidate passed the sessionDir tests (6 passed, 41 skipped), launch-resolver tests (6 passed), and both package typechecks. Merged as d1df8bba0c01d9449df8ec8ebddfac16273428d2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Windows dev checkouts cannot run the launch-resolver and #1732 sessionDir tests (POSIX-hardcoded expectation + symlink EPERM)

9 participants