Repository navigation
fix(files): resolve and preview files from remote threads - #546
Merged
Merged
Conversation
nixuuu
force-pushed
the
fix/remote-file-preview
branch
from
November 12, 2026 08:48
b4ee075 to
b2cd2d4
Compare
nixuuu
added a commit
that referenced
this pull request
Nov 12, 2026
The linked-bot restart test can fail after the home reconnects even
though the mirror has reconciled correctly. `ListBots({ includeArchived:
true })` and `ListBots({})` have separate request cache keys, and each
refreshes in the background. An updated inclusive snapshot does not
establish that the active-only snapshot has refreshed. The immediate
active-list assertion can therefore see a deleted bot and a newly
archived bot from its previous snapshot.
Wait for the active-only request to return exactly the expected
unarchived bot, with a bounded 15-second deadline. Keep the deletion,
preview, mirror and client-error assertions. Production caching and
background refresh behavior are unchanged.
## Validation
Extracted from the change that passed CI in #546 and removed from that
branch. This PR targets the latest `dev` directly and contains only the
10-line test diff; it can merge independently. Fresh CI runs on this
independent branch. No local tests, typecheck, builds or browser were
run while the maintainer's performance measurement continues.
History: commit `21baef8c8` (#509) introduced both the linked-bot cache
fallback and this test's immediate filtered-list assertion. This is a
test synchronization correction, so it uses a context reference rather
than a release-hold footer.
Copy audit: not applicable; no user-facing text changes.
Related: #509
nixuuu
force-pushed
the
fix/remote-file-preview
branch
from
November 12, 2026 12:03
b2cd2d4 to
0ef0913
Compare
Loading changes path, hash and loading state. Track only the viewer target so those updates cannot trigger another read and keep the dialog loading. Fixes: #499
nixuuu
force-pushed
the
fix/remote-file-preview
branch
from
November 12, 2026 12:09
9684c95 to
84b1a71
Compare
nixuuu
marked this pull request as ready for review
November 12, 2026 12:10
This was referenced Nov 12, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 12, 2026
Settings → Diagnostics repeated the computer hostname once per mirrored thread, making dozens of rows indistinguishable. Thread sync now shows one row per linked computer, using its display name and complete thread totals. Expanding a row loads only threads that need attention, with titles, remaining records, pause reasons and links. When reachable computers are caught up, one calm status replaces the list and zero counters. Fixes: #543 The additive RPC returns local computer summaries separately from bounded attention pages. Every join is owner scoped; message bodies are never read. A migration records the last committed range time without inventing historical timestamps. Web and mobile share grouping/status copy, poll summaries every 5 seconds while visible/foreground, and fetch detail pages only for expanded computers. Mobile changes are JS-only; native configuration and dependencies are unchanged. The Diagnostics page only loses its obsolete subtitle; its layout and other sections are unchanged. Validation: - Generated contracts with `bun run gen`. - Changed-file oxfmt and oxlint passed at `nice -n 19`. - Added gateway gRPC integration coverage for aggregation, attention pagination, failure-only threads, identical computer/thread IDs across owners, title isolation, message-body exclusion, committed timestamps and duplicate ranges. - Rebased on `dev` through #554, including #546 and #547. Resolved the generated-contract conflict by regenerating the merged proto; `bun run gen:check` passed again. Migration registry and schema expectations contain 0124, 0125 and 0126 in order. `bun install` passed locally. - Latest focused migration run passed: 25 tests / 105 assertions across `packages/db/test/inherited-access-upgrade.test.ts`, `packages/db/test/thread-sync-upgrade.test.ts` and `packages/db/test/schema.test.ts`. The #547 test now checks the contiguous 0124 → 0125 upgrade before applying later migrations, preserving every explicit owner choice. Earlier gateway/schema run passed 26 tests / 157 assertions. The full `check:tmp` was deliberately left to GitHub CI during the host measurement window. - Manual Chromium review of the real Settings → Diagnostics route against an isolated gateway/database with synthetic presence: caught up, catching up, paused with reason, unreachable; 126 threads across three computers; long names/titles; light/dark; desktop 1280×800 and phone 390×844. Verified 25+5 attention pagination, qualified thread link targets, automatic transition to the calm caught-up state, icon refresh/tooltip and absence of zero counters. Fixed a phone overflow found during this review. No web UI tests added. - EAS CLI 27.4.1, production profile: fingerprints match `origin/dev` exactly on both platforms (iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`). Compared against a clean archive with its own matching dependency install. Copy audit (§8): - Repeated hostname + “Up to date” → display name + “2 of 42 catching up · 1 paused · 15 records to go”: identifies the computer and actionable work. - “Remaining / 0 to go” and “Threads / 0 / 0” → “All threads are up to date” with last sync time: removes empty metrics. - Two explanatory descriptions → “Sync with linked computers.”; removed “Check sync progress without opening thread content.” - “Refresh” → icon button labelled/tooltipped “Refresh sync status”. Pause reasons use the existing shared vocabulary; recovery says “Retrying automatically.” or “Check the linked computer.” - Reviewed sentence case, length, plurals, glossary, actions, error recovery and textual status cues. No humour or new glossary terms. Short, typical and long-name/title layouts checked in Chromium at desktop and phone widths in light and dark modes.
nixuuu
added a commit
that referenced
this pull request
Nov 12, 2026
Collapsed tool calls currently show a separate “Load full item / Showing a preview.” row, even when their truncated content is hidden. Load each call’s full content automatically when its own details open, with a compact inline spinner and loading status. Keep the preview visible on failure and offer Retry. Visible message previews end with “Show full message · <size>” and load in place. Truncated background output ends with “Show full output · <size>”. Completed reads stay in a client session cache keyed by thread and content hash, outside the timeline reducer. Closing a disclosure aborts its read; web cancellation follows the open state even while the body’s exit animation remains mounted. Mobile follows the same behavior with JS-only changes. Reasoning and compaction retain their own disclosure boundaries. The diff is limited to lazy content and preserves the mobile turn animation changes now on dev. Fixes: #541 ## Verification - Rebased onto dev, including #546 and #554. `bun install` and `bun run gen:check` pass. Focused lint and formatting checks pass; web typecheck reports zero errors and warnings, and mobile typecheck passes. - Focused integration: `tests/integration/thread-sequence-watch.test.ts` — 10 pass, 0 fail. Covers bounded windows, on-demand large content, chunked reads, concurrent cancellation, and owner scoping. Domain and gateway loading semantics are unchanged. - Real browser with seeded large command, file-read, background-output and message content: collapsed calls send no content requests; expanding loads full content inline; a 352 KB output loads over 8 chunks; collapse aborts an outstanding request; loaded output survives re-expansion without another request. Simulated failure preserves the preview; Retry loads successfully. Verified “Show full output · 1.4 KB” expands the truncated background output in place. - Visually reviewed light/dark at 1280 px desktop and 390 px phone width, with short and long call/file names. Inline states use tool-row meta text (12 px desktop, 13 px phone); no page overflow. No web UI tests added. - EAS production fingerprints match dev: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. No native config or dependencies changed. Full `check:tmp` was not rerun locally, as requested; the full suite and web build run in CI. Browser review found and fixed a missing reactive Retry dependency in the Svelte effect, and moved the existing truncated-background-output action after its output with the requested copy and size. The original Static checks failure was formatting in mobile LazyItemContent; that formatting fix is included. ## Copy audit (§8) | Before | After | Reason | | --- | --- | --- | | Load full item | Automatic loading inside expanded details; Show full message · <size> for visible message previews | Removes internal “item” terminology and attaches the action to visible content. | | Showing a preview. | Loading output… / Loading thought… / Loading summary… / Loading message… only during a read | States the ongoing action at work-row meta size; no redundant explanation. | | Could not load the full item. Try again. | Could not load the full output/message/thought/summary. + Retry | Names the affected content and provides one concrete recovery action. | | Show all output | Show full output · <size> after the truncated output | Names the content and shows its size where the preview ends. Streaming output omits the size. | Audit items 1–10 pass: short sentence-case copy, verb-first actions, existing vocabulary, concrete error recovery, no duplicate facts or new empty states, no humor, and text alongside status cues. Short, typical and long names were checked at desktop and phone width in light and dark.
nixuuu
added a commit
that referenced
this pull request
Nov 12, 2026
An update or restart can surface an authentication failure as “Pair again” even when the saved computer identity has not changed. Reconnect now treats RPC authentication failures as retryable and requires repeated, locally verified TLS pin mismatches before requesting new trust. A successful handshake with the saved identity clears stale pairing state. ## Investigation - The dial catch classified **every** `ConnectError(Code.Unauthenticated)` as a pin mismatch. That includes invalid certificate validity, a peer rejecting the client pin, and hello validation; on a manual route it persisted `pairing_required`, and on LAN it deleted the route. This behavior exists in the original linking implementation (#13), before the reported release range. - Reviewed `v0.2.0-nightly.120..v0.2.0-nightly.137` and the `.133` → `.137` diff, including #547, #548, #559, #562, #565, #566 and #546. The full desktop hello grew from 32 capabilities to 33 in #559; both releases reject more than 32 as `Unauthenticated: Invalid computer identity` after pinned TLS succeeds. Merged #574 fixes this capability overflow, including compatibility with the older validator. This branch is rebased onto that fix in `dev`. Full source evidence: #573 (comment). - Identity and the 20-year certificate are persisted in `computer_identity`; the private key uses the existing encrypted secrets key. Desktop keeps the same Canopy data directory, database, app/keychain name and `secrets.enc` across versions and channel changes. Keychain/decryption failure stops startup rather than replacing the identity. Reinstalling while preserving that data preserves trust; deleting it creates a new identity. - Production starts computer links, including loading identity and peers, before opening Network access. There is no demonstrated listener-before-store race in that path. The new readiness guard also makes an early or stopping link service explicitly return `Unavailable`. - `manual` means entered by the user, including a LAN/Tailscale address; it is separate from the network's address type. A bad manual path must not override another route or an incoming connection proving the saved pin. The capability-count rejection is source-proven for the reported version pair's full desktop configuration; incident logs would still be needed to attribute every earlier report or explain successful re-pairing. ## Changes - Use a local `CertificatePinMismatch` signal emitted only after TLS proof of possession and validation of a different self-signed certificate. Override ConnectError's inherited structural `Symbol.hasInstance` check so ordinary RPC errors cannot impersonate this local class. Without this override the new LAN test correctly caught a real route-deletion bug, not test timing. Invalid/expired certificates remain rejected without declaring an identity change. - Exhaust routes first. Require the same different certificate at the same manual route in two consecutive failed rounds. A matching pinned TLS connection or ready incoming link outweighs stale addresses. Only a verified pin mismatch removes a discovered LAN route. Saved pins are never replaced automatically. - Clear confirmation evidence after pinned TLS verification, a successful handshake, explicit pairing, route edits and unlink. Existing successful handshake recovery also clears a persisted `pairing_required` after restart. - Use the shared reason “{name}'s identity changed. Pair again to trust it.” for linked computer availability and app updates, including the relay's name when its identity changed. Remove the contradictory automatic-retry explanation for that state. Add stable auth-failure classifications to diagnostics without logging certificates, keys, addresses or RPC payloads. - Document persistence and recovery. No proto changes, protocol bump or migration. ## Regression coverage Added gateway↔gateway integration scenarios using independent databases and real TLS listeners: 1. Repeated startup `Unauthenticated` on manual and LAN routes preserves trust and resumes; verify the LAN route remains after each attempt. RPC error text cannot impersonate a local pin mismatch, and failed TLS connections cannot confirm a manual route's identity change. 2. An early listener returns `Unavailable` for both `Pair` and `Connect` until ready. 3. Both gateway/core restarts reuse persisted identities/certificates and reconnect; a protocol-1 `.133` hello without new capabilities links with a `.137` hello and resumes after upgrading. 4. A real new key requires confirmed pairing, receives no RPC, never replaces the pin, and has consistent availability/update explanations. 5. A persisted stale pairing state heals after restart; a valid alternate route outweighs a stale manual address with another key. The older-version scenario exercises the compatible wire hello/capability set, not archived app binaries. Installer and OS keychain behavior was inspected in source, not exercised on macOS/Windows. ## Validation - After maintainer clearance, ran only the two authorized test files, sequentially, at `nice -n 19`, using `TMPDIR=/var/tmp` and `bun run check:tmp`: `linked-pairing-recovery.test.ts` **10 pass**, `linked-capability-compatibility.test.ts` **3 pass**. Both temp-directory checks passed. The original LAN failure reproduced before the fix (8 pass / 1 fail); the strengthened assertion confirmed deletion immediately after the first auth failure. - Changed-file formatting and lint passed; `git diff --check` is clean. Earlier dependency install and repository formatting/lint checks passed before the original push. - CI validates generation, full typechecking, all test shards and builds for the rebased head. Browser verification remains pending; the UI change reuses existing components and only changes status explanations. ## Copy audit (§8) “{name} must be paired again” / “Link it again…” / “unavailable, trying again automatically” → “{name}'s identity changed. Pair again to trust it.” The text states the verified problem and the explicit trust action, uses two short sentences and avoids TLS jargon. The compact action badge remains “Pair again”. Names are interpolated as whole values and existing wrapping/layout remains in place; short/long-name checks at desktop/phone widths have not been run yet. Related: #13
nixuuu
added a commit
that referenced
this pull request
Nov 13, 2026
"Opening the file…" and the other file preview states (too large, cannot show, empty) used the dialog's body text size, visibly larger than the code view and the file caption. They now use `text-sm`, matching the caption. Pre-existing; Related: #546 ### Copy audit (docs/copy.md §8) No UI text changed. ### Checks lint and format:check clean locally; typecheck, tests and web build in CI.
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.
Clicking a bare name such as
violet-bg.jpgpreviously tried only the thread's root and reported a missing file as deleted. Binary bytes were discarded, so images could not load even with a connected home computer.This change resolves references on the thread's home worker, including a separate worktree, and previews text and images on web and mobile.
Behavior
Validation
Rebased onto
devatf76cfb2a9453a26e3218c553aad8fcb37e9d55e0. Generated contracts were regenerated to preserve the base branch's additive changes. The independent linked-bot test synchronization correction was extracted to #561; this branch contains no linked-bot test or production cache changes.bun installandbun run gen:checkpassed. FocusedTMPDIR=/var/tmp bun test tests/integration/thread-file-previews.test.tspassed on the final rebased head: 11 tests, 75 assertions, no failures. Web typecheck passed with zero errors/warnings; changed-file oxfmt and oxlint passed. The fullcheck:tmpwas intentionally not repeated locally, as requested; GitHub CI runs the full shards and required static/build checks.load()without tracking mutable viewer state. The repeated review passed. The final rebase leaves the reviewed file-viewer and mobile-file components unchanged.expo-updates fingerprint:generatewithCANOPY_CHANNEL=nightlyare identical for final head and base, using the same repository path and installed dependencies: iOS6ddec9ef559ee0095ac33e94ff9418a942053b17; Android5f6eae3ab278f1cd543e9ed763f923a319b65ec9. No native code, dependencies, EAS configuration or lockfile changes.Fresh CI runs on final head
84b1a71365f817cc104d088cf7fb041100aa6686; its result is reported independently of earlier passing runs. All disposable gateways, worker, database and web processes were stopped after review; local browser sessions were closed.Copy audit — docs/copy.md §8
./.Static audit: English, sentence case, plain glossary terms, verb-led actions, confirmation verbs agree, and errors explain the event and the next action. Search diagnostics are disclosed under “Show searched paths”. Empty states are short and use the existing Reload action. Title/subtitle supply different information. Computer availability is a named dependency with reconnect/reload guidance. No humor or ornamental copy was added. States have text independent of color or icons.
Visual copy audit (§8.9): short, typical and long file names/paths checked in Chromium at desktop and phone widths, in light and dark. Titles/subtitles wrap within the dialog, path choices stay compact, errors show accurate copy and searched-path disclosure, and no overlay gaps or horizontal overflow appeared. Mobile source copy uses the same shared lookup messages; no native-device visual review is claimed.
Fixes: #499
Related: #514