← Back to Pull requests

Let people add a computer from the computer itself #146

Merged
ethanteng merged 24 files (1588 lines) on Nov 23, 2026 02:52 UTC
View on GitHub
ethanteng ethanteng commented on Nov 22, 2026 19:15 UTC
Author

Why

Adding a computer was confusing: two pairing methods ran in opposite directions and were offered as equals, the flow hopped between the laptop, a phone and the host, and the one prerequisite (the host reachable from other computers, even at home) was only mentioned after it failed. The audit with screenshots is here: https://claude.ai/artifact/Hc5ZGQ2r19B11h1fkTQvGX

Separately, Computers on the live host listed "Uncloud from Ethan's MacBook Pro" under Folders your computers offered. That was an echo of All of your files, stopped on the host but still set up on the Mac, and clicking Keep it here would have started syncing everything again.

What changed

Mac app (SetupWindow)

  • After finding the host, one button: Sign in to connect, which opens the approval page in this Mac's browser. Scanning with a phone is a secondary link.

  • Waiting states say what they're waiting for, with a progress bar. "Other ways to connect" is hidden while waiting.

  • New "This Mac wasn't added" screen when someone says no.

  • When the host is found but unreachable, the app says to turn on Access From Anywhere and who can do it, then keeps looking and carries on by itself.

  • Address entry and the pairing code moved under Other ways to connect. A pairing link from the web shows only the name field and Connect.
  • Approval page (web)

  • It's now a page of its own instead of a card on top of Computers.

  • Signed out, the sign-in page reads "Sign in to add a computer".

  • New Don't add button.

  • Opening the link again after answering shows what was answered, not "Couldn't find that computer".
  • Computers (web)

  • A reachability line comes first, from the new GET /api/sync/reach. Admins get a link to Settings; others are told who to ask.

  • The steps match the app's wording and include Mac download links.

  • No header button while the add panel is already the page.

  • Open in the Uncloud app hands a pairing code to the app on desktop browsers that aren't the host.

  • Pairing code and Syncthing setup are under Other ways to connect. The code shows the address other computers use.

  • Offers are renamed Shared from Syncthing and moved below What stays in sync.
  • Server

  • PairingRequests:

  • - An approved or declined request stays readable to whoever answered it until it runs out (state: waiting / added / declined).
    - New Decline; the computer's answer can carry declined: true.
    - Answered requests no longer count against the waiting limits.
  • POST /api/sync/pairing-requests/{id}/decline.

  • SyncService.StatusAsync drops offers whose folder ID this host made (uncloud-…). These are echoes of stopped folders; the Mac app never creates folders of its own.
  • Naming: "Reach From Anywhere" is now "Access From Anywhere" in the Mac menu, the iPhone app's messages and the docs, matching the Settings switch.

    Compatibility

  • Older Mac apps against this server: a declined request comes back as declined: true, which they ignore. On their next poll they get 404, so they show a fresh QR code. Approval works as before.

  • This app against an older server: declined defaults to false and the app never calls the new endpoints.
  • Testing

  • dotnet test: 497 passed. New tests cover decline, answered states, answered requests not counting against the limits, echoed offers, and an HTTP-level decline through PairingClient.

  • Web: npm run build, and vitest 172 passed. Approval tests were rewritten for the focused page, and new Computers-page tests were added.

  • swift test for UncloudKit: 38 passed, after the string rename.

  • Clicked through on a local, isolated server: approve, reopening the link, Computers, the pairing code, and the phone-width signed-out sign-in.

  • The Mac app's new screens were rendered off-screen and checked by eye. Not yet run end to end with a packaged app build, which is worth doing before release.
  • Not in this PR

  • Renaming the computer on the browser and QR paths. Only the pairing-code path has a name field.

  • A newly added computer still shows "Not connected right now" and "Up to date · 0 files" until it first connects.
  • 🤖 Generated with Claude Code

    Diff: 1588 lines (+1197 / -391) across 24 files Reviewer: ethanteng Review duration: 457m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.91) × (1 − Review Confidence (0.77)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.91 · 1588 lines diff across 24 files
    0.91
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.82 · 4 substantive comment(s)
    0.82
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    76%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Self Review self_review
    0.140
    Mass File Touch mass_file_touch
    0.080
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    7 items
    vercel[bot] vercel[bot] commented on Nov 22, 2026 19:15 UTC
    Bot

    [vc]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21taXRTdGF0dXMiOiJJR05PUkVEIiwicHJldmlld1VybCI6InVuY2xvdWQtYmFja3VwLWdpdC1jbGF1ZGUtYWRkLWMyMTI5NC1ldGhhbi10ZW5nLWNvbnN1bHRpbmctbGxjLnZlcmNlbC5hcHAifV0sInJlcXVlc3RSZXZpZXdVcmwiOiJodHRwczovL3ZlcmNlbC5jb20vdmVyY2VsLWFnZW50L3JlcXVlc3QtcmV2aWV3P293bmVyPWV0aGFudGVuZyZyZXBvPWhvbWViYXNlJnByPTE0NiJ9
    The latest updates on your projects. Learn more about Vercel for GitHub.

    | Project | Deployment | Actions | Updated |
    | :--- | :----- | :------ | :------ |
    | <a href="https://vercel.com/ethan-teng-consulting-llc/homebase"><sup><img src="https://vercel.com/api/www/avatar?projectId=prj_zEs6XaRrS3tzitv0UnsELYVYhQAk&teamId=team_xLXDpIOs1pK3jkr6PExoAET8&s=32" width="16" height="16" align="middle" alt="" /></sup></a> homebase | !Ready Ready | Preview | <relative-time datetime="2026-11-22T19:59:40.653Z">Nov 22, 2026 7:59pm UTC</relative-time> |

    <details><summary>1 Skipped Deployment</summary>

    | Project | Deployment | Actions | Updated |
    | :--- | :----- | :------ | :------ |
    | <a href="https://vercel.com/ethan-teng-consulting-llc/uncloud-backup"><sup><img src="https://vercel.com/api/www/avatar?projectId=prj_o0NxtaBEtryvNpCZiqof3jKiLHG1&teamId=team_xLXDpIOs1pK3jkr6PExoAET8&s=32" width="16" height="16" align="middle" alt="" /></sup></a> uncloud-backup | !Ignored Ignored | Preview | <relative-time datetime="2026-11-22T19:59:40.653Z">Nov 22, 2026 7:59pm UTC</relative-time> |
    </details>

    <a href="https://vercel.com/vercel-agent/request-review?owner=ethanteng&repo=homebase&pr=146" rel="noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://agents-vade-review.vercel.sh/request-review-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://agents-vade-review.vercel.sh/request-review-light.svg"><img src="https://agents-vade-review.vercel.sh/request-review-light.svg" alt="Request Review"></picture></a>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 22, 2026 19:15 UTC
    Bot

    <!-- codex-pull-request-review-summary -->
    <!-- codex-review-state:v1 {"code_review":{"commit_sha":"dda913523fdcfef95ed71ab37571786b81d31bd5","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} -->

    <details>
    <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary>

    This comment shows the latest Codex review activity on this pull request.

    | Review | Status | Commit | Review trigger |
    | --- | --- | --- | --- |
    | 📝 Code Review | ✅ Completed <relative-time datetime="2026-11-22T19:16:46.467179Z">2026-11-22T19:16:46.467179Z</relative-time> | dda9135 | PR opened |

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review" or "@codex security review".
  • Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

    </details>

    </details>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Nov 22, 2026 19:16 UTC
    Code Review
    src/Homebase.Core/Sync/PairingRequests.cs:1
    @@ -136,26 +157,57 @@ public async Task ApproveAsync(string? id, string userId, Func<string, string> r
             }
         }
     
    +    /// <summary>
    +    /// Says no to a computer that asked, so it stops waiting and says it wasn't added. Final: the
    +    /// same code can't be approved afterwards, by this person or anybody else. Saying no twice is
    +    /// harmless; saying no to a computer already added is refused, since it's syncing by then.
    +    /// </summary>
    +    public void Decline(string? id, string userId)
    +    {
    +        lock (_requests)
    +        {
    +            if (Find(id) is not { } request) throw Gone();
    +            if (request.DeclinedBy is { } declinedBy)
    +            {
    +                if (declinedBy == userId) return;
    +                throw Gone();
    +            }
    +            if (request.Result is not null)
    +                throw request.ApprovedBy == userId
    +                    ? new LibraryException(
    +                        "That computer is already added. To stop it syncing, open Computers and click Remove next to it.", "conflict")
    +                    : Gone();
    +            request.DeclinedBy = userId;

    <sub><sub>!P2 Badge</sub></sub> Serialize decline with in-flight approvals

    If the same request is open in two browsers or tabs, a decline can succeed while ApproveAsync is awaiting Syncthing operations: approval holds _approving, but decline only locks _requests, and Result remains null until approval finishes. Approval then continues pairing the device and sharing folders despite the successful decline, while Answer prioritizes DeclinedBy and tells the desktop it wasn't added. Serialize both decisions through the same gate, or atomically reserve the decision before approval starts its side effects, so the host cannot retain an added computer that both interfaces report as declined.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 22, 2026 19:16 UTC
    Reviewer

    <!-- codex-review-receipt:v1 -->

    💡 Codex Review

    Here are some automated review suggestions for this pull request.

    Reviewed commit: dda913523f

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review".
  • If Codex has suggestions, it will comment; otherwise it will react with 👍.

    Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    </details>

    ethanteng ethanteng commented on code on Nov 22, 2026 19:20 UTC
    Code Review
    src/Homebase.Core/Sync/PairingRequests.cs:1
    @@ -136,26 +157,57 @@ public async Task ApproveAsync(string? id, string userId, Func<string, string> r
             }
         }
     
    +    /// <summary>
    +    /// Says no to a computer that asked, so it stops waiting and says it wasn't added. Final: the
    +    /// same code can't be approved afterwards, by this person or anybody else. Saying no twice is
    +    /// harmless; saying no to a computer already added is refused, since it's syncing by then.
    +    /// </summary>
    +    public void Decline(string? id, string userId)
    +    {
    +        lock (_requests)
    +        {
    +            if (Find(id) is not { } request) throw Gone();
    +            if (request.DeclinedBy is { } declinedBy)
    +            {
    +                if (declinedBy == userId) return;
    +                throw Gone();
    +            }
    +            if (request.Result is not null)
    +                throw request.ApprovedBy == userId
    +                    ? new LibraryException(
    +                        "That computer is already added. To stop it syncing, open Computers and click Remove next to it.", "conflict")
    +                    : Gone();
    +            request.DeclinedBy = userId;

    Fixed in 795c4de: decline is now \DeclineAsync\ and waits on the same \_approving\ gate as \ApproveAsync\, so a no arriving mid-approval is refused as already added; a new test holds Syncthing mid-pair to prove it (and fails without the gate).

    _🤖 Addressed by Claude Code_

    cursor[bot] cursor[bot] commented on Nov 22, 2026 19:39 UTC
    Reviewer

    <!-- CURSOR_AUTOMATION_ID: 290fdf38-8d34-11f1-a7d1-d6b4613131ce | RUN_ID: bc-4e0641ea-d667-41e6-aa28-477938ed6667 -->

    Cursor second-pass review

    This PR makes adding a computer one path: the Mac asks, someone signs in on that Mac (or scans a QR code) and says yes or no, and Computers says up front whether other computers can reach this Uncloud. Decline and approve share one gate, so a no cannot land in the middle of a yes, and the person who answered can open the same link again and see what they decided. The page, the Mac client, and the new routes agree. Two bugs are fixed on this branch; what is left is small. The packaged Mac app still has not been clicked through against a host, which the description already calls out.

    Cross-layer check: Server (PairingRequests, SyncService, GET /api/sync/reach, POST /api/sync/pairing-requests/{id}/decline), the web app (PairApproval, SyncPanel), the Mac setup window, and the “Access from anywhere” wording on iOS. No schema change and no migration. GET /api/sync/pairing-requests/{id} returns { name, expiresAt, state } with state of waiting, added, or declined. The computer’s answer adds declined. Reach is { address } or null. Those match the web types and PairingClient. /api/sync/pairing-requests stays behind a session: the anonymous prefix /api/sync/pair is a different path segment, so it does not cover decline or describe. Ship the host as one deploy so the page and these routes arrive together. The Mac app can ship before or after that: an older app ignores declined and then sees the request gone; this app never calls decline on an older host. The iOS copy change does not depend on either.

    Fixed:

  • Major — src/Uncloud.Desktop/SetupWindow.cs:343. Cancel, and “Sign in on this Mac instead”, rebuilt the waiting row with the same button. Avalonia throws once a control already has a parent, so the first Cancel, or the switch from the phone to this Mac, broke the window. Each wait now gets a new Cancel button. c182d28

  • Major — src/Homebase.Core/Sync/SyncService.cs:240. Computers hides a stopped uncloud-… folder a computer still offers, but POST /api/sync/folders/accept would still start that folder again. Accept now returns conflict for those ids. The existing stopped-folder test covers it. e4b2070 (this environment has no .NET SDK, so that test was not run here)
  • Remaining findings:

  • Minor — src/homebase-web/src/SyncPanel.tsx:351 and :332. “You’re signed in as …” appears only after a pairing code exists, and Open in the Uncloud app mints a code with no such line. A code already issued keeps working after sign-out. Show SignedInAs before Get a pairing code, and beside Open in the Uncloud app.

  • Minor — src/homebase-web/src/App.tsx:505. The add-computer page is shown before the host folder is known. An admin who has not chosen a folder yet gets the question instead of setup, and approving fails because there is no folder. Account on that page also drops the request. After the library loads, if this admin still needs a folder, show setup first and keep approving so the question appears once the folder exists.
  • Verdict: APPROVE WITH NITS

    <div><a href="https://cursor.com/agents/bc-4e0641ea-d667-41e6-aa28-477938ed6667?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/automations/290fdf38-8d34-11f1-a7d1-d6b4613131ce"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/view-automation-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/view-automation-light.png"><img alt="View Automation" width="141" height="28" src="https://cursor.com/assets/images/view-automation-dark.png"></picture></a>&nbsp;</div>

    <sub>Sent by Cursor Automation: Automatic PR code reviews (personal projects)</sub>

    Reviewers
    Assignees
    ethanteng ethanteng
    Labels
    risk: low confidence: 76.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 90.5% (HIGH) · Higher = larger blast radius
    90.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 76.5% · Lower = rushed or shallow review
    76.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 21.2% · Safe to merge
    21.2%