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mZHVEZW42TCIsIm5leHRDb21taXRTdGF0dXMiOiJJR05PUkVEIiwicHJldmlld1VybCI6InVuY2xvdWQtYmFja3VwLWdpdC1jbGF1ZGUtYWRkLWMyMTI5NC1ldGhhbi10ZW5nLWNvbnN1bHRpbmctbGxjLnZlcmNlbC5hcHAifV0sInJlcXVlc3RSZXZpZXdVcmwiOiJodHRwczovL3ZlcmNlbC5jb20vdmVyY2VsLWFnZW50L3JlcXVlc3QtcmV2aWV3P293bmVyPWV0aGFudGVuZyZyZXBvPWhvbWViYXNlJnByPTE0NiJ9
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>
<!-- 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
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>
<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 -->
<!-- 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
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>
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_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:
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. c182d28src/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:
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.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> <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> </div>
<sub>Sent by Cursor Automation: Automatic PR code reviews (personal projects)</sub>
ethanteng
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)Approval page (web)
Computers (web)
GET /api/sync/reach. Admins get a link to Settings; others are told who to ask.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 carrydeclined: true.- Answered requests no longer count against the waiting limits.
POST /api/sync/pairing-requests/{id}/decline.SyncService.StatusAsyncdrops 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
declined: true, which they ignore. On their next poll they get 404, so they show a fresh QR code. Approval works as before.declineddefaults 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 throughPairingClient.npm run build, and vitest 172 passed. Approval tests were rewritten for the focused page, and new Computers-page tests were added.swift testfor UncloudKit: 38 passed, after the string rename.Not in this PR
🤖 Generated with Claude Code