Repository navigation
fix(computers): show connectors and schedules for remote threads - #559
Merged
Merged
Conversation
nixuuu
force-pushed
the
fix/remote-thread-panel-parity
branch
5 times, most recently
from
November 12, 2026 12:44
d213735 to
49f2971
Compare
nixuuu
marked this pull request as ready for review
November 12, 2026 12:45
Proxy safe thread panel metadata and worker grants to the home gateway. Persist verified panels for stale reads and include committed mirrors in the paged archive. Related: #543
Allow mirror subscriptions and their acknowledgments to finish at the former home after a move. A saved cursor must receive the removal instead of redirecting the whole subscription. Fixes: #539
nixuuu
force-pushed
the
fix/remote-thread-panel-parity
branch
from
November 12, 2026 13:01
49f2971 to
b98a410
Compare
nixuuu
added a commit
that referenced
this pull request
Nov 12, 2026
Opening or refreshing a pull request could replace content with loaders, lose the current reading state, and repeatedly fetch unchanged resources. Bot actors also lost their identity/avatar, while every check showed three permanent icon actions. Reuse the existing owner/account/access-scoped durable GitHub cache, real REST ETags and SQL single-flight leases. Serve expired pages while revalidating, keep client pages and presentation state across panel reopen, preserve keyed rows and expanded replies, and show skeletons only before the first result. Visible completed/open PRs share one conditional REST request slot every 60 seconds across metadata, check-runs and legacy commit statuses. With one page per resource each endpoint is revisited about every three minutes; this deliberately meets the aggregate five-request budget rather than polling all three every minute. Only resources with running checks get the faster 15-second schedule. Respect upstream x-poll-interval. Merged/closed PRs and hidden panels/windows do not poll. Stream renewals and the maintenance sweep share deadlines and single-flight; hiding the last observer aborts its in-flight probe. Timeline/reviews refresh on metadata changes, files/commits on SHA changes, or through explicit refresh/mutations. Unchanged signals never trigger periodic GraphQL reads. Check changes update the check summary without fetching PR metadata. Preserve payload avatar URLs and bot logins including [bot]. Fetch raster avatars through an authorized gateway RPC and the durable cache, with a fixed CDN allowlist, no credentials or cookies, no redirects, bounded size and timeout. Initials are an opaque fallback. Read-only markdown task boxes keep normal contrast. Replace check icons with a compact labeled action menu, reserved row space, and applicable actions. Apply equivalent loading, avatar and action changes on mobile using TypeScript only; native configuration and dependencies are unchanged. Based directly on dev after #551 was squash-merged and #559 added the remote thread panel. This PR contains only the loading/cache/avatar/check-action changes; the merged resize, diff/commit-picker and timeline layout fixes remain in dev. Rebase resolution preserves the repository account-access controls, Link pull request picker route and all remote connector/schedule RPCs from #559. Validation: - Static implementation and copy review completed; additive protobuf contracts regenerated. - Mobile screen lint correction: extracted the summary/error/retry/account-access notices into `PullRequestNotices`, preserving sibling layout and copy. The complete repository `bun run lint` passes with the 120-line function limit enabled. Local nightly fingerprints before/after the extraction are identical on both iOS (`6ddec9ef559ee0095ac33e94ff9418a942053b17`) and Android (`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`). No native configuration or dependencies changed. - CI Static checks log identified two TS2769 errors at the fixture Request constructors. Explicitly branch between Request and string inputs before calling the overloaded constructor; forward the normalized URL with the original request options to the loopback fixture transport. Regenerated protobuf outputs after resolving the rebase against the merged picker and remote-panel contracts. Extracted the mobile change statistics/checkout row to keep the combined header under the 120-line function limit; rendering and copy remain unchanged. - Added fixture integration coverage for conditional 304 reuse, durable cache after gateway service restart, concurrent single-flight, owner boundaries, bot identity, avatar transport restrictions and no hidden polling. - Added an accelerated-clock fixture measurement for first open, reopen and five visible idle minutes. - bun install and gen:check passed during stack verification. Freshness correction adds fixture coverage for request budgets across 90-second lease renewals plus the maintenance sweep, legacy pending statuses, server poll intervals, completed/terminal transitions, changes-only page invalidation and abort-on-hide. After rebasing directly onto dev: focused gateway/cache/mobile-transport/timeline checks **19 passed, zero failed, 117 assertions**. Changed-file lint and formatting pass. Full tests/typecheck/builds run remotely in CI; no local check:tmp, per maintainer instruction. - Real-browser review used the actual fixture-backed gateway/BFF/web, with one gateway, one web server and one browser. Verified Summary/header including Merge at 320/1200 px, long commits, 2001-row diff, horizontal scroll/wrap, keyboard/reset/persistence, narrow 0/60, mixed timeline with noise removed and claude[bot] using gateway-fetched payload avatars, opaque read-only task boxes, check menus with Re-run / Re-run failed jobs / Cancel according to state, and light/dark desktop plus 390 px phone sheets. No browser requests went directly to GitHub or its avatar CDN. Avatars used opaque red fixture images, not real account images. - Delayed background refresh (1.5 seconds upstream latency) retained 2001 diff rows, expanded state and scrollTop=900 throughout 132 samples: zero diff subtree mutations, no Loading text, no detected layout shifts. Close/reopen retained Code, rows and scrollTop=2300. A new commit resource showed one first-load skeleton region and no visible Loading text. A mocked 503 retained Summary and checks with a compact stale-data message. Added Retry beside stale-data errors in web/mobile; cache expiry alone no longer inserts an offline warning or Retry during background revalidation. - EAS fingerprint engine (@expo/fingerprint, nightly, same project path): iOS **6ddec9ef559ee0095ac33e94ff9418a942053b17**, Android **5f6eae3ab278f1cd543e9ed763f923a319b65ec9**, both identical to the #551 baseline. Mobile changes are JS/TS only; no native configuration or dependencies changed. Native app UI was not exercised; phone coverage above is the web sheet. Request measurements (mock transport, five simulated minutes, fixed +5% jitter): The previously reported **27 → 27** was an **open PR with running checks**, not completed/idle CI. Replaying that exact continuous-stream harness against the previous #555 head (5683f91) produces **19 CanopyChecks + 4 CanopyPullRequest + 4 CanopyTimeline = 27 POST /graphql requests; 27 HTTP 200, zero conditional requests, zero 304**. The old cache avoided reopen work but did not reduce this periodic GraphQL traffic. That was insufficient for the intended freshness policy. The following apples-to-apples comparison includes 90-second stream renewals and a maintenance sweep on every simulated wait, for both versions. Before = previous #555 head, after = this correction. Metadata was already verified during PR linking. Counts cover the visible PR watch, excluding authentication/discovery, avatars and user-triggered tab/file/page loads. Cold validator setup is deliberately counted on first open; unchanged idle traffic after the fix is entirely conditional (If-None-Match). | PR state | First open before → after | Second open before → after | Five minutes idle before → after | Idle before: 200 / 304 | Idle after: 200 / 304 | | --- | ---: | ---: | ---: | ---: | ---: | | Open, running checks | 2 → 3 | 0 → 0 | 23 → 23 | 23 / 0 | 0 / 23 | | Open, completed checks | 2 → 3 | 0 → 0 | 12 → 4 | 12 / 0 | 0 / 4 | | Merged | 2 → 0 | 0 → 0 | 1 → 0 | 1 / 0 | 0 / 0 | | Closed | 2 → 0 | 0 → 0 | 1 → 0 | 1 / 0 | 0 / 0 | | Hidden panel/window, any state | — | — | 0 → 0 | 0 / 0 | 0 / 0 | Endpoint breakdown for that comparison: | State | Before: POST /graphql operations (all 200) | After: conditional REST GETs (all 304) | | --- | --- | --- | | Running | CanopyChecks ×16, CanopyPullRequest ×4, CanopyTimeline ×3 | /repos/itsoltech/canopy/commits/<head>/check-runs ×19; /repos/itsoltech/canopy/pulls/42 ×2; /repos/itsoltech/canopy/commits/<head>/status ×2 | | Completed | CanopyChecks ×6, CanopyPullRequest ×3, CanopyTimeline ×3 | /repos/itsoltech/canopy/pulls/42 ×2; /repos/itsoltech/canopy/commits/<head>/check-runs ×1; /repos/itsoltech/canopy/commits/<head>/status ×1 | | Merged / closed | CanopyPullRequest ×1 each | None | | Hidden | None | None | REST check/status pages use per_page=100&page=1 in this fixture. First-open requests before were one GraphQL Checks and one Timeline; after they are three REST 200s priming metadata/check-runs/status validators (none for terminal PRs). The new watch does not eagerly load Timeline or Checks pages. The renewal-aware baseline differs from the original continuous-stream 27 because the old scheduler/cache deadlines reset on reconnect; both ledgers are reported separately rather than conflated. Targets are met: completed **4 ≤ 5**, merged/closed **0**, hidden **0**; fast running polling is restricted to check resources. Tests also exercise legacy pending statuses, the upstream minimum interval, concurrent sweeps, metadata/check invalidation and last-observer cancellation. No real GitHub product API was contacted. Copy audit (§8): - Repeated “Loading…” messages → first-load skeletons and one reserved header refresh control, so background updates keep content readable. - Three icon-only check controls → “Check actions” menu with “Re-run”, “Re-run failed jobs” and “Cancel”; actions are named and only applicable choices appear. - Ambiguous fallback identity → payload login such as “claude[bot]”; initials remain a visual fallback. - Read failures keep prior content and provide Retry. New wording uses sentence case, short active sentences and existing terminology; no new glossary terms, humour or destructive operations. - Short, typical and long labels reviewed statically and visually at desktop, narrow and phone widths, light and dark. Retry reuses the existing action label. No new glossary terms, humour or destructive confirmations.
This was referenced Nov 12, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 12, 2026
The full desktop hello grew from 32 capabilities in nightly.133 to 33 in nightly.137 when #559 added `remote_thread_panel_v1`. Both versions reject more than 32 as `Unauthenticated: Invalid computer identity`, so an update reconnect can fail after TLS pin authentication succeeds. #573 prevents the false pairing warning, but does not repair this handshake failure. Keep the original nightly.133 capabilities in field 7 (at most 32 entries) and send subsequent capabilities in additive `NodeHello.additional_capabilities` (field 8). Older peers ignore field 8 and keep all their existing configuration, move and update capabilities. New peers combine both fields before negotiation and accept unfixed nightly.137 hellos containing 33 entries in field 7. Bound the combined list at 128 and reject overflow with `InvalidArgument`. Pair requests/responses, connect, welcome and rename broadcasts all use the same encoding. TLS pins, certificate verification and owner scoping retain their existing checks. Added gateway-to-gateway integration coverage using the actual desktop `startComputerLinks` constructor, which enables every production capability: - Complete production pairing, followed by restarting both gateways on their existing databases; compare pins and full negotiated capabilities. - Raw unfixed 33-entry Pair and Connect requests over pinned TLS, plus malformed overflow rejection without changing persisted trust. - Mixed-version pairing in both directions and rename handshakes against the nightly.133 32-entry guard and unknown-field behavior. This fixture emulates the old decoder/validator; it does not run a released desktop binary. Validation: generated protobuf bindings with `bun run gen`; formatted changed source files; `git diff --check` is clean. No local tests, typecheck, lint, build, servers or Docker runs: the maintainer has a performance measurement running and requested CI-only execution. CI must validate the new coverage and repository gates. No UI copy changed. Static investigation and startup/updater/keychain evidence: #573 (comment). The source establishes this release regression in the full desktop configuration; incident logs would be needed to attribute every earlier report or explain successful re-pairing under a different configuration. Fixes: #559 Related: #573
nixuuu
added a commit
that referenced
this pull request
Nov 12, 2026
An update or restart can surface an authentication failure as “Pair again” even when the saved computer identity has not changed. Reconnect now treats RPC authentication failures as retryable and requires repeated, locally verified TLS pin mismatches before requesting new trust. A successful handshake with the saved identity clears stale pairing state. ## Investigation - The dial catch classified **every** `ConnectError(Code.Unauthenticated)` as a pin mismatch. That includes invalid certificate validity, a peer rejecting the client pin, and hello validation; on a manual route it persisted `pairing_required`, and on LAN it deleted the route. This behavior exists in the original linking implementation (#13), before the reported release range. - Reviewed `v0.2.0-nightly.120..v0.2.0-nightly.137` and the `.133` → `.137` diff, including #547, #548, #559, #562, #565, #566 and #546. The full desktop hello grew from 32 capabilities to 33 in #559; both releases reject more than 32 as `Unauthenticated: Invalid computer identity` after pinned TLS succeeds. Merged #574 fixes this capability overflow, including compatibility with the older validator. This branch is rebased onto that fix in `dev`. Full source evidence: #573 (comment). - Identity and the 20-year certificate are persisted in `computer_identity`; the private key uses the existing encrypted secrets key. Desktop keeps the same Canopy data directory, database, app/keychain name and `secrets.enc` across versions and channel changes. Keychain/decryption failure stops startup rather than replacing the identity. Reinstalling while preserving that data preserves trust; deleting it creates a new identity. - Production starts computer links, including loading identity and peers, before opening Network access. There is no demonstrated listener-before-store race in that path. The new readiness guard also makes an early or stopping link service explicitly return `Unavailable`. - `manual` means entered by the user, including a LAN/Tailscale address; it is separate from the network's address type. A bad manual path must not override another route or an incoming connection proving the saved pin. The capability-count rejection is source-proven for the reported version pair's full desktop configuration; incident logs would still be needed to attribute every earlier report or explain successful re-pairing. ## Changes - Use a local `CertificatePinMismatch` signal emitted only after TLS proof of possession and validation of a different self-signed certificate. Override ConnectError's inherited structural `Symbol.hasInstance` check so ordinary RPC errors cannot impersonate this local class. Without this override the new LAN test correctly caught a real route-deletion bug, not test timing. Invalid/expired certificates remain rejected without declaring an identity change. - Exhaust routes first. Require the same different certificate at the same manual route in two consecutive failed rounds. A matching pinned TLS connection or ready incoming link outweighs stale addresses. Only a verified pin mismatch removes a discovered LAN route. Saved pins are never replaced automatically. - Clear confirmation evidence after pinned TLS verification, a successful handshake, explicit pairing, route edits and unlink. Existing successful handshake recovery also clears a persisted `pairing_required` after restart. - Use the shared reason “{name}'s identity changed. Pair again to trust it.” for linked computer availability and app updates, including the relay's name when its identity changed. Remove the contradictory automatic-retry explanation for that state. Add stable auth-failure classifications to diagnostics without logging certificates, keys, addresses or RPC payloads. - Document persistence and recovery. No proto changes, protocol bump or migration. ## Regression coverage Added gateway↔gateway integration scenarios using independent databases and real TLS listeners: 1. Repeated startup `Unauthenticated` on manual and LAN routes preserves trust and resumes; verify the LAN route remains after each attempt. RPC error text cannot impersonate a local pin mismatch, and failed TLS connections cannot confirm a manual route's identity change. 2. An early listener returns `Unavailable` for both `Pair` and `Connect` until ready. 3. Both gateway/core restarts reuse persisted identities/certificates and reconnect; a protocol-1 `.133` hello without new capabilities links with a `.137` hello and resumes after upgrading. 4. A real new key requires confirmed pairing, receives no RPC, never replaces the pin, and has consistent availability/update explanations. 5. A persisted stale pairing state heals after restart; a valid alternate route outweighs a stale manual address with another key. The older-version scenario exercises the compatible wire hello/capability set, not archived app binaries. Installer and OS keychain behavior was inspected in source, not exercised on macOS/Windows. ## Validation - After maintainer clearance, ran only the two authorized test files, sequentially, at `nice -n 19`, using `TMPDIR=/var/tmp` and `bun run check:tmp`: `linked-pairing-recovery.test.ts` **10 pass**, `linked-capability-compatibility.test.ts` **3 pass**. Both temp-directory checks passed. The original LAN failure reproduced before the fix (8 pass / 1 fail); the strengthened assertion confirmed deletion immediately after the first auth failure. - Changed-file formatting and lint passed; `git diff --check` is clean. Earlier dependency install and repository formatting/lint checks passed before the original push. - CI validates generation, full typechecking, all test shards and builds for the rebased head. Browser verification remains pending; the UI change reuses existing components and only changes status explanations. ## Copy audit (§8) “{name} must be paired again” / “Link it again…” / “unavailable, trying again automatically” → “{name}'s identity changed. Pair again to trust it.” The text states the verified problem and the explicit trust action, uses two short sentences and avoids TLS jargon. The compact action badge remains “Pair again”. Names are interpolated as whole values and existing wrapping/layout remains in place; short/long-name checks at desktop/phone widths have not been run yet. Related: #13
nixuuu
added a commit
that referenced
this pull request
Nov 13, 2026
A retained thread panel continued `GetThreadPanel` polling every five seconds while the app was backgrounded. Covered native-stack screens also retained clocks and decorations. Scope recurring work to foreground screen visibility, share countdown ticks, and cancel diagnostics uploads on suspension. A pure-TS lifecycle regression guard covers suspension, resumption, duplicate activity events and teardown. Fixes: #559 Related: #629 | Instrumented path | Before | After | | --- | ---: | ---: | | Visible thread panel, recurring reads/min | 12 | 12 | | Background/covered thread panel, recurring reads/min | 12 | 0 | | 20 mounted request countdowns, foreground timers | 20 | 1 | | Same countdowns, background timers | 20 | 0 | Method: temporary hook instrumentation outside the repository, executing the production query cache and hooks with a simulated 120-second clock. These are timer/request counts, not native CPU, FPS, React render rates, hardware wakeups or battery measurements. No conversation payloads were captured. Native profiling is blocked: T3 Device list and open report `Could not communicate with device support. Try refreshing devices.` Refreshing once did not recover the service. SSH profiling was available, but Android was in `DevLauncherErrorActivity` with zero recorded app frames. Its 0.2% process CPU is therefore excluded as an invalid Canopy baseline. iOS's installed process was at 0.0% in `ps`, also without a verified scenario. No native before/after claim is made. | Requested native scenario, both platforms | CPU / JS+UI FPS / renders/s / wakeups / requests per minute | | --- | --- | | Thread list with 2+ Working threads | Unavailable before and after | | Streaming thread | Unavailable before and after | | Idle open thread | Unavailable before and after | | PR panel | Unavailable before and after | | List idle for two minutes | Unavailable before and after | Inspection found UI/native-thread animation loops, stable list keys, memoized timeline/tree rows, and the existing shared status-label clock. The warmer remains bounded to one request at a time and at most 12 starts/min; unchanged heads do not schedule reads. No hot-message log spam or animated backdrop blur was found. The 24-slice text shimmer and continuous composer geometry sampling still need a native GPU/layout profile. This PR only suspends those paths when hidden/backgrounded; it does not claim to eliminate foreground heating. Validation uses `nice -n 10`: install, gen:check, typecheck, repository lint, format:check and web build passed. The focused lifecycle regression test passed. Both native JS/Hermes exports passed (approximately 12 MB each). Full check:tmp passed on the combined changes: 2,749 passed, 166 skipped, zero failures, and nothing left in the checked temp directory. All CI checks passed at this head. Expo ESLint has pre-existing findings: isolated `dev` baseline 82 errors, changed tree 79, with no new file/rule errors. No UI suites, EAS builds, release builds, publications or native dependency changes. Native fingerprints are unchanged in the same local stable config: - iOS: `74705db3a68907bc28379bb9b1080a227bc0755b` - Android: `7d38be8f5c9bf842d62060c75820a206f99c87e3` UI copy is unchanged. Native visual verification remains blocked by device support.
nixuuu
added a commit
that referenced
this pull request
Nov 15, 2026
## Change Agent-created schedules could stay hidden when a failed thread-details refresh left a cached empty list, even while live updates arrived. Keep the thread stream authoritative for schedules, including desktop remote mode and removal of the last task; use the cached panel list only while the thread's home is unreachable. Subscribe to schedule changes before reading the initial stream controls so schedules created during watch startup are delivered immediately instead of waiting for the periodic refresh. ## Verification - `bun run check:tmp ./tests/integration/thread-schedule-watch.test.ts`: 3 passed, 30 assertions, clean temporary directory. Startup regressions fail before the fix; coverage includes once/recurring creation and cancellation through paired desktop TLS/gRPC. - `bun run --filter @canopy/web typecheck`: 0 errors and warnings. - Scoped formatting/lint and `git diff --check` passed. - Browser inspection with fixture data in light/dark themes at desktop and phone widths: live creation/removal, stale cached lists, offline fallback, and long names. Reproduced the direct-remote panel failure with the original code, then verified the fix with an HTTP 503 panel response and live schedule updates. - No UI copy changes. Full repository checks and builds remain with CI. Fixes: #559 Fixes: #541
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.
The same thread now exposes its home connector access and scheduled tasks from either linked computer. A dedicated display DTO omits credentials, headers, endpoints and account errors. Connector grants, schedule creation, edits and cancellation run at home with owner and revision checks. Worker grants affect every thread on that worker; inherited All workers and account administration show a compact home-management hint.
Verified panel responses survive a restart and remain visible as stale when the home or panel read is unavailable. The archived sidebar now pages local rows together with committed linked metadata: the previous 7 vs 31 counts came from intentionally local-only archive reads.
The three-gateway move regression now reconnects with a saved thread cursor and requires a removal from the old home. The runtime exemption for mirror subscriptions and range acknowledgments is already present in the rebased dev branch; individual thread operations still follow their redirects, and ACKs retain peer/subscription/cursor validation.
Gateway-to-gateway regression coverage exercises safe metadata, schedule create/list/edit/cancel, home enforcement after grant changes, owner isolation, cached stale reads, restart/unlink and archive totals/pagination. Mobile changes are JavaScript/TypeScript only; native configuration and dependencies are unchanged.
Validation:
bun install,bun run gen:check, package-db typecheck and changed-file oxfmt/oxlint passed. No full localcheck:tmpwas run, as requested; CI runs the full checks and test shards.a79d316c) for both platforms: iOS6ddec9ef559ee0095ac33e94ff9418a942053b17; Android5f6eae3ab278f1cd543e9ed763f923a319b65ec9. Mobile changes remain JS/TS only. Subsequent rebases include JS/TS-only mobile changes from dev; fresh CI runs on the final head.Copy audit (§8): hidden sections → visible Connectors and Scheduled tasks; Manage → scoped connector-access dialog with “Changes apply to every thread on this worker.” This states the grant's actual scope. Stale metadata → explicit last-known-details status; account-wide changes → “Manage accounts on ”. New actions use verbs, sentence case and text status cues; no humorous copy. Existing controls provide keyboard/focus behavior and name truncation. Browser review covered short, typical and long names in light/dark at desktop and phone widths, including offline states and dialog scrolling.
Related: #543, #539
Migration coordination: rebased onto
580a4815, including #562 = 0124, #547 = 0125, #560 = 0126 and #557 = 0127. This PR registers0128_thread_panel_cache; the loader and schema expectations list 0124 through 0128 in order. The staged thread-sync upgrade test reads the migration tail dynamically after the explicit 0126 stage, including 0127 and 0128, checks that durable sync state survives, and verifies that repeating the full migration is a no-op. It does not assume 0128 is the latest migration. Focused schema and staged/inherited-access upgrade tests passed again after this rebase (25 tests, 107 assertions); all 6 remote-panel integration tests also passed (63 assertions).bun installandgen:checkpassed. An initial panel test launch resolved a workspace package to another checkout; refreshing installation corrected the local alias before the successful rerun.