Repository navigation
Stop the Dropbox status poll from voiding the pending login link - #15135
Conversation
`dropbox-cli status` asks an unlinked daemon for a link URL every time, and the daemon answers each ask with a fresh nonce, so the widget's poll replaced the URL Log in had just opened while the user was still signing in. While no account is linked, read whether the daemon is running from its pid file instead, the same check dropbox-cli makes. Fixes #12637
[Medium impact] The PR appears safe to merge, with the earlier non-blocking status-message concern still open. Findings
SummaryPrevents Dropbox status polls from replacing a pending login link.
Reviews (2) · Last reviewed commit: "Cover a stale info.json naming a missing..." · Reviewed by Greptile |
| if dropbox_cli and not authenticated: | ||
| # `dropbox-cli status` asks an unlinked daemon for a link URL, and each ask voids the one Log in opened. | ||
| running = daemon_running() | ||
| status_text = "Waiting to be linked to a Dropbox account" if running else "Stopped" |
There was a problem hiding this comment.
Missing folder hides actual status
If an already-linked account’s sync folder is unavailable, such as when its drive is disconnected, authenticated becomes false. This new branch then skips dropbox-cli status and shows “Waiting to be linked to a Dropbox account” for a running daemon. That misleading message makes the folder problem harder to diagnose.
Choose whether to skip the CLI from the account metadata, separately from whether the folder is available for scanning.
info.json can outlive an unlink, so the poll's guard has to rest on the folder existing, not on info.json naming an account; a guard on the account path alone would bring the nonce rotation back while Log in is showing. Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed and verified at f44aca4. Nothing in the fix needed changing. I added one test case. Reproduced on a worker built from the Omarchy ISO, with Tests: with the worker's shell serving this branch, Pushed: f44aca4 adds a case to Greptile's note on The second opinion was Codex Medium, over two rounds. It found no defect, independently of my conclusion only as far as its read-only access to this session allows. It did name the missing-folder test gap that f44aca4 closes. This now waits on the maintainer. |
quattro's Dropbox status tests (omacom#15135) landed in the same place as this branch's scan checks. Keep both, and run the scan checks through the shared dropbox_status helper and its temporary home so the file has one EXIT trap instead of two. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
quattro grew its own status.py fixture in dropbox-test.sh (omacom#15135), so the regression now uses that fixture instead of a second temp dir and EXIT trap, and drops the assertion that grepped status.py for PLAN_QUOTAS, which the repository's testing rules forbid. The file keeps quattro's 100644 mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…com#15135) * Stop the Dropbox status poll from voiding the pending login link `dropbox-cli status` asks an unlinked daemon for a link URL every time, and the daemon answers each ask with a fresh nonce, so the widget's poll replaced the URL Log in had just opened while the user was still signing in. While no account is linked, read whether the daemon is running from its pid file instead, the same check dropbox-cli makes. Fixes omacom#12637 * Cover a stale info.json naming a missing Dropbox folder info.json can outlive an unlink, so the poll's guard has to rest on the folder existing, not on info.json naming an account; a guard on the account path alone would bring the nonce rotation back while Log in is showing. Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Omarchybot <317366263+omarchybot@users.noreply.github.com> Co-authored-by: Codex Medium <noreply@openai.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit b628987)
While Dropbox is installed but not linked, the widget's Log in button opens a
cli_link_nonceURL, and the status poll then voids it before the user has finished signing in.status.pyrunsdropbox-cli statusevery 60 seconds (and every 2 seconds for up to 30 seconds after the shell starts), anddropbox-cli statusalways calls the daemon'sneeds_link, which answers an unlinked daemon with a freshly minted nonce each time. A browser sign-in with an account picker or 2FA routinely takes longer than one poll, so the page reports success against a nonce that no longer links anything and the widget stays grey.While no account is linked,
status.pynow leavesdropbox-cli statusalone and decides whether the daemon is running from~/.dropbox/dropbox.pidand its/procentry, the same checkdropbox-cli runningmakes. Its status text is the one the daemon would have given, "Waiting to be linked to a Dropbox account". It still runs on every poll, so the widget notices the link the momentinfo.jsonnames an account, and from then on it asks the daemon for its status as before, which no longer mints anything because a linked daemon has no link URL to hand out. The condition is the sameauthenticatedthat decides whether the panel shows Log in, so the poll stays away from the daemon exactly when that button is reachable.test/shell.d/dropbox-test.shruns the helper against a stubdropbox-cli: unlinked, it must not be called whether the daemon is stopped or running; linked, it must be.Fixes #12637