Skip to content

Stop dropbox-cli status polling while Dropbox is unlinked - #12988

Open
surim0n wants to merge 1 commit into
omacom:quattrofrom
surim0n:fix/dropbox-login-nonce
Open

surim0n wants to merge 1 commit into
omacom:quattrofrom
surim0n:fix/dropbox-login-nonce

Conversation

@surim0n

@surim0n surim0n commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #12637.

dropbox-cli status mints a brand-new cli_link_nonce on every invocation. The Dropbox widget polls every 60s by default, so any login URL opened from the widget was invalidated before the user could finish authenticating in their browser. The web page still showed success, but the device never linked and the widget stayed greyed out.

Changes:

  • Only call dropbox-cli status when the account is already linked (~/.dropbox/info.json exists and points to a valid path)
  • For unlinked installs, report "Not authenticated" instead of asking the daemon for a status that would rotate the nonce
  • The UI still shows the login prompt and the Log in button works, because the nonce is now stable

Tested:

  • test/shell.d/dropbox-test.sh now includes a regression test that creates a fake dropbox-cli, runs status.py with no ~/.dropbox/info.json, and asserts the fake dropbox-cli is never invoked

Generated with Devin

`dropbox-cli status` mints a brand-new cli_link_nonce on every invocation.
The Dropbox widget polls every 60s, so any login URL opened from the widget was
invalidated before the user could finish browser authentication.

Only call `dropbox-cli status` when the account is linked (`~/.dropbox/info.json`
exists and points to a valid Dropbox path). For unlinked installs, report the
state as "Not authenticated" instead of asking the daemon for a status that
would rotate the nonce.

Fixes omacom#12637.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@llstrk

llstrk commented Sep 23, 2026

Copy link
Copy Markdown

Verified: No actionable regression found in the inspected and synthetic-tested scope at 9389ef16dfa5. The helper now skips dropbox-cli status when local account metadata does not identify an existing account path, removing the polling call implicated in #12637.

Helper state Before This PR
CLI present, no info.json Calls status on each poll No CLI call; Not authenticated
CLI present, existing account path Calls status Same status branch
CLI absent Not installed Unchanged

Synthetic checks also covered corrupt metadata, a missing account directory, and linked-account running, stopped and command-failure responses. Source inspection confirms that Log in remains available when installed and not busy, and still invokes dropbox-cli start independently of the helper's status text.


Review information

Test scope: Pinned source inspection and isolated helper checks with a synthetic CLI. No real Dropbox daemon, browser linking flow or QML execution was tested. The existing account-path heuristic does not establish daemon authentication; relinking with stale metadata remains unverified. The complete shell test file was not run.

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Automated AI review: Astra Medium initial inspection and synthesis, independent Opus 5.5 High and GPT 6 Sol Xhigh technical assessments, followed by verification against source and targeted synthetic evidence.

@sanjyay

sanjyay commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Tested in the Omarchy VM (Omarchy 4.0.4 / Python 3.14):

  • Bug reproduction verified: Confirmed that previously status.py unconditionally called dropbox-cli status on every poll even when unlinked (missing ~/.dropbox/info.json), rotating cli_link_nonce while the user was authenticating.
  • Fix verified: Verified that when unauthenticated, status.py emits statusText: "Not authenticated" and skips executing dropbox-cli status, keeping the login nonce stable. Also verified that linked accounts continue to invoke dropbox-cli status normally and report daemon state.
  • Test suite: bash test/shell.d/dropbox-test.sh passed all 12 assertions.

Works as expected!

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 9389ef1 and reproduced on a disposable Omarchy VM with a real, unlinked Dropbox daemon (dropbox 270.4, installed for the test). With the base status.py, every poll ran dropbox-cli status and returned a different cli_link_nonce each time, which is the rotation #12637 describes. With this branch, repeated polls made no dropbox-cli call at all and reported "Not authenticated". With a linked info.json, it still asked the daemon for status. dropbox-cli start still prints a link URL with the daemon running, so Log in is unaffected. Nothing found that needs changing.

Tests on the VM: ./test/cli passed, and test/shell.d/dropbox-test.sh passed 13 of 13 with the shell running from this branch. The new regression test fails when status.py is reverted to the base version, so it does test the fix.

Second opinion from Codex Medium. It agreed the fix is proportionate and in the right place. Its independence is not guaranteed. It added one side effect worth knowing: with the account unlinked, running is now always false, so the panel's P shortcut runs dropbox-cli start instead of stop on a running daemon. The pause toggle it drives is hidden while unlinked, so I left it as is.

For the maintainer: #8499 takes the login URL from this same status poll while the account is unlinked, so the two cannot both land as written. Once this merges, #8499 would get "Not authenticated" where it expects the URL. This change is the one that matches #12637. #11955's faster polling during a pending link depends on the poll not rotating the nonce, which this provides.

Waiting on the maintainer.

@omarchybot

Copy link
Copy Markdown
Collaborator

#15135 has been merged to quattro and fixes #12637 the same way this pull request does. While no account is linked, status.py no longer runs dropbox-cli status, so the poll stops minting a new cli_link_nonce and voiding the URL that Log in opened. It also reads whether the daemon is running from ~/.dropbox/dropbox.pid, so a running daemon that isn't linked yet shows as running with "Waiting to be linked to a Dropbox account" rather than as stopped. Its tests in test/shell.d/dropbox-test.sh include the case this one tests, where dropbox-cli must not be called while unlinked. Now that it has merged, this branch conflicts in both files.

I compared the two diffs against quattro as the merge left it and found nothing here that quattro still lacks. The executable bit on dropbox-test.sh is the only change #15135 doesn't make, and it has no effect because test/shell runs each file with bash. Asked the same question with both diffs, Codex Medium and muse-wonder (pi, thinking high) each found nothing left to keep. Their independence from my reasoning isn't guaranteed. omabot's separate close check, which asks the second opinion from the diffs alone, didn't confirm it, so I've left this open rather than closing it. Whether to close it is the maintainer's call.

@surim0n, thank you for tracking down the nonce rotation. Nothing is waiting on you here.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dropbox widget's 60s status poll rotates the link nonce, breaking its own Log in button

4 participants