Repository navigation
perf(web): keep running-work animations off the main thread - #522
Merged
Merged
Conversation
Use compositor text sweeps and visibility-aware shared clocks for running work. Reuse completed feed prefixes and structural indexes, batch text measurements, and contain streamed output layout. Keep structural scroll settling before paint so follow-end and reader anchors remain stable. Pause mobile loops outside the viewport/background and keep decorative native loops from blocking list batches. Production fingerprints match.
nixuuu
force-pushed
the
perf/web-animation-jank
branch
from
November 10, 2026 17:55
077a539 to
6361ea4
Compare
This was referenced Nov 10, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 10, 2026
A live thread update replaced the overview index, and every one of the ~500 sidebar rows reran: Svelte's reactive graph marked them all, every row rebuilt its children and re-formatted dates, and `animate:reorder` measured and animated rows nobody could see. Rows now read their own slot and update only when what they show changes. Offscreen rows skip rendering, and the side panel and composer tray ignore events about other threads. Ordering, unread, running and result states are unchanged. ### Changes - **Granular sidebar rows.** `sidebarRows` and `sameSidebarRow` (domain) build each row's data: thread, side threads, subagents that need input, project, worker and open tree. `Keyed` (`#lib/shared/keyed.svelte.ts`, backed by `SvelteMap`) writes a row's slot only when that data changed. The keyed list still iterates a stable key array, which changes only when the order changes. - **Reorder animations only on screen.** `reorder` skips rows that are offscreen both before and after the move. Rows the user can see animate exactly as before. - **Offscreen rows skip rendering.** Inbox rows get `content-visibility: auto` with `contain-intrinsic-size: auto` set to the measured row height (78 px desktop, 82 px phone) and `overflow-clip-margin`, so focus rings are not clipped. Rows stay in the DOM, so find-in-page, Tab order and the a11y tree are unchanged. Virtualisation was rejected for that reason. - **Archive refreshes.** `SidebarArchivedThreads` refetched archived pages after any thread or project event. It now refetches only when an update can reach the archive (`changesArchived`): new, deleted, archived or restored threads, archived titles, and sides of archived mains. - **Thread page.** `treeOf` builds only the current tree instead of the whole forest. `tree` and `subagents` keep their value while a rebuild yields the same items (`retain`), so the panel, lineage and composer tray don't rerender for other threads' events. The directory lookup uses the index map instead of `find`. - **Shared code.** `Intl.DateTimeFormat` instances are cached per option set; `formatDateTime` was creating a formatter per call, per row. Tooltips listen for presses elsewhere in the document only for `touch: "tap"`; previously every row's tooltip added a `document` `pointerdown` listener. - **Mobile (JS only).** Sidebar `FlatList` rows are `memo`ised with a comparator that covers everything a row shows, including its age labels at the list's render time, so the output matches the unmemoised list. Overview `workers` and `projectChoices` are memoised. The archived pager refreshes only on archive-relevant index changes (`indexChangesArchived`). - **Docs and tests.** New Polish subsection in `docs/client-performance.md`. Pure tests cover row equality, the archive-refresh rules and `treeOf` equivalence with `threadForest`. - **Electron.** Renderer IPC (`canopy:*`) is low-rate (status, zoom, updates); live data uses the same SSE as web. Nothing changed. ### Measurements Linux / Ryzen 5 5600X (12 threads) / Chromium 155 headless / Bun 1.4.4; 1512 × 949, dark theme, warm Vite dev BFF on a private bench stack (`scripts/bench/client-stack.ts`). Before is `dev` at 862ad48 from a second worktree on the same gateway and data. Three **alternating pairs** of 120 s recordings per scenario (the order flips each pair). Before each run the script waited for loadavg < 6 and low swap I/O; logged loadavg was 1.6–4.5 for every run, so none were discarded. Metrics follow #522's method and analyser: busy % is the union of renderer-main tasks between marks; dropped % uses trace frame deadlines; frame gaps come from rAF. Values are medians, with the range in parentheses. **Sidebar scenario.** 500 seeded threads. An idle thread is open. 10 threads run, and every 50 ms one of them changes status, title, background-task count or last message. Updates go through the same path as the SSE handler (JSON → protobuf decode → `OverviewState.apply`). As in the gateway, only a turn start or finish moves `lastActivityAt` (about 3 reorders/s). | Metric | Before | After | | --- | ---: | ---: | | Main-thread busy | 82.69% (78.12–89.40) | **43.50%** (37.47–44.66) | | Long tasks/min | 10.50 (0.50–34.49) | **3.50** (1.00–4.00) | | Dropped-frame deadlines | 19.44% (6.68–21.10) | **3.17%** (2.82–5.35) | | p95 rAF frame gap | 33.40 ms | **16.80 ms** (16.70–16.80) | | Average rAF frame gap | 20.07 ms | **16.90 ms** | | Style + layout / s | 123.4 ms | 128.2 ms | | Paint + pre-paint + layerize + commit / s | 208.0 ms | **114.3 ms** | | Delivered updates/s (target 20) | 19.90 | 19.89 | | GC / s | 3.68 ms | 2.67 ms | | Used heap during run | 118.0 → 191.6 MB | 118.0 → 149.8 MB | | Heap after forced GC | 119.6 MB | 121.1 MB | In earlier 20 s smoke runs before the realistic reorder rule (`lastActivityAt` on every update, 20 reorders/s), sampled main-thread JS fell from 12.0 s to 4.5 s per 20 s and long tasks from 71 to 1. In the old code, `mark_reactions` on `overview.threads` cost 3.0 s and forced layouts from `animate:reorder` cost 3.0 s of that. Those smoke runs are not in the table. **#522 scenario** (1000 turns, 4 running subagents with tray and lineage, 40 ms streaming tick, 500-thread sidebar with 6 running status overlays). The real sidebar receives no updates here. | Metric | Before | After | After without `content-visibility` | | --- | ---: | ---: | ---: | | Main-thread busy | 48.07% (47.29–54.87) | 48.09% (38.10–48.92) | 46.86% (46.80–59.15) | | Long tasks/min | 1.50 | 1.50 | 4.00 | | Dropped-frame deadlines | 3.05% (2.74–5.23) | 5.76% (0.60–6.46) | 4.21% (2.93–11.27) | | p95 rAF frame gap | 16.70 ms | 16.80 ms | 16.80 ms | | Style + layout / s | 115.9 ms | 116.1 ms | 112.7 ms | | Paint + pre-paint + layerize + commit / s | 206.6 ms | **129.7 ms** | 204.5 ms | | Delivered ticks/s (target 25) | 24.97 | 24.92 | 24.79 | | Heap after forced GC | 155.8 MB | 156.7 MB | 157.0 MB | **The #522 targets (< 25% busy, < 1% dropped) are not reached by this PR, and its busy and dropped differences are within run-to-run noise.** In that scenario the sidebar is static. With `content-visibility`, sidebar paint, pre-paint and layerize drop by about 75 ms/s. Chromium's internal IntersectionObserver for 500 `content-visibility` rows adds about 40–52 ms/s (0.7–0.9 ms per frame) of `computeIntersections` while frames are produced, versus 2–3 ms/s without it. I kept it because it is net positive in both scenarios and about 10–15 busy points better in the sidebar scenario (20 s A/B: c-v 43.7/49.8%, `contain: content` 48.7/61.9%, none 60.8/65.3%). The cost is +1.4 busy points on a page that renders frames with nothing changing (idle sidebar with rAF harness: 8.6% vs 7.2%). The remaining main-thread JS in the #522 scenario is outside this PR's area, in the thread view's streaming path. Over 120 s, `feed.ts` takes 2.6 s self (`:101` alone 1.30 s, `feedGroup` 0.87 s), and `ThreadState` 2.1 s (`thread-state.svelte.ts:319` 0.78 s, `#event` 0.29 s). The fixture route itself takes 1.56 s (`+page.svelte:64` 0.80 s, its `key` 0.75 s). The `thread-snapshot` reducer takes 0.94 s, of which `:74` is 0.74 s — a linear `findIndex` over about 7,000 items for every delta; `ThreadState` does the same at `:558`. The rAF measuring loop also forces a main frame at every vsync; frame tasks alone are about 290–470 ms/s. ### Behaviour and visual checks - A deterministic 120-event sequence (status, unseen results, questions, background tasks, renames, unread) ran on before and after with the same data and clock. All 13 DOM snapshots of all 500 rows were **identical**: order, `data-calm`, `data-result`, `data-unread`, `aria-current` and row text, including results lingering after 4 s. - Checked in light and dark at 1512 px desktop and in the 390 px phone drawer. Screenshots match before. Keyboard focus rings on rows are fully visible. Measured row heights match the intrinsic-size estimates. - No UI text changed. Copy audit (§8): no new or changed strings, labels, errors or empty states. ### Validation - `bun install`, `bun run gen:check`, `bun run typecheck`, `bun run lint`, `bun run format:check` and `bun run --filter @canopy/web build` passed. - `bun test packages/domain apps/web/test` passed: 166 tests, 849 assertions (pure logic, including the new row, archive and tree tests). - `bunx [email protected] fingerprint:generate --platform <ios|android> --build-profile production --json --non-interactive` gave identical hashes before and after: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. - **Not run:** `bun run check:tmp` and the gRPC integration suites (no gateway or shared-query code changed), mobile JS exports, native runtime/device profiling of the mobile changes, and the macOS Electron renderer. Traces, scripts and screenshots are outside the repository in `/var/tmp/canopy-perf-sidebar/` (`run.mjs`, `qa.mjs`, `attrib.py`, `frames.py`, `table.py`, `runs/`, `qa/`). The local exposure of `OverviewState` and the fixture `ThreadState` on `window` is not committed. Related: #522
nixuuu
added a commit
that referenced
this pull request
Nov 10, 2026
Retain line-aligned output chunks and independent Markdown blocks, reuse feed metadata, and isolate the scroll viewport layout. Paired acceptance recordings remain pending a quiet host window. Related: #522
This was referenced Nov 11, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 11, 2026
…485) Adds a Polish design for GitHub account authorization and pull request workflows, linked from the architecture document. Documentation only; the accepted design stays in this draft PR as the bottom of the implementation stack. **Rebase update (2026-11-11):** the complete stack was rebased bottom-up onto `origin/dev` `48cd5e9c3ce07b7a46873ac40d92819ca847f85a`, preserving #522, #526 and #527. This layer's current CI is green; implementation layers passed typecheck, lint and formatting after conflict resolution. The migration maximum at this layer is **0112 (dev; no stack migration yet)**; this supersedes historical numbering below. Proto generation was repeated in each affected layer (worker git-context fields use 227, preserving dev's file API fields). Final cross-stack security, parity, performance and verification evidence is in #534. Earlier results below describe the pre-rebase implementation. All layers remain draft; native device UI remains unverified. The design uses the official Canopy GitHub App with device flow and expiring user tokens held only on the thread's home gateway. It covers account/repository mapping, automatic many-to-many thread links, shared caching and p95 budgets, additive RPCs, Summary/Timeline/Code views and mobile parity. The v1 scope includes full code review and inline ranges, pending reviews, comment editing/deletion, PR creation with an agent-drafted title/body reviewed by the user, lifecycle and merge actions, metadata editing, CI re-run/cancel and bounded in-app logs. Every mutation requires an explicit user action, durable receipts and uncertain-outcome handling; destructive actions require confirmation. Agents and bots cannot invoke the new integration's mutations in v1. Viewed files use GitHub as the source of truth. Authenticated release lookup is recommended on by default as a fallback after the static CDN index merged in #486. The maintainer accepted one stack covering stages 1–9, with first PR value at stage 2. This documentation PR is the bottom of the stack targeting dev; stage 1 is based on docs/github-integration. The document and all implementation stages remain draft and merge together only after the full v1 is verified, per AGENTS.md. The design is accepted as of 2026-11-10; the feature is not implemented yet. Validation: - `bun run format` and `bun run format:check` passed. Markdown is excluded by the formatter; requirement coverage, document consistency, API references and whitespace were reviewed manually. - `git diff --check` passed. This revision changes only `docs/github.md`; the overall PR contains that document and its link in `docs/architecture.md`. - No implementation tests, builds or browser/device runs were performed for this documentation-only change. Oxlint does not lint Markdown. Copy audit (§8): no runtime UI copy changed. Proposed English action labels and recovery states follow the copy guidelines; light/dark, narrow screens, keyboard and native mobile checks are acceptance criteria for implementation.
nixuuu
added a commit
that referenced
this pull request
Nov 11, 2026
## Stage 1 — accounts **Rebase update (2026-11-11):** the complete stack was rebased bottom-up onto `origin/dev` `48cd5e9c3ce07b7a46873ac40d92819ca847f85a`, preserving #522, #526 and #527. This layer's current CI is green; implementation layers passed typecheck, lint and formatting after conflict resolution. The migration maximum at this layer is **0113**; this supersedes historical numbering below. Proto generation was repeated in each affected layer (worker git-context fields use 227, preserving dev's file API fields). Final cross-stack security, parity, performance and verification evidence is in #534. Earlier results below describe the pre-rebase implementation. All layers remain draft; native device UI remains unverified. Adds GitHub App device authorization to Settings → GitHub on web/desktop and mobile, plus reusable inline Connect GitHub components. Accounts, installations and repositories are owner-scoped; the device code and rotating user token pair are encrypted only on the selected home gateway. A linked computer can start, observe and cancel sign-in on that home without receiving credentials. Includes durable start/poll/cancel/expiry/denial, restart recovery, fenced concurrent refresh, reconnect after revoke/401, disconnect, paginated installation/repository catalogues, Install/Manage links, and explicit selection of an existing owned official GitHub connector PAT without duplicating its token. New account RPCs are additive and capability-gated; account administration is excluded from relay and shared configuration. `update/v1` is untouched. The polish pass groups accounts into one compact list with GitHub avatars/initials, login, muted connection status and complete catalogue counts. Account and installation actions use kit menus (native action sheets on mobile); installations expand with shared accordion motion. Repositories show 5 rows initially, middle-truncated names with full-name tooltips/accessibility labels, muted visibility tags, Show all N and search above 10. Expanded repository lists stay bounded. Connect another account is secondary; the empty state retains primary Connect GitHub. The device card uses the shared clock formatter, including unpadded 12-hour times, and wraps at 320 px. Additive count fields keep totals accurate across catalogue pages; no migration or extra GitHub permissions are needed. The official distribution defaults to the public client ID `Iv23liqSybfDzvusCyjP` and slug `canopy-by-it-sol`. Environment overrides support forks; explicit empty overrides give a calm unconfigured state. Tests use fake IDs and a local HTTP fixture. `docs/github.md` records App ID `5696311`, the registered permissions, their stage/future justifications and updated maintainer steps. No client secret or private key exists or is used. Related: #485. This is stage 1 of the single nine-stage stack, based on `docs/github-integration`. GitHub stack [#488](Stack #488) currently has #485 below this PR, linked with `gh stack link --base dev 485 487`. Both remain draft. Keep every layer draft until the full v1 is verified; do not merge this stage separately. ## Verification - Passed: `bun install`, `bun run gen`, `bun run gen:check`, `bun run typecheck`, `bun run lint`, `bun run format:check`, and `bun run --filter @canopy/web build`. - Focused files run individually against real PostgreSQL/gRPC and local HTTP: `tests/integration/github-accounts.test.ts` (12 tests, now 109 assertions), `github-security.test.ts` (4 tests, 20 assertions), `github-linked.test.ts` (2 tests, 15 assertions), and `packages/db/test/schema.test.ts` (23 tests, 85 assertions). Cover owner/client/device isolation, pending/slow_down/expiry/denial, restart/cancel, concurrent refresh across service instances, uncertain refresh after crash, revoke/second 401, PAT revision changes, in-flight disconnect/cancel, pagination, redaction and absence of credentials in DTO/log/worker/linked payloads. The polish pass reran `TMPDIR=/var/tmp bun run check:tmp tests/integration/github-accounts.test.ts`: 12 pass, 0 fail, 109 assertions; temp cleanup passed, including totals across 101 installations and 10,201 repositories. - Before the UI polish, full `TMPDIR=/var/tmp bun run check:tmp` passed: **2149 pass, 164 skip, 0 fail**, 2313 tests across 390 files; nothing left in the test temp directory. The refresh fixture waits for its initial catalogue before advancing time. After the polish, generation check, full typecheck, root lint, format check and web build were rerun and passed; the full test suite was not repeated. - Mobile: TypeScript and changed-file Expo ESLint passed again, and both Hermes JS exports passed after the final UI edits. Earlier stage 1 verification also passed Expo Doctor 20/20 and clean CNG prebuild; native inputs/dependencies remain unchanged. Full `apps/mobile` lint reports 38 errors and 3 warnings in existing unrelated files (including attachments/hooks); changed GitHub files pass. No native simulator UI session was performed; phone screenshots show the responsive web client. - EAS CLI `27.4.1` production fingerprints are unchanged before/after: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. No dependency or native configuration change. Commands: `bunx [email protected] fingerprint:generate --platform ios --build-profile production --json --non-interactive` and the same with `--platform android`, from `apps/mobile`. The live test was **not run**. All automated GitHub requests in this implementation session used the local fixture. ## Interactive live test for the maintainer From the repository root, with Docker available for the test PostgreSQL store: ```sh CANOPY_LIVE=1 bun test tests/integration/github-accounts.live.test.ts ``` The official public defaults require no additional configuration. Forks can set `CANOPY_GITHUB_APP_CLIENT_ID` and `CANOPY_GITHUB_APP_SLUG`. Confirm Enable Device Flow and expiring user authorization tokens on the app first. The test prints `https://github.com/login/device` and the public user code, then waits. Open that URL in your own browser and enter the code before expiry (about 15 minutes). After authorization it reads the installation catalogue and disconnects the local test account; teardown removes the test store. It never prints device codes or tokens. Full authorization revoke is manual in GitHub Settings → Applications → Authorized GitHub Apps → Canopy by IT SOL → Revoke. Without `CANOPY_LIVE=1`, the test is skipped. ## Browser evidence The polish pass replaced the earlier screenshots. Real browser QA covered light/dark, desktop 1280 px, narrow 800 px, phone 390 px and a 320 px device card; short/typical/long account, organization and repository names; two accounts in one list; avatar failure/initials fallback; account menus and installation action sheets; 51 installations and 51 repositories per installation. Confirmed 5 initial repository rows, Show all loading all 51 into a 288 px scroll area, search finding a repository on the final page, full-name tooltips, 384 px installation scroll after Show all, all device-flow states, code copying, and disconnect with initial Cancel focus. Narrow long-name clipping found during QA was corrected at the installation list's grid boundary. The QA fixture was local; no real authorization was started. Screenshots are local, intentionally uncommitted, in `/var/tmp/canopy-github-1/`: | Coverage | Filenames | | --- | --- | | Desktop | `desktop-light-empty.png`, `desktop-light-pending.png`, `desktop-light-cancelled.png`, `desktop-light-denied.png`, `desktop-light-catalogue-long.png`, `desktop-dark-catalogue-long.png`, `desktop-light-grouped-accounts.png`, `desktop-light-account-menu.png` | | Narrow | `narrow-dark-expired.png`, `narrow-dark-failed.png`, `narrow-light-catalogue-long.png`, `narrow-dark-catalogue-long.png`, `narrow-light-search-last-page.png` | | Phone, dark | `phone-dark-unconfigured.png`, `phone-dark-pending.png`, `phone-dark-success.png`, `phone-dark-catalogue-long.png`, `phone-dark-disconnect-confirmation.png` | | Phone, light | `phone-light-catalogue-long.png`, `phone-light-many-installations.png`, `phone-light-all-51-repositories.png`, `phone-light-code-copied.png`, `phone-light-320-pending.png`, `phone-light-account-menu.png`, `phone-light-installation-menu.png` | ## Copy audit — docs/copy.md §8 | Before → after | Reason | | --- | --- | | `Disconnect` → `Disconnect account` | Names the object; confirmation repeats the action, uses danger styling and focuses Cancel. | | Raw PAT name as action → `Use {name}` | Verb-first explicit opt-in; no silent PAT fallback. | | “token below” → “when available” | Does not promise a fallback when no eligible connector exists; unconfigured state is calm. | | Generic sign-in failure → `Could not check GitHub sign-in. Check the connection, then retry.` | Describes the failure and the next action without raw vendor errors. | | `GitHub account connected.` → muted `GitHub App · Connected` in the account row | Removes the redundant success sentence once the account appears. | | Primary `Connect GitHub` with existing accounts → secondary `Connect another account` | Names the additional-account action; keeps the empty-state primary unchanged. | | Always-visible `Install Canopy` / refresh / authorization buttons → overflow actions, including `Install on another account` | Keeps account rows compact and makes the installation target clear. | | Unbounded repositories / `Load more repositories` → 5 rows, `Show all N`, `Show fewer`, `Search repositories` | States scope and provides reversible expansion; no-match copy names the search result. | | Padded expiry hour → shared time formatter; counts use `1 installation · 1 repo` | Matches existing clock settings and correct singular/plural forms. | Reviewed all new/changed UI strings for sentence case, active voice, one idea per sentence, glossary, verb-first actions, specific empty/error states, no repeated facts, named dependencies and text cues independent of colour/icons. No “soul” sentences added to authentication, errors or confirmation. Short/typical/long content checked at desktop/narrow/phone widths in both themes. Web and mobile use matching actions and states. ## Scope decisions and remaining stages - Documented in `docs/github.md`: stage 1 advertises narrow `github_accounts_v1` only, permits account RPCs over direct authenticated links, and excludes relay. PR read/write capabilities follow their complete stages. Existing mobile owner authorization has no per-method allowlist; the spec now states that accurately. - An expired lease after an uncertain device exchange requires a new code; an uncertain rotating refresh requires reconnect. Neither old exchange is replayed. This avoids reusing potentially consumed credentials. - Stage 2 owns repository-to-account mappings, PAT per-repository permission checks, and the shared REST/GraphQL scheduler/cache/budgets. Stage 1 has bounded HTTP, atomic catalogue snapshots, single-flight, a 15-minute TTL and cooldown. PAT catalogue does not pretend to be a GitHub App installation. - PR views/detection/comments/reviews/lifecycle/metadata/CI controls remain stages 2–9. Deployment previews, security/Dependabot sources, Discussions and Projects are future features; their granted permissions are unused. No stage 1 writes to GitHub repositories. - Migration `0112_github_accounts` is the highest migration on the documentation base (`0111`) plus one; the expected schema list is updated. Renumber it before merge if `dev` gains a competing migration. Whole-stack CI and native device visual QA still need to pass before the nine-stage stack is marked ready.
nixuuu
added a commit
that referenced
this pull request
Nov 11, 2026
) Adds stage 2 of `docs/github.md`: choose a repository account, link or unlink PRs from threads, and read their Summary on web/desktop and mobile. Links are many-to-many; unlink leaves a durable tombstone. **Rebase update (2026-11-11):** the complete stack was rebased bottom-up onto `origin/dev` `48cd5e9c3ce07b7a46873ac40d92819ca847f85a`, preserving #522, #526 and #527. This layer's current CI is green; implementation layers passed typecheck, lint and formatting after conflict resolution. The migration maximum at this layer is **0114**; this supersedes historical numbering below. Proto generation was repeated in each affected layer (worker git-context fields use 227, preserving dev's file API fields). Final cross-stack security, parity, performance and verification evidence is in #534. Earlier results below describe the pre-rebase implementation. All layers remain draft; native device UI remains unverified. ### Behaviour and UI - Desktop opens the PR in the thread’s existing right-hand column. The conversation and composer stay mounted; a browser check confirmed that the same composer node and its draft survive opening/closing the panel. Narrow/phone web uses the existing sheet/dialog; native mobile uses a pushed screen. - Compact header: linked repo/number, two-line title, author avatar fallback/login, relative updated time, mono refs, files/±, icon/state badge, checkout copy chip and overflow actions. Refresh, Open on GitHub, Copy link, Copy PR number and Unlink live in the menu. - Summary uses the existing segmented control. Timeline and Code stay hidden until their stages land. Small components own people, labels, checks and metadata; web and RN share status ordering, wording and label contrast calculations. - Checks are dense linked rows with icon, name, app and right-aligned status. Failures sort first; the summary counts failing/running checks, and long lists collapse after five. Reviewers have avatars/login/state icons; labels retain GitHub colours, choose black/white text by WCAG luminance and cap at four with +N. - Description uses normal message Markdown. Raw HTML stays escaped, unsafe links are rejected, and description images remain explicit links with no automatic image requests. Thread PR rows use the existing compact panel row with state/title/number/checks icon. ### Data and security Shared gateway REST/GraphQL client provides conditional REST ETags, SQL single-flight across processes, per-identity/global concurrency, durable rate accounting/backoff, and bounded shared caches. Cache keys include owner/account/access revision; SQL validates memory-cache reads. Tokens stay encrypted in the home gateway. Linked computers receive only routed DTOs and the small offline mirror; confirmed access loss purges content and clients reject late responses from the previous context. Additive RPCs and thread projections, migration `0113`, regenerated contracts. This revision adds additive coloured-label details while retaining the original string labels for older clients. The frozen update contract is unchanged. Migration numbering was rechecked against `dev` (highest `0111`) and stage 1 (`0112`); no renumbering is needed. ### Scope and decisions Summary reads the first 100 items per source and marks incomplete results. Full pagination, watches/polling and detailed metrics remain stage 4. Manual links sort by upstream creation time; branch highlighting remains stage 3. `docs/github.md` records desktop panel/phone sheet placement, the `pr` URL parameter, two-line titles and hidden future tabs. No external PR mutations or automatic discovery. ### Validation - Passed: `bun install`, `bun run gen:check`, full `bun run typecheck`, `bun run lint`, `bun run format:check`, web build and `git diff --check`. The final native feedback change also passed mobile typecheck. - Fresh full `TMPDIR=/var/tmp bun run check:tmp --max-concurrency 1` was attempted once. It ended with SIGTERM (exit 143) before its final summary/cleanup check; the signal source is not recorded. Before interruption: 851 passing cases, 85 skipped cases, one failure across 148 encountered files. This is **not a clean full local run**. - The only recorded failure was `config-sync-intent.test.ts`, “choosing an alternative preserves its transitive observations across three computers”: the conflict notice did not arrive within 20 seconds (line 42). Neither that test/helper nor configuration-sync implementation differs from stage 1. A fresh, isolated `check:tmp` rerun passed all 3 cases, including the original case in 3.55 seconds, with no temp leftovers. The timeout was not reproduced; its cause remains unconfirmed. - The interrupted process never emitted its cleanup verdict. Its private directory held 20 `canopy-instance-switch-*` directories and 6 empty directories from skipped live suites, plus tool runtime directories. These use deferred scope/process cleanup; interruption prevents a reliable normal-exit leak verdict. The evidence was moved to `/var/tmp/canopy-github-2/interrupted-full-run-temp`; the run’s own Postgres container was identified by its private port descriptor and removed. Other runs were untouched. - Fresh isolated `check:tmp` runs passed `github-pull-requests.test.ts` (5 cases), `github-pr-linked.test.ts` (2), and `github-pr-owner.test.ts` (1), each with no temp leftovers. The file active at interruption, `linked-routes-status.test.ts`, also passed all 5 cases in isolation (127.84 seconds), with no temp leftovers. - CI is green on `efd5c79a7915000e1ac9618b7efda77768701047`: static checks, all four test shards, web/Linux builds, commitlint and the aggregate “Typecheck, tests, builds” check. [CI run](https://github.com/itsoltech/canopy/actions/runs/42832980407). The aggregate also verifies every test file ran exactly once; each shard includes temp cleanup. No review has been submitted. The PR remains draft. - Controlled local GitHub HTTP/GraphQL fixture covers tombstone/restart races, owner/account/cache isolation, offline/revoke, two gateways, ETag 304 and durable backoff. No anonymous production API or live GitHub test was used. Manual browser QA: desktop 1440×1000, narrow 900×900, phone 390×844; light/dark; Open/Merged/Closed/Draft; long titles/refs, 12 labels and 16 varied checks; expanded labels/checks; long Markdown/code/blocked image/raw HTML/unsafe link; compact thread list; menu refresh/copy feedback/unlink; empty list and inline Connect GitHub after disconnecting the fixture account. No horizontal overflow. Clipboard writes show feedback; the browser denied permission to read the clipboard back. Native UI was checked through source/typecheck and fingerprints, not on a device. Screenshots are outside the repository in `/var/tmp/canopy-github-2/`: - `desktop-light.png`, `desktop-dark.png` — thread visible beside the PR. - `{desktop,narrow,phone}-{light,dark}-{open,merged,closed,draft}.png` — complete state/width/theme matrix. - `desktop-light-list.png`, `desktop-light-after-unlink.png`, `desktop-light-unlinked.png`, `phone-light-unlinked.png`. - `phone-light-checks.png`, `phone-dark-checks.png`, `phone-light-markdown.png`. - `{desktop,phone}-{light,dark}-connect.png`. Mobile changes are JS only. `bunx [email protected] fingerprint:generate --platform <ios|android> --build-profile production --json --non-interactive` matches stage 1: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. ### Copy audit — docs/copy.md §8 Raw lowercase check enums → “Passed”, “Failed”, “Running”, “Timed out”, etc., with icons so meaning never depends on colour. Repeated check metadata → one compact row and an aggregate “4 failing · 4 running”. Three bordered actions → verb-led overflow actions; checkout copy uses a small mono chip and toast feedback that does not move content. “Back to thread” → “Close pull request” on the panel. Description heading is quiet; author/title text truncates with full text available. English sentence case, explicit actionable errors, no new glossary synonyms or novelty copy. Long names checked at all three widths. ### Maintainer live check The opt-in test was added and **not run by the agent**. From the repository root: ```sh CANOPY_LIVE=1 bun test tests/integration/github-pull-requests.live.test.ts ``` Enter the printed device-flow code on GitHub with an account whose Canopy installation includes `itsoltech/canopy`. The local test gateway reads PR #485 by default; set `CANOPY_LIVE_GITHUB_PR=<number>` to choose another. It creates only a local thread/link, reads GitHub, and disconnects the local test account during cleanup. It performs no PR writes and never prints credentials. Stack: documentation #485 → account stage #487 → this stage. All layers remain draft until stages 1–9 are complete and verified; do not merge separately.
nixuuu
added a commit
that referenced
this pull request
Nov 11, 2026
Adds stage 3 of the accepted GitHub integration design. Threads discover open and closed pull requests from their checkout's head repository, remote ref and full SHA. Completed successful tool output supplies verified PR URL hints for stacks with different head refs. Unlink keeps its tombstone across discovery and replay. **Rebase update (2026-11-11):** the complete stack was rebased bottom-up onto `origin/dev` `48cd5e9c3ce07b7a46873ac40d92819ca847f85a`, preserving #522, #526 and #527. This layer's current CI is green; implementation layers passed typecheck, lint and formatting after conflict resolution. The migration maximum at this layer is **0115**; this supersedes historical numbering below. Proto generation was repeated in each affected layer (worker git-context fields use 227, preserving dev's file API fields). Final cross-stack security, parity, performance and verification evidence is in #534. Earlier results below describe the pre-rebase implementation. All layers remain draft; native device UI remains unverified. The worker returns normalized read-only git context through the process governor and the additive `git_pr_context_v1` capability; `WORKER_LINK_PROTOCOL` stays at 1. Credentials stay in the gateway. Durable jobs, leases, event watermarks and pagination cursors share the existing account-scoped cache and rate budget. Web/desktop and mobile show Auto/Manual and Current branch/History. Validation: - Local HTTP fixture and real Gateway↔WorkerHost git/worktree tests: detection 6/6, security/replay/cleanup 5/5, existing manual PR tests 5/5; files run individually. - `bun install`, generation check, full typecheck, lint, format check and web build passed. Full `bun run check:tmp` ran exactly once in a fresh process: 2169 pass, 165 skip, 0 fail across 396 files (1101 s), exit 0. It reported no Canopy temp directories left; excluded tool-owned runtime files were reported separately by the runner. - Web browser QA with local fixtures covers light/dark at 1280, 820 and 390 px, short/typical/long titles, branch highlight, Auto/Manual and unlink. Reopening the panel kept the unlinked PR absent. Screenshots remain outside the repository: `/var/tmp/canopy-github-3/desktop-light.png`, `desktop-dark.png`, `narrow-light.png`, `narrow-dark.png`, `phone-light.png`, `phone-dark.png`, `phone-unlinked-dark.png`. - EAS CLI 27.4.1 production fingerprints are unchanged for both iOS and Android. No live GitHub tests were run. - CI is green on `58f8d5ee4d9b41224f09816fdf03b9b4f979cb2e`: all four test shards, static checks, web/Linux builds and the aggregate gate passed. Copy audit (§8): source absent → Auto/Manual identifies how a PR was linked; implicit row grouping → Current branch/History explains the highlight without relying on color. Existing Link pull request and Unlink actions stay verb-first. Discovery messages name the missing match and the manual action. Short, typical and long titles were checked on desktop and phone; no new decorative copy. Design clarifications recorded in `docs/github.md`: cleanup proof from the new client requires a selected PAT with the existing worker grant; device sign-in alone grants no cleanup authority. Tool-output evidence uses a persisted checkout snapshot from before completion and suggests manual linking when that proof is missing. Candidate verification is bounded to ten per batch, with a durable within-page cursor. Stack: based on #501; stage 3 of 9. Keep this PR draft until the whole stack is complete and verified.
nixuuu
added a commit
that referenced
this pull request
Nov 11, 2026
## Change **Rebase update (2026-11-11):** the complete stack was rebased bottom-up onto `origin/dev` `48cd5e9c3ce07b7a46873ac40d92819ca847f85a`, preserving #522, #526 and #527. This layer's current CI is green; implementation layers passed typecheck, lint and formatting after conflict resolution. The migration maximum at this layer is **0116**; this supersedes historical numbering below. Proto generation was repeated in each affected layer (worker git-context fields use 227, preserving dev's file API fields). Final cross-stack security, parity, performance and verification evidence is in #534. Earlier results below describe the pre-rebase implementation. All layers remain draft; native device UI remains unverified. Stage 4 enables Summary, Timeline and Code on web/desktop and mobile. PRs now have paginated timeline/review threads and replies, checks/jobs with lazy in-app redacted logs, and a paginated file list with commit filtering and lazy unified/split diffs. Binary, renamed, truncated and stale-SHA files have explicit fallback states. Viewed remains hidden until stage 5; this stage makes no GitHub mutations. Visible PRs share a watch producer and durable fetch leases; hidden clients stop their streams, reconnect gaps invalidate pages, and active background threads fetch bounded header batches. Linked homes retain verified offline snapshots without mirroring logs. Cache retention, owner quotas and fixed-label metrics cover the new resources. Composer actions prepare bounded, quoted, untrusted attachments through the existing attachment/harness path and never send a message automatically. The release catalog stays CDN-first and can use an administrator's own connected GitHub account for its authenticated API fallback. The visible setting defaults on; missing, expired, disconnected or disabled accounts retain the public update path. Credentials stay in the gateway and are stripped from storage/CDN redirects. Individual check/review states use Tabler outline glyphs with tooltips and accessible labels, including mobile accessibility labels. The PR's primary state stays readable as a compact icon-and-text badge. Aggregate check counts remain text. Thread PR links use quiet source captions and panel rows. Summary/Timeline/Code, checks, logs and the file-list scrollport follow #512's `scroll-stable` helper and balanced padding. The design pass gives Code one compact toolbar for commit filtering, file count, layout, wrap, whitespace and tree view. File rows expand their diff directly below a sticky file header; paths truncate in the middle, renames retain both paths, and binary/large patches have inline recovery actions. Timeline uses a compact event menu and sort toggle, an avatar rail, grouped commits with short SHAs, relative timestamps with absolute-time tooltips, markdown cards and inline review threads with indented replies. Checks and review replies use progressive loading. Shared activity/file presentation and focused components keep web/desktop and mobile aligned; existing thread diff controls retain their defaults. ## Stack and migrations Rebased #485 → #487 → #501 → #508 with `gh stack` onto `origin/dev` at `26f61cce`, including #486's static release index and #512's scrollbar helper. Resolved conflicts, regenerated contracts where needed, checked typecheck/lint/format at each layer, and force-pushed the rewritten layers with explicit leases. All PRs remain drafts and their bases still chain. Dev subsequently advanced with #510, #513 and #515; those changes are outside this completed prerequisite rebase. Renumbered the stack migrations above dev's 0112 in layer order: 0113 accounts, 0114 manual links, 0115 detection, then 0116 full read. Updated the expected schema list and migration registration. Frozen `update/v1` is unchanged; generated additive contracts are committed. No material design deviations. ## Verification - Passed `bun install`, `bun run gen:check`, root `bun run typecheck`, `bun run lint`, `bun run format:check`, and the web build, including final typecheck/build after the sticky-padding correction and mobile typecheck/lint/format after the final mobile reset correction. The build reports the existing chunk-size advisory. Final head `429c46af353546c433e87293dd128910e524c04e`: CI is green. All five layers #485/#487/#501/#508/#518 have SUCCESS check rollups, remain draft, and retain the correct chained bases. No GitHub reviews have been submitted for this stage. - Sequential local fixture files passed: full-read pagination (5 tests), security/composer (5), lifecycle/retention (4), release fallback (4), linked-home offline/cache scope (3), and paired mobile transport (1). Coverage includes >100 timeline/check/thread/reply/job items, 304/429/403, GraphQL partial errors, independent-client single-flight, stream gaps/restart, 300 files/SHA races, log SSRF/redaction/download/page limits, concurrent owner log quota, retention, and authenticated/public release paths. Composer attachments reached the scripted worker blob path. No live tests or anonymous production API calls were used. - Fresh-process full `bun run check:tmp` after the design pass: **2242 passed, 165 skipped, 0 failed**, **25397 assertions**, 2407 tests across 413 files, **1120.32 seconds**; exit 0 and **no Canopy temp entries remained**. Harness-owned runtime entries were listed separately by the runner and removed with its private directory. This rerun includes the earlier cache-eviction correction and linked-home regression coverage. The historical run was 2236 passed / 165 skipped / 6 failed; it is superseded by this clean full run, not relabelled as passing. The final two-file mobile state-reset correction additionally passed focused ESLint, mobile typecheck, root lint/format and native JS exports. - Browser fixture QA: light/dark, desktop 1440×1000, narrow 768×1000, phone 390×844, with 18 new screenshots. Verified grouped commits, inline review threads/replies (3→50→100), event filter/sort, relative-time accessible labels containing absolute dates, folder collapse, long paths, binary notices, long inline diffs and global layout/wrap/whitespace controls. Checks progress 5→50→100→137 using one control. Sticky toolbar/file-header bounds remain flush while scrolling; phone panel has no horizontal overflow. Prior stage-4 fixture QA also covered failing-job logs, huge/truncated/renamed patches, commit filtering and all three composer attachments, including preserving an existing draft when adding a second context. - Mobile JS only: `bunx [email protected] fingerprint:generate --platform ios --build-profile production --json --non-interactive` and the Android equivalent passed. Fingerprints unchanged from stage 3: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Expo Doctor passed 20/20; prebuild passed in a scratch checkout with no package changes; iOS and Android Hermes exports passed, both limited to one bundler worker. Additional mobile ESLint found existing app-wide findings; two findings in the new reset effects were corrected and focused ESLint on those files now passes. Mobile typecheck, canonical repository lint and format checks passed again after that correction. App-wide mobile ESLint still reports 40 errors / 5 warnings in unchanged code and is not claimed green. Native simulator visual QA is unverified: device tools returned “Device list failed: Could not communicate with device support. Try refreshing devices.” Refreshing once produced the same error; no alternate device control was used. Mobile RPC parity is covered over the real pinned, paired and revocable mobile transport. Live GitHub tests remain optional. ### Performance Real gRPC/Postgres fixture benchmark, same scripted GitHub 503 load, stage-3 baseline versus stage 4. 10 warmups and 80 samples per read/ACK operation, 40 dispatch samples. ACK measures committed ACK enqueue, not network round trip. | Existing operation | Baseline p95 ms | Stage 4 p95 ms | | --- | ---: | ---: | | GetOverview | 3.705 | 3.453 | | GetThread | 1.094 | 0.893 | | Send → worker input | 13.466 | 8.095 | | Ingest → ACK enqueue | 2.294 | 2.309 | No material regression observed; ACK's +0.015 ms (+0.6%) is within shared-machine noise. This is a local sample comparison, not a confidence-interval study. Candidate measurements precede the final cache-write byte-accounting and access-error eviction corrections; those change cache misses and GitHub access-error paths, not the measured existing operations or warm-read paths. Warm-read p95: PR 3.091, Timeline 5.392, Checks 4.412, Files 15.145, Diff 14.059, Log 6.460 ms, all below the 50 ms target. Browser/native rendering p95, cold upstream latency and an unavailable-partner performance comparison were not measured; the offline partner behavior has integration coverage. ### Copy audit (§8) Reviewed new/changed labels, settings, errors and empty states against `docs/copy.md`: sentence case, active verbs, glossary, actionable recovery, no decorative prose or duplicate facts. Long check names, branches and paths were inspected at desktop and phone widths. | Before → after | Reason | | --- | --- | | Author login input and separate review section → compact activity menu, inline threads and relative times | Reduce filter weight and preserve chronological context | | Per-file display controls → one shared icon toolbar | Keep file rows focused on paths and changes | | “Show 45 more checks” plus “Next page” → progressive “Show more checks” | One paging pattern transparently loads further pages | | Bare SHA → “on aaaaaaa”; primary state glyph → icon plus “Open”/“Merged”/“Draft”/“Closed” | Clarify the revision and keep the PR's primary fact readable | | Individual “Failed”/“Requested” status text → labelled glyphs and tooltips | More room for names; state remains available to assistive technology | | “Auto”/“Manual” chips → quiet source captions | Reduce visual weight without hiding provenance | | Bordered “Link pull request”/“Show less” → “+ Link pull request” and quiet “Show N more”/“Show less” rows | Match panel row actions | | Generic missing patch → “Binary file”, “File renamed with no text changes”, or explicit size-limit guidance | Explain the actual limitation and recovery | No new glossary term or “soul” sentence. Empty/error text keeps the necessary status words; aggregate counts remain readable text. Icons have distinct shapes and labels rather than relying on colour. ### Screenshot evidence (uncommitted) New design matrix under `/var/tmp/canopy-github-4/`: `{desktop,narrow,phone}-{summary,timeline,code}-{light,dark}.png` (18 files), plus `desktop-code-sticky-dark.png`. Desktop is 1440×1000, narrow 768×1000 and phone 390×844. Phone Code light shows stacked and dark shows split. Existing logs/composer screenshots remain in the same uncommitted directory. Related: #485, #486, #487, #501, #503, #508, #512.
nixuuu
added a commit
that referenced
this pull request
Nov 11, 2026
Stage 5 of the accepted GitHub design adds explicit user comments and GitHub-synced Viewed to web/desktop and mobile. Users can post, reply in existing review threads, edit/delete their own comments, preview Markdown, and see X/N viewed and “Changed since you viewed”. **Rebase update (2026-11-11):** the complete stack was rebased bottom-up onto `origin/dev` `48cd5e9c3ce07b7a46873ac40d92819ca847f85a`, preserving #522, #526 and #527. This layer's current CI is green; implementation layers passed typecheck, lint and formatting after conflict resolution. The migration maximum at this layer is **0117**; this supersedes historical numbering below. Proto generation was repeated in each affected layer (worker git-context fields use 227, preserving dev's file API fields). Final cross-stack security, parity, performance and verification evidence is in #534. Earlier results below describe the pre-rebase implementation. All layers remain draft; native device UI remains unverified. The gateway revalidates owner/account/repository permissions, PR SHA/state and target membership before writing. Durable receipts and audit records bind each request to its authenticated client and parameters; duplicate requests return the receipt. Lost responses become “Couldn't confirm. Check on GitHub” and never replay on reconnect or token refresh. Delete confirmations expire after 60 seconds. Workers and bots are denied. Validation: - Local GitHub HTTP/GraphQL fixture, sequential files: mutation durability (7 tests/48 assertions), security (5/26), paired mobile transports (1/9), linked-home routing (1/7), existing full read (5/35); PostgreSQL schema (23/85). - `bun install`, `bun run gen:check`, typecheck, lint, formatting and web build passed. No live GitHub test or feature API call was used. - Full `bun run check:tmp` ran exactly once in a fresh process: **2255 pass, 165 skip, 1 fail**, 27128 assertions across 417 files. Temp cleanup passed. The failure was a 5-second timeout in the unchanged release dispatch SHA test (`scripts/release.test.ts:175`). That file subsequently passed in isolation: **14 pass, 0 fail**, with the timed-out case taking 984 ms. The full suite was not repeated. - Real-browser fixture QA: post/edit/delete/reply, uncertain result retained across tabs, error rollback, VIEWED/UNVIEWED/DISMISSED, offline-disabled Viewed, long Markdown and sticky scrolling; light/dark, desktop/narrow/phone widths. Screenshots remain outside the repository in `/var/tmp/canopy-github-5/`. Browser evidence covers the web UI used by desktop; native mobile screens and the Electron binary were not visually exercised. Paired pinned iOS/Android transports were tested through gRPC. - Mobile JS only. Production iOS fingerprint remains `6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android remains `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Both exact fingerprint JSON files match their baseline. CI: lower stack layers #485/#487/#501/#508/#518 are green. On this head, static checks, web/Linux builds and shards 1/3/4 passed. Shard 2 failed in the unchanged updater test “a confirmed update can apply the next one”: `readUpdateRecord` encountered an unexpected EOF while reading JSON. The updater test file passed in isolation locally (6 tests, 26 assertions). Failed CI jobs have been rerun; their result is pending. Copy audit (§8): no comment controls → “Post comment”, “Reply”, “Save comment” and “Delete comment”; actions name their effect and delete repeats its verb in the confirmation. Unknown write outcome → “Couldn't confirm. Check on GitHub”, with an explicit source link. “Start a new comment”/“Start a new reply”/“Edit again” explicitly opens an empty editor, without resending the old body. Viewed invalidation → “Changed since you viewed”, with text beyond checkbox colour. Error/offline copy tells users to refresh/check access and preserves the draft. Short/typical/long names and Markdown checked at desktop/narrow/phone widths. No new glossary term or decorative copy. Implementation decisions recorded in `docs/github.md`: advertise the narrower `github_pr_comments_v1` capability until all v1 writes exist; client drafts/uncertain editor state remain in bounded client memory across tab/remounts, while receipts are durable in the gateway. Migration 0118 avoids the in-flight diagnostics migration 0117 and must be rechecked/renumbered against the merge base before merging. Proto changes are additive and `update/v1` is unchanged. Related: #485, #518. Keep draft with the remaining stack stages.
nixuuu
added a commit
that referenced
this pull request
Nov 11, 2026
Implements stage 6 of the accepted GitHub integration: users can select LEFT/RIGHT diff lines and ranges, post a single inline comment or collect a pending review, then submit Comment, Approve or Request changes with a summary. Review conversations support resolve/unresolve and editing/deleting the user's own comments on web/desktop and native mobile. **Rebase update (2026-11-11):** the complete stack was rebased bottom-up onto `origin/dev` `48cd5e9c3ce07b7a46873ac40d92819ca847f85a`, preserving #522, #526 and #527. This layer's current CI is green; implementation layers passed typecheck, lint and formatting after conflict resolution. The migration maximum at this layer is **0118**; this supersedes historical numbering below. Proto generation was repeated in each affected layer (worker git-context fields use 227, preserving dev's file API fields). Final cross-stack security, parity, performance and verification evidence is in #534. Earlier results below describe the pre-rebase implementation. All layers remain draft; native device UI remains unverified. - Reuses stage 5's owner-scoped preflight, durable receipts, audit, confirmation and uncertain/no-replay behavior. The gateway verifies original diff/SHA anchors, the selected account, review/thread ownership and fresh GitHub rights; workers and bots cannot mutate reviews. - Pending comments are paginated and checked against fresh page digests and head SHA before submit/discard. Other-device changes require refresh; outdated comments require acknowledgment. The PR author sees why only Comment is available. - Adds additive generated contracts and the narrow `github_pr_review_v1` capability. Migration `0119_github_reviews.sql` follows stage 5's 0118; diagnostics reserves 0117. Recheck numbering before merging the whole stack. - Keeps the Code diff open across unchanged refreshes, reserves the Viewed icon slot, removes repeated Viewed text, and uses an auto-growing composer without a native resize grip. Validation: dependency install, generated-contract check, monorepo typecheck, lint, formatting and web build pass. Focused local GitHub-fixture integration files pass individually: review 6 tests/77 assertions, security 5/39, mobile 1/15, linked 1/12. The full fresh-process `check:tmp` ran once and passed: 2267 pass, 165 skip, 0 fail, 27016 assertions across 419 files, with no test-owned temporary entries left (tools' runtime cache entries are excluded by the checker). No live GitHub integration API was used. Manual browser checks completed using only the local fixture: desktop, narrow and phone widths; light/dark; exact LEFT/RIGHT range endpoints in unified/split views; all verdicts; pending edits/deletion/discard; push refusal/outdated acknowledgment; author restrictions; conversation resolution; other-device changes; 55-comment pagination; rejected submission with retained summary; and lost-response uncertainty without replay. Browser JavaScript errors were empty. Screenshots are kept outside the repository in `/var/tmp/canopy-github-6/`. Phone verification used browser viewport emulation; native device UI was not exercised. Mobile: Expo Doctor passes 20/20, CNG prebuild succeeds, and both iOS/Android JS/Hermes exports succeed. Production fingerprints are unchanged: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Supplemental Expo ESLint for all new review files passes. The app-wide Expo ESLint command still reports 41 existing errors and 7 warnings in older files; the touched shared `usePages.ts` findings were reproduced from the parent branch. Root repository lint passes. Copy audit (§8): repeated “Viewed” labels → accessible checkbox label/tooltip, because the toolbar already supplies the count; “Changed since you viewed” as a second line → icon with tooltip, to keep rows aligned. New actions use explicit verbs (“Add to review”, “Submit review”, “Resolve conversation”); refusal text explains the next action. Account/repository/PR/SHA appear at the mutation boundary. No new glossary terms or decorative slogans. Short, typical and long fixture content checked at desktop and phone widths. CI is green on this head and every preceding implementation layer (#487, #501, #508, #518, #523); the stage 5 updater rerun passed. No review decision has been recorded. Related: #485, #523. Linked in [stack #488](Stack #488), on top of #523. This PR stays draft until the complete nine-stage stack is verified.
nixuuu
added a commit
that referenced
this pull request
Nov 11, 2026
Stage 7 of the GitHub stack: create a pull request from the thread’s published branch and manage its lifecycle from web/desktop and mobile. **Rebase update (2026-11-11):** the complete stack was rebased bottom-up onto `origin/dev` `48cd5e9c3ce07b7a46873ac40d92819ca847f85a`, preserving #522, #526 and #527. This layer's current CI is green; implementation layers passed typecheck, lint and formatting after conflict resolution. The migration maximum at this layer is **0119**; this supersedes historical numbering below. Proto generation was repeated in each affected layer (worker git-context fields use 227, preserving dev's file API fields). Final cross-stack security, parity, performance and verification evidence is in #534. Earlier results below describe the pre-rebase implementation. All layers remain draft; native device UI remains unverified. The agent drafts only an editable title and Markdown description. Every GitHub mutation requires an explicit user action, fresh owner/account/permission checks and a 60-second confirmation bound to head/base SHA and exact parameters. Workers and bots cannot invoke these mutation RPCs. - Create with base/account selection, draft and fork consent. Durable upstream proof reconciles the local link after a crash without replaying create or restoring a tombstone. A rejected duplicate can suggest a verified existing PR for a separate manual link. - Ready/draft, repository merge methods with editable squash text, required merge queues, auto-merge, merge/rebase branch updates and close/reopen. Accepted queue/update/auto-merge requests are distinguished from merged PRs. - Additive contracts and generated clients, capability negotiation and migration 0120. Recheck numbering before merging the stack: the base ends at 0119 and another branch has diagnostics migration work. - Stage 6 polish: readable line ranges and SHA tooltip, shorter pending-comment form, segmented review verdict and removal of extra diff top padding. The review polish compacts the create target into account/repository/head/base with an inline base picker; account/repository pickers appear only for multiple choices. “Draft with agent” starts one explicit thread turn and fills the title/body fields directly. Only the matching completed answer is imported; extra model fields are discarded and a lost response is never retried. Create and comments share a Markdown editor with preview and an auto-growing field. Create actions stay in a sticky footer with a quiet Cancel. Merge confirmation uses a short SHA with full-value details, allowed-method segments, editable squash fields, a filled primary action and a stable countdown. Changing a method or commit text invalidates confirmation; expiry requires a fresh preflight and another explicit confirmation. Blockers use compact reason labels with complete details and collapse beyond two; disabled Merge exposes the summary. Auto-merge is a small status chip with its off action in the overflow menu. Native mobile uses the same flow and copy. Validation: install, gen:check, full typecheck, oxlint, format:check and web build passed. The new gRPC agent-draft fixture passed 3 tests / 13 assertions, covering matching-turn output, malformed/interrupted answers, ignored model action/account fields, request-ID deduplication and lost-send refusal without replay. Existing lifecycle/create coverage includes binding/expiry, account/push changes, queue/protection/methods, fork permissions, create/link crash+tombstone, durable accepted/uncertain receipts and worker/bot denial. Final `bun run check:tmp` passed in a fresh process on frozen code: 2282 pass, 165 skip, 0 fail, 27491 assertions across 422 files. No managed files remained in the test temp directory. CI state is reported separately for the pushed head; the PR remains a draft. Browser QA used only the local injected GitHub fixture. The review screenshots were replaced for phone-light create with a direct agent draft, desktop-dark squash confirmation and narrow-dark blockers. Additional phone-dark blockers, expanded blockers, phone-light squash, desktop-light confirmation and desktop-dark create/edit/preview screenshots were captured. Markdown preview retains escaping; fields have no resize grip; changing merge methods clears preflight; blocker details and auto-merge overflow were checked. Screenshots remain outside the repository. Mobile typecheck and changed-file ESLint passed. EAS CLI 27.4.1 production fingerprints were regenerated and are unchanged: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Earlier stage validation passed Expo Doctor (20/20), CNG prebuild and both native exports. Full Expo lint has 41 pre-existing errors and 7 warnings outside changed files. Native device UI remains unverified because no usable iOS/Android device host is available. No live GitHub tests were run. Copy audit (§8): “Use an agent draft” plus a separate paste flow → one “Draft with agent” action that fills editable fields; this removes duplicate instructions. Long blocker sentences → “Merging blocked” with short reason labels and complete details on demand; no unavailable review/check counts are invented. “Auto-merge: Merge commit · account” → “Auto-merge on”, with method/account in details. Long expiry instructions → “Confirm within 60 s” with a fixed-width countdown. “Check requirements” still precedes the specific final mutation verb. English sentence-case copy, existing glossary, explicit error next actions, no colour-only cues; checked with typical and long text at desktop, narrow and phone widths. Earlier range/pending-review copy audit remains satisfied. Related: #485 Related: #525
nixuuu
added a commit
that referenced
this pull request
Nov 11, 2026
Stage 8 adds explicit pull request metadata editing across web/desktop and mobile. The header edits the title inline; the description uses the existing Markdown editor and preview. Summary sections open searchable reviewer, assignee and existing-label pickers, with Apply, optimistic updates and rollback. **Rebase update (2026-11-11):** the complete stack was rebased bottom-up onto `origin/dev` `48cd5e9c3ce07b7a46873ac40d92819ca847f85a`, preserving #522, #526 and #527. This layer's current CI is green; implementation layers passed typecheck, lint and formatting after conflict resolution. The migration maximum at this layer is **0119 (no new migration)**; this supersedes historical numbering below. Proto generation was repeated in each affected layer (worker git-context fields use 227, preserving dev's file API fields). Final cross-stack security, parity, performance and verification evidence is in #534. Earlier results below describe the pre-rebase implementation. All layers remain draft; native device UI remains unverified. Review requests support users and organization teams, re-request and removal, exclude the PR author, and explain that GitHub notifies reviewers. Missing Members permission falls back to repository collaborators. The gateway validates every target, requires Issues write for assignees/labels, binds mutations to the owner and authenticated client, and denies worker/bot credentials. Metadata reuses preflight, durable receipts, uncertainty and audit. Conflicts preserve the local draft and show changed lines beside GitHub with an explicit refresh. REST writes are sent once and verified with a fresh read; a lost response, concurrent result or lost verification access remains uncertain without replay. GitHub provides no atomic compare-and-swap for these fields, so a change between the final read and write cannot be ruled out. Additive proto and generated bindings are included; there is no migration (the base remains at 0120). Stage 7 polish includes one updating confirmation countdown, a growing merge description, a clearly disabled Merge button with its blocker tooltip, and the inline base-picker chevron. Validation: - `bun install`, `bun run gen:check`, full `bun run typecheck`, `bun run lint`, `bun run format:check`, and the web build passed. The full fresh-process `TMPDIR=/var/tmp bun run check:tmp` completed in 1283 s: 2291 passed, 165 skipped, one assertion failed; its temp directory check passed. The assertion incorrectly expected NotFound for a valid user outside the repository/organization; the shared GitHub 404 mapping correctly returns PermissionDenied. The assertion was corrected and lint/format passed again. - Metadata gRPC fixture covers owner/repository/user/team/label boundaries, Members fallback, conflicts, revoke, receipts, uncertain results, no replay and worker/bot denial. The complete metadata file passed after the assertion correction: 10 tests, 71 assertions, zero failures and no leftover test temp directories. The full suite was run once; only this affected file was repeated. - Chromium fixture review covered title/description edits, Markdown preview, conflict comparison/refresh, users/teams, re-request/removal, assignees and label colours at 1440, 760 and 390 px in light/dark, plus all four lifecycle polish items. Screenshots are local only: `/var/tmp/canopy-github-8/`. - Expo Doctor passed 20/20, CNG prebuild and both native bundle exports passed. EAS CLI 27.4.1 production fingerprints are unchanged: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Changed mobile files pass Expo ESLint; the full Expo lint command reports 41 errors and 5 warnings in unchanged files. Native device interaction was not exercised. Copy audit (§8): all new controls are English, sentence case, and identify their action. **Apply**, **Refresh fields**, **Check current state**, and the review notification explain the next action and consequence. Conflict/uncertain/access failures provide recovery without promising a retry. Empty/search states are factual. The redundant confirmation labels became one updating “Confirm within 59 s”. Short, typical and long title/branch/label content was checked at desktop, narrow and phone widths; colours retain GitHub values with accessible text contrast. No product comparisons or new terminology were introduced. Related: #528 Draft stage 8 of the accepted nine-stage stack. Keep the entire stack draft until stage 9 and final verification are complete; do not merge this layer separately.
nixuuu
added a commit
that referenced
this pull request
Nov 11, 2026
Stage 9 adds explicit GitHub Actions controls to pull request checks and job/log views on web/desktop and mobile: re-run failed jobs, one job (including dependent jobs), the whole workflow run, and cancel with confirmation. The dialog identifies repository/PR, run, attempt and SHA and explains deployment effects. External CI and missing App/user permissions disable controls with a reason. There is no workflow dispatch, debug logging or force-cancel. All writes reuse fresh preflight inside the shared mutation queue, durable client-bound receipts, owner scoping, structural audit and uncertainty without replay. An Actions 201/202 means **accepted**, while stage 4 watch/polling supplies queued/in-progress/completed states. No network response is treated as workflow completion. Linked CI prepare/write requires `github_pr_write_v1` at both ends; only the home stores the receipt and holds credentials. Successful empty responses are accepted only for POST to the three fixed rerun endpoints with 201, or cancel with 202. The local fixture now sends both null and zero-length bodies. An unexpected empty 200 remains uncertain, and repeating its request ID never replays the write. The reviewer picker now has one pre-checked list. Apply computes removals and additions with separate receipts and verification between writes; uncertainty stops the diff. Re-request is a separate icon on completed reviews in Summary and picker rows. Search placeholders match each picker; teams use the team icon. `docs/github.md` and API/mobile/architecture docs describe the implemented v1 and its limits, available after the whole stack merges. The jobs API exposes no DAG: dependent-job semantics are explained without fabricating edges. Fine-grained PAT permissions cannot be fully introspected; upstream refusal becomes an explicit receipt. Rebased bottom-up onto `origin/dev` **48cd5e9c3ce07b7a46873ac40d92819ca847f85a**, preserving #522/#526/#527, including feed/message optimizations, clone behavior and linked workspace-copy scope. No merge of dev into stage 9. All conflicted layers received typecheck/lint/format; affected proto layers were regenerated in their originating commits. All pushes used force-with-lease. The verified chain is #485 → #487 → #501 → #508 → #518 → #523 → #525 → #528 → #532 → #534; every PR remains draft. Stack: Stack #488. Dev's highest migration is 0112. Unapplied stack migrations are now **0113 accounts, 0114 PR links, 0115 detection, 0116 full read, 0117 mutations, 0118 reviews, 0119 lifecycle**, with the schema registry/tests updated in the originating layers. Stage 9 adds no migration. Diagnostics 0117 is still in flight: renumber affected stack migrations again if it lands first. Worker git-context fields use additive number 227, preserving dev file API 222–226. Frozen update/v1 is unchanged. One dialog host per run survives job-row refresh/reordering and retains the selected job identity after acceptance. Mobile log actions wait for the existing native overlay dismissal callback before opening that shared confirmation. Explicit page refresh waits for an expired Summary, including between reviewer diff writes and before receipt inspection. Validation (draft): - **All ten PRs have green CI, including final #534 head `04c09aa4bf17307ce25b9377638a1c8ae13f9710`** (all four test shards, static checks, web/binaries and aggregate gate). Every PR remains draft; no review decision is recorded. Final-head CI passed without a retry. - `bun install`, generated-code check, full typecheck (Svelte zero errors/warnings), lint, formatting and web build passed. Dialog/refresh changes: **28 fixture integration tests, 234 assertions, zero failures**. Final empty-response/security/linked/pinned-mobile/account integration: **35 tests, 300 assertions, zero failures**. Includes real gRPC and client-bound receipts, not only HTTP mocks. - Final fresh-process `check:tmp` on **04c09aa4bf17307ce25b9377638a1c8ae13f9710** passed: **2,351 pass, 165 skip, 0 fail; 28,245 assertions across 437 files**, exit 0 in 1,340.14 seconds. No source changes occurred during this run; the temp-directory check reported nothing left. No production GitHub feature API or live provider tests were used. - Mobile: Expo Doctor 20/20; changed GitHub files pass Expo ESLint and full mobile typecheck. Production Hermes exports pass on iOS and Android. EAS CLI **27.4.1**, production profile, unchanged fingerprints: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Full Expo lint has 40 pre-existing errors/5 warnings outside this change. - Native device QA is blocked: device discovery on MacStudio twice returned “Device list failed: Could not communicate with device support. Try refreshing devices.” Local iOS/Android runtimes are unavailable. Pinned transport coverage is distinct from native UI interaction. Security and linked routing review: | Mutation RPCs | Owner/binding/preflight | Linked capability and destination | | --- | --- | --- | | BeginGitHubDeviceAuth, GetGitHubDeviceAuth, CancelGitHubDeviceAuth | Owner/home/client-bound attempt, TTL, one durable poller | `github_accounts_v1`, explicit home, direct only | | UseGitHubPat, DisconnectGitHubAccount | Owned connector/account; immediate revocation and cache invalidation | `github_accounts_v1`, account home, credentials never forwarded | | GetGitHubUpdateAccount, SetGitHubUpdateAccount | Owner preference and owned selected account; both RPCs are linked-capable | `github_accounts_v1`, explicit home, no relay | | SetGitHubRepositoryAccount | Owner account/repo identity/install or explicit PAT, expected mapping revision | `github_pr_v1`, repository/account home | | LinkThreadPullRequest, UnlinkThreadPullRequest | Owner thread/PR, verified identity, revision/tombstone | `github_pr_v1`, thread home | | PreparePullRequestContext, GetPullRequestCreateContext, PreparePullRequestDraftContext | Owner thread/PR/account/current SHA/git context; bounded untrusted attachment, no upstream write/model publication | PR read or lifecycle capability as applicable, thread home | | PreparePullRequestMutation, GetPullRequestMutation | Owner PR/account and authenticated browser/device/peer; fingerprint/TTL; receipt lookup binds client | comments capability for shared receipt; CI prepare additionally requires full write; qualified PR/account/confirmation IDs route home | | CreatePullRequestComment, ReplyPullRequestReviewThread, UpdatePullRequestComment, DeletePullRequestComment, SetPullRequestFileViewed | Shared owner/account/access/mapping/head/state preflight; comment ownership, PR-bound thread or file; delete confirmation | `github_pr_comments_v1`; home only, no offline queue | | AddPullRequestReviewComment, SubmitPullRequestReview, DiscardPullRequestReview, SetPullRequestReviewThreadResolved | Shared preflight plus complete pending-review digest, anchor/SHA and upstream viewer permissions; discard confirmation | `github_pr_review_v1`; home only, private review DTOs | | CreatePullRequest | Owner thread, current git context and repository/account; client receipt, confirmation, head/base; uncertain reconciliation only reads | `github_pr_lifecycle_v1`; thread home | | SetPullRequestDraft, MergePullRequest, SetPullRequestQueue, SetPullRequestAutoMerge, UpdatePullRequestBranch, SetPullRequestOpen | Shared preflight plus lifecycle rights, branch/head/base/method/rules and confirmation | `github_pr_lifecycle_v1`; PR home | | UpdatePullRequestDetails, RequestPullRequestReviewers, SetPullRequestAssignees, SetPullRequestLabels | Shared preflight plus current metadata revision; user/team/repo/label ownership; Issues write where needed | `github_pr_metadata_v1`; PR home | | RerunPullRequestChecks, CancelPullRequestCheckRun | Shared preflight plus fresh run/job/repo/PR/SHA/attempt and Actions write/user push; client-bound cancel confirmation | `github_pr_write_v1`; PR home; numeric run/job IDs stay upstream IDs | All mutation handlers deny worker/bot credentials. Writes never use `authorized()` retry; a response loss or abandoned in-flight intent becomes uncertain. Direct-link sender and receiver enforce negotiated capabilities. Relays advertise read-only GitHub capability, so writes fail closed; no offline mutation queue. Credentials and receipts remain at the home. Qualified object IDs are translated at link boundaries; numeric GitHub IDs stay upstream IDs. Reviewed UI handlers, client binding/preflight, routed-home dispatcher, remote policy/IDs, receiver and relay policy. Integration covers foreign owner/run/job/attempt/SHA, stale account/mapping/head, confirmation, old/offline link capabilities, fixed endpoint allowlist and secret-free structural audit. Actions write and Checks read are separate. Whole-stack action parity matrix: **W/D** = web/shared desktop renderer implementation and browser evidence in the named stage PR; no fresh packaged Electron run claimed. **M** = mobile implementation plus pinned transport/security integration where applicable. **B9** = fixture browser QA during this stage, including after rebase. Prior-stage browser evidence is historical, not a claim that every action was rerun post-rebase. Phone-width web is not native mobile. | Actions | Web / desktop renderer | Mobile implementation / transport | Browser evidence | | --- | --- | --- | --- | | Connect, Copy code, Open GitHub, cancel device flow, reconnect | W/D #487 | M, client binding | Historical #487 | | Explicit PAT fallback, disconnect, installation/repository/update-account selection | W/D #487 | M, owned accounts/preferences | Historical #487 | | Link URL, choose repository account, unlink, history/relink | W/D #501 | M, thread/owner/revision | Historical #501 | | Branch/fork detection, refresh, dismiss/tombstone, old/linked worker | W/D #508 | M, negotiation | Historical #508 | | Summary, expand description/people/labels, copy checkout, open GitHub | W/D #501/#518 | M, bounded read DTOs | B9 long title/branch/labels | | Timeline pagination, review threads, refresh, Code unified/split, file/hunk navigation | W/D #518 | M, pagination/security | Historical #518 | | Expand checks/jobs, View logs, log pagination/truncated/unavailable, external provider | W/D #518 | M, bounded logs | B9 jobs/logs | | Ask a question, Explain this PR, Fix findings; attach context and explicitly send | W/D #518 | M, attachment/turn transport | Historical #518 | | Post general comment, reply, edit own comment, confirmed delete | W/D #523 | M, receipts/security | Historical #523 | | Mark/unmark Viewed | W/D #523 | M, file/SHA binding | Historical #523 | | Inline LEFT/RIGHT/multiline; add pending comment | W/D #525 | M, blob/anchor/digest | Historical #525 | | Submit Comment/Approve/Request changes, discard pending review | W/D #525 | M, each verdict/confirmation | Historical #525 | | Resolve/unresolve; edit/delete own review comment | W/D #525 | M, viewer/ownership | Historical #525 | | Create, Draft with agent, review draft, explicit publish, existing PR suggestion | W/D #528 | M, git/context/receipt | Historical #528 | | Ready for review / Convert to draft | W/D #528 | M, lifecycle preflight | Historical #528 | | Merge/Squash/Rebase; join/leave queue; enable/disable auto-merge | W/D #528 | M, rules/head/method | Historical #528 | | Update branch; confirmed close / explicit reopen | W/D #528 | M, lifecycle confirmation | Historical #528 | | Edit title / description | W/D #532 | M, revision/receipt | Historical #532 | | Request/remove user/team with one checked diff; Summary/picker re-request | W/D | M, diff/uncertain integration | B9 desktop light/phone dark, prechecks, user→team diff, Summary re-request | | Set/remove assignees and existing labels; per-picker search | W/D #532 | M, Issues/owned choices | Historical #532; B9 copy/layout | | Re-run failed/all/single job and dependents | W/D | M, shared controller + pinned iOS/Android RPC | B9 confirmation, single write, accepted, queued/running | | Cancel, Keep run, confirmed cancellation; inspect accepted/uncertain without replay | W/D | M, client confirmation/restart | B9 Keep run sends nothing; confirm produces accepted receipt | | External-CI/missing-permission disabled reasons; stale/offline controls | W/D | M, accessible hints/security | B9 external tooltip/permissions; transport failures covered | **Native gap applies to every row:** unavailable runtimes prevent native interaction/visual/p95 verification. Hermes export, RPC integration and phone-width screenshots do not close that gap. No claim of complete native parity QA or merge readiness. Performance vs dev `48cd5e9c`, Ryzen 5 5600X (6 cores/12 threads), Bun 1.4.4. Final-head serial real UI gRPC fixture measurements: **two runs × 250 samples per side**, 5 warmups each, 20 seeded turns; order dev/head then head/dev, with local browser/servers/exports/tests stopped. The table pools 500 observations per side; dispatch ends when both the send RPC and worker startTurn delivery complete, ACK waits for durable EventAck. No providers/production GitHub. Earlier degraded runs pair/close a peer and await one failed GitHub watch attempt before timing; not a sustained active-watch benchmark. | Existing operation, p95 ms | dev | candidate | | --- | ---: | ---: | | Overview RPC | 2.188 | 2.186 | | Thread RPC | 1.018 | 1.020 | | Send RPC + worker startTurn | 8.964 | 8.097 | | Durable-event ACK | 4.265 | 4.410 | | Browser long-thread delta (1,000 turns / 5,005 rows) | 2.3 | 1.9 | | Decode + reducer / 200 deltas, Bun proxy | 14.742 | 14.777 | | Mobile visible slice, Bun proxy | 1.323 | 1.353 | | Markdown, Bun proxy | 4.811 | 6.129 | Browser: 297 DOM nodes both sides, zero gaps/long frames, scroll average 16.67 ms/max 16.8 ms. Preserving #522 corrected the pre-rebase renderer p95/gap regression. Client-JS dataset: 1,000 turns, 7,099 items, 14,085,915 serialized bytes; 999/1,000 unchanged groups retained on both sides. **No-regression gate is not proven.** Final RPC p95 run ranges dev/candidate: dispatch 8.125–9.319 / 7.395–8.419 ms; ACK 4.237–4.299 / 4.165–4.925 ms. Pooled ACK increased 0.145 ms (median 3.384/3.404 ms); Thread increased 0.003 ms. These are descriptive results, not confidence intervals. Final client-JS repeat improved grouping (1.961/1.277 ms), typical turn (0.0369/0.0280 ms) and 5,000 siblings (3.308/3.299 ms), but unchanged-feed p95 (0.893/1.263 ms), markdown (table), new-array cache (30.008/32.702 ms) and cold cache (22.711/24.844 ms) were higher. Cache/sibling metrics have only ten samples (p95 is their maximum); other JS metrics use thirty. Feed/cache source is identical to dev, but that does not establish measured parity. Earlier pairs varied substantially, including markdown 7.128/7.057 ms. No native Hermes timing, cold native TTI or 30-minute soak. These remain explicit wrap-up limitations. Screenshots are local/uncommitted under `/var/tmp/canopy-github-9/`: desktop light checks/re-run-failed/accepted/queued/cancel, desktop dark running jobs/job confirmation, narrow dark checks, phone light logs/re-run-failed/cancel, phone dark job confirmation/accepted/queued, reviewer picker/diff. Final examples: `phone-dark-job-accepted-empty-response-final.png`, `phone-dark-queued-final.png`, `narrow-dark-rerun-all-confirm-final.png`, `desktop-light-cancel-accepted-final.png`, `phone-light-permissions-tooltip-final.png`, `desktop-light-external-tooltip-final.png`, `desktop-light-reviewers-final.png`, `phone-dark-reviewers-after-diff-final.png`, `phone-dark-reviewer-picker-final.png`. Light/dark, desktop/narrow/phone, long repository/branch/reviewer/label text checked. Native gap remains. Browser QA exercised all four CI endpoints; Keep run sent no write. After the HTTP contract fix, single-job acceptance was retested with an empty 201 body. Owned servers and browser tabs were closed after QA. Copy audit (§8): Request/Re-request/Remove modes → one checked selection plus explicit Re-request review; makes current requests visible. Search people, teams or labels → per-picker Search people or teams / Search labels / Search people. Team badge → accessible team icon. Re-run/cancel copy names dependent-job/deployment/whole-run effects; acceptance says waiting for GitHub. English sentence case, direct verbs and existing glossary; no repeated warnings or personality metaphors. Error/stale/offline/empty/uncertain states give a next action without promising retry/success. Text/icons supplement color. One tooltip host; compact overlays and long names remain readable at checked widths/themes. Related: #485, #532 Draft stage 9 of 9. Keep all layers draft. The maintainer merges the complete stack together; native QA and p95 uncertainty above remain open.
nixuuu
added a commit
that referenced
this pull request
Nov 11, 2026
Retain line-aligned output chunks and independent Markdown blocks, reuse feed metadata, and isolate the scroll viewport layout. Paired acceptance recordings remain pending a quiet host window. Related: #522
nixuuu
added a commit
that referenced
this pull request
Nov 11, 2026
Streaming command output replaced a growing text node on every reveal, and the feed repeated key/group projection and map allocation across unchanged history. The snapshot reducer and ThreadState also scanned the entire item history for every delta. This change preserves completed output chunks and independent Markdown blocks, reuses timeline rows, contains layout at the existing scroll viewport, and indexes own items by id. **Draft: performance acceptance not achieved.** On latest-dev baseline `ae09805d2e8c7d218850d07e5d5ae44ccde238bc` versus rebased head `85c3e4a811ae7ad385268ab0d057e894996da516`, two final-series pairs qualified under the agreed host gates. Their after runs measured **34.51% / 34.18% main-thread busy**, above the <25% target; dropped deadlines were **0.57% / 0.53%** and p95 rAF **16.70 / 16.70 ms**. Pair 3 was rejected for a 1796 KiB/s swap-in spike. There are only **2 of the required 3 qualified pairs**. The maintainer designated this the last series in the window, so no further recordings or readiness command were run. CI is green. Earlier rejected attempts remain separately documented below and are not pooled into the result. ### Changes - Render plain output in immutable groups of 32 complete lines; only the trailing group changes. Preserve every byte, whitespace, selection, horizontal scrolling and the existing height cap. Avoid splitting the full output when no tail view is requested. - Re-lex the last Markdown block while independent preceding blocks retain token identity. Use the full lexer for edits, option changes, CR normalization and reference syntax; late reference definitions refresh earlier inline tokens. Existing line-reveal timing, motion tokens and reduced-motion behavior remain intact. - Retain feed rows without allocating a full key map per delta. Reconcile by key when positions change; skip unchanged immutable rows when projecting virtual-feed keys/groups. - Replace the per-event item `findIndex` in the shared snapshot reducer and web `ThreadState` with id → position maps. Replacements reuse the map; appends add one position. Snapshots, history prepends and projected removals/reorders rebuild it. Inherited items never occupy an own-item key. The reducer transfers cache ownership to the next immutable array so reducing an older snapshot branch rebuilds independently; indexes are weakly held and are not serialized. Array copying and downstream feed projections remain linear. - Apply size/layout/style/paint containment to the already constrained, clipped scroll viewport. Keep ResizeObserver, follow-end and reader-intent handling. - Document the rules and measurement requirements in Polish. No sidebar or global-store changes in this PR; the branch now includes merged #526 through `dev`. The shared reducer is also consumed by mobile. No mobile source, native configuration or dependency changes; its JS lookup receives the same optimization. No native runtime profiling or new fingerprint generation was performed in this static-only follow-up. ### Trace findings and acceptance plan Read the full #522 analysis and reused its fixture, `measure.mjs` and `analyse.py`. The exploratory traces still identify growing output layout and whole-document paint as costs; key/group projection and feed reconciliation also appear in CPU samples. All three exploratory timing runs encountered host contention and were discarded for acceptance. Their durations/load differ, so they are not a before/after performance claim. The prepared runner performs **before-1 → after-1 → before-2 → after-2 → before-3 → after-3**, each 120 seconds. The current series is pinned to baseline `ae09805d2e8c7d218850d07e5d5ae44ccde238bc` (latest `dev`, including the GitHub stack and #529–#533) and rebased head `85c3e4a811ae7ad385268ab0d057e894996da516`. Both halves retain all merged changes; the baseline patch reverses only this PR's streaming web changes and shared snapshot reducer. Earlier rejected sessions used older bases and heads; do not pool their results with this series. The runner retains the same #522 1,000-turn fixture, four running subagents, four expanded commands, seeded 500-thread sidebar plus six running rows, and 40 ms agent/tool tick. Chromium inherits `taskset` affinity to two complete physical cores (four logical CPUs); both versions use the same affinity. Affinity does not reserve cores against other processes, so a quiet window and host-log review are still required. Each recording logs loadavg and vmstat before and continuously during the run, along with the measured interval timestamps and CPU affinity. A separate Svelte `$effect` counter pass follows the timing runs. The first session's counter incorrectly included mount/remount initial effects and was inconclusive. The corrected counter excludes the first effect per instance and **passed in the latest session**. Traces were analysed serially after the browser and private stack stopped. The application head is unchanged. The runner now checks preflight and each pair automatically, archives rejected attempts, and stops after three failed preflight probes or three contaminated attempts for a pair; it never marks a PR ready automatically. The acceptance table below contains **only qualified pairs P1 and P2**, in that order. It is a partial two-pair result, not a completed three-pair acceptance. Pair 3 is excluded. Values separated by `/` are individual runs, not an aggregate. | Metric | Before: P1 / P2 | After: P1 / P2 | | --- | --- | --- | | Main-thread busy % | 44.05 / 42.99 | **34.51 / 34.18 — target missed** | | Long tasks/min (>50 ms) | 1.00 / 1.00 | 1.00 / 1.00 | | Dropped compositor deadlines % | 1.56 / 1.51 | 0.57 / 0.53 | | p95 rAF frame gap, ms | 16.70 / 16.70 | 16.70 / 16.70 | | Style, ms/s | 36.11 / 35.68 | 34.45 / 34.48 | | Layout, ms/s | 59.62 / 59.77 | 15.64 / 15.53 | | Paint, ms/s | 48.41 / 48.02 | 38.82 / 38.62 | | Delivered ticks per ~120 s | 2992 / 2992 | 2993 / 2994 | | Used heap P1: first → last; peak MB | 164.0 → 202.7; 234.2 | 164.3 → 183.9; 207.2 | | Used heap P2: first → last; peak MB | 164.5 → 222.4; 244.2 | 165.8 → 222.7; 222.7 | | Follow-end gap, px | 0 / 0 | 0 / 0 | | Reader-anchor drift, px | 0 / 0 | 0 / 0 | Busy is the union of renderer RunTask intervals between trace marks. Dropped frames use compositor deadline markers; rAF does not measure presentation. p95 is reported at the harness's 0.1 ms precision. Memory is sampled used JS heap, not retained heap after GC. Both qualified pairs show less layout and busy time with the full streaming patch; this comparison does not isolate the item index from the output/feed changes. The busy target fails in both qualified after runs, irrespective of the missing third pair. ### Final series and host qualification — 2026-11-11 UTC The maintainer confirmed no other delegate was active. After the initial strict-zero-swap preflight and three earlier pair attempts were rejected, the host gates were explicitly revised **before** this final series: - reject swap-out ≥128 KiB/s in any sample, or cumulative swap-out ≥1024 KiB across both measured halves of a pair; - reject swap-in ≥1024 KiB/s, or ≥128 KiB/s for three consecutive seconds; - retain the CPU gates: loadavg ≥6, or ≥12 runnable with ≤15% idle; - preserve smaller swap reads/writes in the report. The host has about 6 GB of old swapped pages; small reads are not treated as CPU contention. No prior rejected pair was reclassified. Samples are aligned to the logged measurement start/end timestamps, excluding vmstat's since-boot row. Totals below sum the 1-second rate samples and are approximate KiB transferred. Values are **before / after** within each pair. | Final pair | Max loadavg | Max runnable | Min idle % | Swap-in total KiB | Swap-in max KiB/s | Swap-out total KiB | Swap-out max KiB/s | Pair swap-out KiB | Qualification | | --- | --- | --- | --- | --- | --- | --- | --- | ---: | --- | | P1 | 1.64 / 1.60 | 7 / 6 | 75 / 82 | 184 / 848 | 24 / 436 | 0 / 0 | 0 / 0 | 0 | Qualified | | P2 | 1.85 / 1.90 | 8 / 8 | 72 / 77 | 112 / 124 | 16 / 32 | 0 / 0 | 0 / 0 | 0 | Qualified | | P3 | 1.90 / 1.65 | 6 / 8 | 76 / 75 | 48 / 1936 | 8 / **1796** | 0 / 0 | 0 / 0 | 0 | **Rejected** | P3's `after-3` sample at **01:41:22 UTC** recorded swap-in **1796 KiB/s**, 2 runnable and 84% idle, within its 01:40:48.287–01:42:48.601 interval. CPU stayed quiet, but the explicitly agreed swap-in threshold was exceeded, so **both halves are excluded**. P1's isolated 436 KiB/s read did not sustain the 128 KiB/s threshold for three seconds and therefore qualified. No final-series pair was retried. **P3 diagnostic results only — rejected:** | Run | Busy % | Long/min | Dropped % | p95 ms | Style ms/s | Layout ms/s | Paint ms/s | Ticks | Heap first → last / peak MB | End gap / drift px | | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | --- | --- | | before-3 | 42.79 | 1.00 | 1.25 | 16.70 | 34.65 | 59.44 | 47.60 | 2992 | 160.0 → 180.3 / 228.6 | 0 / 0 | | after-3 | 35.43 | 1.00 | 0.60 | 16.70 | 34.46 | 15.67 | 38.65 | 2994 | 156.5 → 195.4 / 226.7 | 0 / 0 | **Next bottleneck from qualified `after-2`:** renderer frame tasks occupy about **280.5 ms/s**. Relevant native stages include **Layerize 50.38 ms/s**, **Paint 38.62 ms/s** (union, excluding nested double counting), visibility intersection processing about **38.6 ms/s**, and style **34.48 ms/s**. Layout is **15.53 ms/s**; script-forced layout is only **31 events / 7.187 ms total** over 120.010 s. Frame tasks include these stages, so the figures must not be summed with their parent. Paint remains rooted at `#document` with a viewport clip; that does not prove every pixel was repainted or identify the subtree that initiated invalidation. The next investigation is frame-wide paint/layer and visibility work, rather than another synchronous follow-end read optimization. The remaining long tasks include Svelte flushes reaching sidebar rows; no sidebar code was changed here. **Behavioral evidence:** all six final recordings observed 0 px end gap and 0 px reader-anchor drift. The separate corrected Svelte probe passed over 200 ticks: zero updates to its 22 mounted completed-history row props, excluding first effects/remounts; each active command row updated 50 times, the active agent row 199 times and the live fold once. This verifies that probe's row-prop isolation, not every application effect. Final artifacts: `/var/tmp/canopy-perf-streaming/acceptance-20261111T012656Z/`, including all six traces/reports, per-pair `host-review.json` snapshots, loadavg/vmstat logs, swap samples, frame-stage breakdown, metrics, anchors and row counters. The private stack stopped; the worktree is clean. No benchmark artifacts were committed. ### Attempts immediately before the final series — rejected, never reclassified `acceptance-20261111T010231Z` stopped before any recording: the original zero-swap gate rejected three preflight probes with mostly 4–16 KiB/s swap-in and 98–99% idle. The maintainer then permitted small swap-in while retaining rejection of **any swap-out**. Under that interim policy, `acceptance-20261111T010651Z` made three attempts at pair 1; all were rejected and remain excluded under their original policy: | Attempt | Swap-in total KiB before / after | Swap-in max KiB/s before / after | Swap-out total KiB before / after | Swap-out max KiB/s before / after | Rejection | | --- | --- | --- | --- | --- | --- | | 1 | 180 / 532 | 24 / 248 | 252 / 8 | 252 / 4 | 252 KiB/s at 01:07:27; after also had two 4 KiB/s writes | | 2 | 7228 / 120 | 696 / 24 | 0 / 12 | 0 / 12 | 12 KiB/s at 01:16:08, 90% idle | | 3 | 164 / 208 | 44 / 32 | 0 / 4 | 0 / 4 | 4 KiB/s at 01:21:38, 91% idle | | Rejected attempt/run | Busy % | Long/min | Dropped % | p95 ms | Style ms/s | Layout ms/s | Paint ms/s | Ticks | Heap first → last / peak MB | | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | --- | | A1 before | 44.11 | 1.00 | 1.24 | 16.70 | 34.90 | 58.54 | 47.36 | 2991 | 163.9 → 201.5 / 235.9 | | A1 after | 34.93 | 1.00 | 0.78 | 16.70 | 35.88 | 15.81 | 39.96 | 2992 | 165.3 → 189.8 / 204.3 | | A2 before | 42.98 | 1.00 | 1.00 | 16.70 | 34.15 | 58.52 | 47.13 | 2992 | 157.6 → 227.1 / 239.9 | | A2 after | 36.17 | 1.00 | 0.69 | 16.80 | 35.56 | 15.76 | 39.40 | 2992 | 162.9 → 190.1 / 203.6 | | A3 before | 42.77 | 1.00 | 0.90 | 16.70 | 34.75 | 58.19 | 47.52 | 2992 | 159.8 → 232.0 / 243.7 | | A3 after | 37.39 | 1.00 | 0.62 | 16.70 | 37.38 | 17.03 | 42.56 | 2992 | 157.9 → 195.0 / 208.2 | All six interim recordings had 0 px end gap/drift. Their raw evidence is in the three `rejected-pair-1-attempt-*` directories; these are not extra qualified pairs for the final series. ### Validation **Latest-dev rebase:** rebased without conflicts onto `ae09805d2e8c7d218850d07e5d5ae44ccde238bc`, keeping both sets of changes. `bun install --frozen-lockfile`, `bun run typecheck`, `bun run lint`, and `bun run format:check` passed on head `85c3e4a811ae7ad385268ab0d057e894996da516`. The initial typecheck exposed a missing local `graphql` dependency from the merged GitHub stack; installing the existing lockfile resolved it. The branch was force-pushed with an explicit lease on its previous remote head. Fixture/counter/runtime patch applicability passed. No product-code changes were needed for the rebase. **Current remote CI on `85c3e4a811ae7ad385268ab0d057e894996da516`: all checks passed**, including static checks, all four test shards, web/Linux build, commitlint and the aggregate check. The previous head's shard-4 failure in linked-computer integration tests is historical; no CI rerun or unrelated code fix was made in this measurement session. **Index follow-up, rebased onto #526:** `bun run typecheck`, `bun run lint`, and `bun run format:check` passed on head `767411e526eb15bdbf469a9138bbcd4d3454fd14`. Rebase completed without conflicts and preserves both documentation sections. Added five pure reducer regressions covering a 7,000-item stream, inherited-id collisions, append/branch isolation, interleaved threads, replacement snapshots, projected reconnect removals and replayed/unknown events. These cases were typechecked but **not run locally**, per the latest instruction to perform static checks only. No build, browser, benchmark or test suite was run in this follow-up. Scratch runner syntax and fixture/counter/runtime patch applicability passed; the runner itself was not started. **Earlier validation, before this follow-up:** - `bun install`, `bun run typecheck`, `bun run lint`, `bun run format:check`, `bun run --filter @canopy/web build` — passed. - `bun test apps/web/test/streaming-render.test.ts apps/web/test/feed-prefix.test.ts apps/web/test/feed-rows.test.ts apps/web/test/work-fold-state.test.ts` — **16 passed, 921 assertions**. These are pure-data tests, including full-lexer equivalence at every streamed character boundary, not UI tests. - Exploratory Chromium checks: **0 px follow-end gap and 0 px reader-anchor drift**. Short/long output, blank lines, tabs and Unicode had identical text, selection, height and scroll extents to the original single-text-node surface. Light/dark screenshots at 1512 px and 390 px were inspected. These establish observed behavior, not acceptance performance. - No UI/E2E suite, full integration/temp suite, native runtime profiling or fingerprint generation was run. Mobile code and native configuration are untouched. Svelte per-row update verification is inconclusive and the accepted paired table remains pending a future quiet-window run. Copy audit (§8): no visible strings, labels, controls or terminology changed. Output is complete; existing truncation and accessible labels are retained. No traces, diagnostic scripts, screenshots or run artifacts are included in the commit. ### Paint/Layerize follow-up from the saved #526 trace Reused the existing analyser on `p2-anim-after-trace.json` from the parallel sidebar work; no browser or new recording was started. Over its 120.027 s interval, the trace records Paint 3,689.574 ms (30.74 ms/s), Layerize 6,640.412 ms (55.32 ms/s), PrePaint 3,662.294 ms and Commit 2,068.552 ms. Paint remains rooted at `#document` with the viewport clip. The four expanded output `<pre>` spans each account for approximately 284–289 ms across the whole recording, nested within root paint; they must not be added to it. Script-forced layouts total only 9.979 ms across 28 events. This narrows the next investigation to document paint traversal/layer preparation and visibility processing after combining #524 and #526. It does not attribute the root cost to the streaming output subtree or establish an improvement for the new indexes. #526 already changes offscreen sidebar rendering on this same document. No additional CSS/layer promotion was introduced from these unpaired observations: the combined head still needs the controlled series, including anchor checks, before attributing residual costs or claiming any performance target. ### Latest indexed-head attempts — REJECTED, not acceptance evidence Session `acceptance-20261110T223545Z`, recorded 2026-11-10 UTC (23:36–23:51 CET). Baseline is merged #526 at `6b1531fe36d7250d29ed79d7d6dab4e4124a70d9`; after is `767411e526eb15bdbf469a9138bbcd4d3454fd14`. Same #522 fixture, 120-second trace windows, CPUs `4,5,10,11`. **Every row below is rejected. No accepted aggregate can be calculated.** | Rejected run | Busy % | Long tasks/min | Dropped deadlines % | p95 rAF ms | Style ms/s | Layout ms/s | Paint ms/s | Ticks | Used heap first → last / peak MB | End gap / reader drift px | | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | --- | --- | | before-1 | 51.71 | 17.50 | 7.55 | 16.80 | 42.05 | 69.02 | 54.12 | 2933 | 159.8 → 165.6 / 228.7 | 0 / 0 | | after-1 | 37.41 | 1.00 | 0.96 | 16.70 | 38.16 | 16.40 | 41.89 | 2992 | 154.8 → 177.7 / 225.3 | 0 / 0 | | before-2 | 43.21 | 1.00 | 1.19 | 16.80 | 35.75 | 60.06 | 48.33 | 2992 | 162.3 → 185.5 / 220.4 | 0 / 0 | | after-2 | 36.26 | 2.00 | 1.06 | 16.70 | 36.73 | 16.47 | 41.28 | 2989 | 155.3 → 205.8 / 219.7 | 0 / 0 | | before-3 | 48.89 | 20.50 | 6.90 | 16.80 | 39.48 | 71.86 | 53.79 | 2920 | 161.1 → 200.4 / 240.9 | 0 / 0 | | after-3 | 37.02 | 1.00 | 0.86 | 16.70 | 36.62 | 16.08 | 40.49 | 2993 | 155.1 → 221.4 / 221.4 | 0 / 0 | **Reasons for rejecting whole pairs (UTC):** 1. Pair 1: `before-1` at 22:36:27–30 had 22–26 runnable, 1% idle and swap-out up to **124,576 KiB/s**; at 22:37:39–41 it had 19–29 runnable and 0–1% idle. These are inside 22:36:05.849–22:38:06.164. 2. Pair 2: `after-2` at **22:46:11** had 23 runnable, 1% idle and 736 KiB/s swap-out. The recording ended at **22:46:11.643**, so the spike is inside the measured interval. 3. Pair 3: `before-3` at 22:48:04–06 had 26–27 runnable and 1% idle; at 22:48:29–33 it had 12–30 runnable, 0–12% idle and swap-in up to 3620 KiB/s. These are inside 22:46:58.759–22:48:59.057. The gates were declared before inspecting results: reject for measured swap I/O, loadavg ≥ 6, or ≥12 runnable with ≤15% idle. Host samples were aligned to each measurement's timestamps; vmstat's initial since-boot average was excluded. **All three pairs independently fail the CPU criterion**, regardless of the smaller swap reads elsewhere. Low pre-run loadavg did not describe the full recording. The retry `acceptance-20261110T225704Z` made **no recordings**: all three preflight probes at 22:57:13–22 failed for swap I/O. The last probe also reached 25 runnable/11% idle and 17 runnable/2% idle. The runner restored the worktree and stopped its private stack. The maintainer then explicitly stopped further attempts until no other agent is active. **Directional interpretation only:** all three `after` runs show lower busy and layout time than their respective `before` runs. This is consistent with a cheaper streaming path, but contention was asymmetric and the patch toggles all of #524, not only the new indexes. Therefore it does **not** isolate the effect of id → position lookup or support a controlled speedup claim. The attribution helper also produced an invalid negative sampled total for the reducer in `after-2`; that estimate is discarded, not reported as a saving. A separate index-only comparison would be needed to quantify that component. The displayed busy figures remain above 25%; dropped deadlines straddle 1%. Rounded p95 is 16.70 ms in the after runs. None of these observations constitutes target acceptance. **Next bottleneck:** native paint/layer preparation remains a substantial cost. In `after-3`, over 120.023 s, Paint is **4859.792 ms (40.49 ms/s)**, Layerize **6293.423 ms (52.43 ms/s)**, style **4394.809 ms (36.62 ms/s)** and layout **1930.511 ms (16.08 ms/s)**. Paint remains rooted at `#document`; nested node timings do not identify the initiating subtree and must not be added to the root. Forced layouts total only **31 events / 6.278 ms**, so synchronous follow-end reads are not the main recorded cost. Feed assembly and ThreadState's derived projections remain visible in samples; the index does not make the whole delta handler O(1). **Behavioral observations:** all six recordings have 0 px follow-end gap and 0 px reader-anchor drift. The corrected 200-tick Svelte row probe passed: no updates to its 22 mounted completed-history row props after excluding initial effects/remounts. Active command rows each updated 50 times; the agent row updated 199 times and the live fold once. This checks row-prop update isolation in that probe, not every effect in the application or performance acceptance. Artifacts remain outside the repo under `/var/tmp/canopy-perf-streaming/acceptance-20261110T223545Z/` and `/var/tmp/canopy-perf-streaming/acceptance-20261110T225704Z/`, including raw traces, reports, attribution output, `host-review.json`, `rejections.md`, host logs and counter results. No product code or commits changed; no test suite or build was run in this recording session. **PR stays draft; the acceptance table above stays pending.** ### Earlier attempts on the pre-index head — REJECTED, not acceptance evidence All rows below are **unaccepted measurements**. Do not average them into an acceptance result or interpret the before/after differences as a controlled performance improvement. Both halves of a pair are excluded when either half is contaminated. Affinity was identical for every run: CPUs `4,5,10,11` (two complete physical cores). Each measured interval was approximately 120 seconds; the requested tick rate was 25/s. | Rejected run | Busy % | Long tasks/min | Dropped deadlines % | p95 rAF ms | Style ms/s | Layout ms/s | Paint ms/s | Delivered ticks | Sampled used heap: first → last / peak MB | End gap / reader drift px | | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | --- | --- | | before-1 | 69.61 | 3.00 | 9.32 | 16.80 | 55.68 | 97.26 | 166.37 | 2985 | 160.1 → 186.9 / 218.4 | 0 / 0 | | after-1 | 59.53 | 8.50 | 9.59 | 16.80 | 53.81 | 23.45 | 164.99 | 2962 | 161.0 → 188.0 / 238.6 | 0 / 0 | | before-2 | 61.03 | 5.00 | 8.22 | 16.80 | 45.25 | 88.75 | 150.19 | 2972 | 163.6 → 233.1 / 233.1 | 0 / 0 | | after-2 | 50.31 | 3.00 | 4.24 | 16.80 | 42.50 | 19.36 | 141.30 | 2991 | 160.6 → 172.3 / 205.7 | 0 / 0 | | before-3 | 66.58 | 3.00 | 10.01 | 16.80 | 51.93 | 95.06 | 162.09 | 2977 | 155.3 → 204.3 / 217.8 | 0 / 0 | | after-3 | 52.60 | 3.00 | 4.71 | 16.80 | 49.89 | 20.54 | 150.26 | 2996 | 163.7 → 226.8 / 226.8 | 0 / 0 | **Rejection evidence (UTC; vmstat logs use CET, UTC+1):** 1. Pair 1: `after-1` overlapped 12–21 runnable processes and only 8–11% idle CPU at 18:32:41–18:32:43; swap-in reached 1152 KiB/s. Its recording interval was 18:31:30–18:33:30. 2. Pair 2: `before-2` hit 25 runnable processes and 1% idle CPU at 18:35:44, despite 96–98% idle before starting. `after-2` independently hit 27 runnable processes and 1% idle at 18:38:44. Both spikes fall inside the respective 18:34:15–18:36:16 and 18:36:59–18:38:59 intervals. 3. Pair 3: `after-3` recorded 30,972 and 68,284 KiB/s swap-out at 18:43:11 and 18:43:12, inside its 18:42:28–18:44:29 interval. The substantial shared-memory pressure invalidates the pair even though CPU was not saturated then. The maintainer explicitly stopped further attempts while the other agents remain active. None of these pairs was retried in this session. The next invocation must repeat all three pairs; the old traces and rejection log remain preserved. **Trace findings, diagnostic only:** - In the three `after` traces, paint costs **141.30–164.99 ms/s**, Layerize **73.56–89.20 ms/s**, style **42.50–53.81 ms/s**, and layout **19.36–23.45 ms/s**. The largest paint spans are rooted at `#document` with the viewport clip. This identifies paint traversal and layer preparation as the next bottleneck to isolate; the trace does not establish which subtree initiated every invalidation, nor prove that every viewport pixel was repainted. - For example, `after-3` records **18,033.54 ms Paint**, **9,643.04 ms Layerize**, **5,987.21 ms style**, and **2,465.22 ms layout** over 120.02 seconds. Per-node paint spans nest inside root spans and must not be added together. Script-forced layout is only **35 events / 11.97 ms total** in this trace, so follow-end's synchronous reads are not the dominant recorded cost. - Script samples still include feed assembly and ThreadState/snapshot traversal: `after-3` has approximately **760.5 ms** self samples in `FeedBuilder.build`, **745.9 ms** in a ThreadState callback, and **640.5 ms** in the snapshot reducer callback. These are sampled estimates, not additive inclusive timings. They are smaller than the native paint/layer stages and do not establish an O(1) delta path. - All six runs observed **0 px follow-end gap and 0 px reader-anchor drift**. The separate 200-tick counter probe saw 200 active-agent row effects and 50 effects for each command. Three completed-history keys each had one effect; initial mounts/remounts were not distinguished by the original probe, so unchanged-row update isolation remains unverified. The observed `after` numbers are above the requested thresholds, but host contamination prevents an accepted pass/fail performance conclusion. **The PR remains draft.** No readiness command was run. Artifacts stay outside the repository in `/var/tmp/canopy-perf-streaming/acceptance-20261110T182822Z/`: six traces/reports, per-run metrics/anchor/inventory/layers, timestamped host logs, `rejections.md`, `row-counters.json`, and `comparison.md`. The ready-to-invoke scratch runner remains `bash /var/tmp/canopy-perf-streaming/run-pairs.sh`; it checks the expected head, restores temporary patches, and never marks the PR ready automatically. No diagnostic artifacts were committed. Related: #522 Related: #526
This was referenced Nov 13, 2026
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.
Busy threads used to repaint shimmering labels and synchronously measure the virtual feed while streaming. Running-work decorations now use compositor transforms/opacity, visible elapsed labels share one clock, and unchanged history/indexes stay out of the streaming update path. The soft highlight, spinners, durations, disclosure motion and reduced-motion behavior are preserved.
Changes
will-change.docs/client-performance.mdand pure data/index regression coverage. No UI test suite or diagnostic artifacts are committed.Maintainer trace
Read-only analysis of the supplied 20.254 s trace (120 Hz recording):
VirtualFeed.svelte/settle(Me,n4KsTDu5.js:42:17016, approximately 931 ms), nativegetPropertyValueundermotion.ts/rootToken(650 ms),AgentMessageBubble.svelte's resize measurement (n4KsTDu5.js:3:1049, 224 ms), nativeoffsetWidth(165 ms) andclipped.ts/measure(B-CkncHS.js:1:286, 127 ms). Embedded compiled source was read to map these sites. Sample weights are estimates, not additive inclusive timings. 206 invalidation-followed-by-script layouts cost 122.08 ms; 36 tasks contained multiple layouts.ARTICLE.t-unfold; without a complete DOM/CSS snapshot and starts for pre-existing animations, the full target inventory andwill-changecount cannot be recovered. The live baseline inventory below supplies steady counts. Spins/pings use CSS transforms/opacity; there is no JS spinner rAF loop in the inspected components. Flag meanings follow Chromium'sCompositorAnimations::FailureReasonenum; unidentified/one-shot effects are not assumed to be the shimmer.buildTimeline, besides 1,219 ms insettle.Reproducible comparison
Linux / AMD Ryzen 5 5600X / Chromium 155 / Bun 1.4.4; 1512 × 949, dark theme, warm Vite fixture. Baseline is
8b6492d84a0c38e4df08f0d6b2e344e99cc4439c. Both runs load all 1,000 turns, four expanded running subagents and their tray, six running sidebar rows alongside the seeded 500-thread sidebar, four elapsed headers, and four expanded commands. A 40 ms interval applies an agent text delta plus a round-robin tool-output delta through the real ThreadState and production components. Requested load is identical; an overloaded baseline delivers fewer ticks. No builds/checks ran alongside these two-minute recordings.The after run processes 17.8% more streaming ticks. Absolute style/layout per second is essentially unchanged; cost per delivered update is lower. The stressed developer build is still 54% busy and misses about 5% of compositor deadlines, so this does not demonstrate fully idle main-thread usage or flawless 60 fps. It removes sustained rAF jank and most long tasks while preserving follow-end. The remaining cost includes growing output layout/paint, the real sidebar feed and tracing/dev instrumentation.
Busy % is the union of renderer-main RunTask wall intervals inside explicit measurement marks. Long tasks are RunTask > 50 ms; dropped % counts trace BeginFrame/DroppedFrame deadlines. Average frame gap comes from rAF, not compositor presentation. Heap is used heap, not retained heap after GC; it includes a growing transcript and dev tooling, so these readings do not establish a leak. This synthetic Linux developer build is not a repeat of the maintainer's macOS desktop workload.
The steady live baseline has 23 CSS animations (5 background-position shimmers, 14 spins, 4 pings), versus 28 after (the 5 shimmers each use two transforms, plus the same spins/pings). There are 0 transitions and 0
will-changeelements in both steady inventories. The inspected after shimmer/spinner layers report “Has an active accelerated transform animation or transition.” Paused offscreen nodes remain mounted and can retain a layer, but their animations stop advancing. An isolated five-second decoration/clock recording paints only 0.51 ms total, with no dropped deadlines; it includes the still-connected dev application and is not a clean CPU-idle benchmark.The after browser run checks that it starts at the end, then records 0 px end gap and 0 px reader-anchor drift during a subsequent three-second stream after a real wheel gesture. Light/dark, 1512 px desktop and 390 px phone screenshots, long-label truncation, offscreen pause and reduced motion were inspected. Headless Chromium kept both tabs visible: hidden-page lifecycle was verified with a simulated
document.hidden/visibility event, and the clock did not advance until resume. Native mobile visuals/runtime profiling and the macOS Electron renderer were not run.Validation
bun install;bun run typecheck;bun run lint;bun run format:check;bun run --filter @canopy/web build— passed.bun test apps/web/test/feed-prefix.test.ts apps/web/test/feed-rows.test.ts apps/web/test/work-fold-state.test.ts— 12 passed, 82 assertions. These exercise pure feed/index state, not UI components. No UI/E2E suite or full integration/temp suite was run.bunx [email protected] fingerprint:generate --platform <ios|android> --build-profile production --json --non-interactive— before/after identical: iOS6ddec9ef559ee0095ac33e94ff9418a942053b17; Android5f6eae3ab278f1cd543e9ed763f923a319b65ec9.Copy audit (§8): visible copy is unchanged (
Working,Working for …,Thinking, durations and unavailable-time placeholders). Existing duration accessibility labels and truncation are retained. Checked short/typical/long labels at desktop and phone widths in light/dark. No new glossary terms, controls, errors or empty states.Artifacts are outside the repository in
/var/tmp/canopy-anim-perf/:analyse.py,measure.mjs,qa.mjs,fixture.patch,maintainer-report.json,before-final-{trace,report,metrics,inventory,layers}.json,verified-final-{trace,report,metrics,inventory,layers,anchor}.json,isolated-animations-{trace,report}.json,qa.json, screenshots and check logs. Earlier exploratory traces are retained separately; the table uses onlybefore-finalandverified-final. The scratch runner temporarily exposes the fixture ThreadState usingfixture.patch; that exposure is removed from the submitted code. The analyser reconstructs X/B/E spans, merges nested timing intervals, samples ProfileChunks, correlates invalidations/script layouts, inventories timer/rAF callers and extracts embedded source text without executing it.Related: #413, #414, #415, #416, #417, #418, #419