Skip to content

Keep the Dropbox panel polling until the account link completes - #11955

Open
procrypto wants to merge 5 commits into
omacom:quattrofrom
procrypto:fix-dropbox-link-wait
Open

procrypto wants to merge 5 commits into
omacom:quattrofrom
procrypto:fix-dropbox-link-wait

Conversation

@procrypto

@procrypto procrypto commented Sep 15, 2026 •

Copy link
Copy Markdown

What you see

After linking Dropbox in the browser, the panel can keep showing "Login to Dropbox" for up to a minute, inviting another click.

Live testing on Omarchy 4.0.3 with client 268.4.4124: the polling change reduced the observed delay from 32 seconds (after a second click) to 4 seconds without another click.

Why

Service.qml refreshes status when the panel opens, once, one second after dropbox-cli start exits, and every 60 seconds. It does not watch for the browser step to finish.

On the tested client, the unlinked daemon opens the browser itself but does not answer its command socket, so dropbox-cli start returns no link URL. Completion polling therefore cannot depend on capturing one.

What changed

  • Poll every 3 seconds for up to 5 minutes after opening a link URL or a successful no-URL start; stop when authentication is confirmed.
  • Show "Finish linking in your browser" while waiting. Another click reopens a captured URL or simply keeps waiting—never issuing another start or resetting the deadline.
  • Keep timeout failures in a separate linkError. They survive unlinked polls but clear on retry or authentication, including late success, without erasing unrelated command failures.
  • Replace source-text assertions with behavioral QML coverage for repeat clicks, repeated polling, timeout, late success, retries, and panel error state.

Verified: bash test/shell.d/dropbox-test.sh passes with Wayland runtime coverage exercised; waiting, timeout, and recovered panel captures inspected. No new qmllint diagnostics; existing import/type warnings remain.

Second-click issue

dropbox-cli start trusts ~/.dropbox/dropbox.pid. If missing or stale, it can fork a second daemon that takes over the pidfile and command sockets: the panel reports "Starting..." while the original keeps syncing. Reproduced by moving the pidfile aside; it did not go stale during the normal link tests. Details: #11954.

This PR only prevents additional starts during an already-pending link. Initial Login, Resume, and retries after timeout retain the existing launch path; the underlying stale-pidfile issue remains unresolved.

Related PRs and issues

After the login button ran dropbox-cli start, nothing watched for the
link to finish. The service refreshed once, a second after the command
exited, and then waited for the periodic timer, up to a minute by
default. The panel sat on "Login to Dropbox" after the browser flow had
succeeded, which invites a second click.

The current client makes this worse: an unlinked daemon does not answer
its command socket, so dropbox-cli start prints no link URL at all. The
daemon opens the account-link page in the browser itself. So the wait
has to start on the click, not on a URL the panel may never see.

Poll every 3 seconds for up to 5 minutes after any login attempt, and
stop as soon as a status poll reports a linked account. While that wait
is pending the login row reads "Finish linking in your browser", and if
a URL was captured a click reopens it instead of starting the flow
over. If the daemon never confirms the link, say so.

Measured on Omarchy 4.0.3 with client 268.4.4124: before, the panel was
still on the login prompt 28 seconds after the link landed; after, it
flipped within 4 seconds.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@procrypto
procrypto force-pushed the fix-dropbox-link-wait branch from 74381d1 to c4f6366 Compare September 15, 2026 15:37
A pending login still issued another dropbox-cli start when no URL had
been captured, which is the behavior of the client measured for this PR.
Guard all pending links: reopen a known URL or keep waiting without
another launch or a deadline reset. This reduces the repeated-click
exposure described in omacom#11954; it does not repair the launch path.

The timeout also cleared linkPending before storing its failure in
shared actionStatus, leaving that failure visible after late success.
Store it separately as linkError, clear link state on authentication or
a fresh wait, and render the failure with the panel's error color.
Completing a link no longer clears unrelated action errors.

Replace source-text wiring assertions with an isolated Quickshell
fixture exercising real QML timers, process callbacks and panel bindings.
The CLI, status helper, HOME and browser boundary are isolated from the
user's account. Cover repeated clicks with and without a URL, repeated
polling and termination, timeout persistence, late success and retry.

Verified the focused suite on Wayland and inspected waiting, timeout and
linked panel captures. The fixture rejects the original repeat-click bug,
the old pending-only completion guard, and removal of fast polling.
Standalone qmllint diagnostics match the original draft's baseline.
@llstrk

llstrk commented Sep 28, 2026

Copy link
Copy Markdown

Automated AI review

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

Verified: after a Login click, with or without a captured link URL, the service polls status every 3 seconds and stops as soon as authenticated is true, instead of waiting for the 60-second refresh. Pending clicks never run another dropbox-cli start and never reset the 5-minute deadline. The timeout message is kept in linkError, survives unlinked polls and clears on retry or late success, without touching unrelated actionStatus errors. The new Quickshell fixture exercises the real Service.qml and Panel.qml, fails on the base code, and caught 10 of 11 targeted mutations. The PR merges cleanly onto current quattro and the fixture passes there.

Two behaviours are worth a look: the faster poll multiplies calls that an open issue reports rotate the link nonce, and the no-URL wait also starts after a failed start.

The 3-second poll multiplies calls that #12637 reports rotate the link nonce

Each linkWait tick calls refresh(), which runs status.py, which always runs dropbox-cli status. In the dropbox-cli source (nautilus-dropbox 2024.04.17 and current upstream), status calls needs_link whenever the daemon answers its command socket. Open issue #12637 reports that each such call mints a new cli_link_nonce and invalidates the previous one: the browser shows success, but the device never links.

Base already runs dropbox-cli status about 1 second after start exits (delayedRefresh), then on the 60-second refresh. During the link wait, head runs it every 3 seconds for up to 5 minutes: about 100 calls where base makes about 6. With a fake CLI that answers like the daemon in #12637 (synthetic, no real daemon or account):

         dropbox-cli calls, seconds from shell start (Login click at 1.48)
base     start 1.48   status 2.51   (then the 60 s refresh, per source)
head     start 1.48   status 2.51, 4.51, 7.51, 10.51, 13.51, ...

A second click on head reopened the URL captured from start, although the fake daemon had issued two newer nonces by then (five by the end of the 14-second run). login() always reuses _loginUrl.

Impact: repeated rotation while the user is still in the browser is a plausible way for linking to fail on daemons that answer the socket, and "Click to reopen the Dropbox page" reopens the URL from start. The exact effect is unknown: the reporter of #12637 says raising the refresh interval to 3600 seconds worked around it, although that code also makes the 1-second call, so the reported model is incomplete. The daemon's nonce behaviour was not verified here. The client measured in the PR description did not answer its socket, so status never reached needs_link there. #10940 reports the same client version (268.4.4124) producing a cli_link_nonce URL during login and dropbox-cli status reporting that it is waiting to be linked, so a daemon that answers does occur with this version.

Suggested change: coordinate with open #12988, which skips dropbox-cli status while status.py sees no linked account (no account path in info.json, or that path is missing). The two PRs conflict only where both append to test/shell.d/dropbox-test.sh. Alternatively, make every unlinked status poll read only info.json, as #12988 does, so the nonce stays stable while the user is in the browser.

A failed dropbox-cli start also enters the 5-minute wait

loginProcess.onExited treats exit 0 without a URL as "the daemon is up and has opened the link page itself" and calls beginLinkWait(). In the dropbox-cli 2024.04.17 source, start() returns nothing on every path, so the command exits 0 even after printing "The Dropbox daemon is not installed!" (also printed when no daemon PID appears within 60 seconds).

With a fake dropbox-cli whose start prints that failure and exits 0, and whose status prints "Dropbox isn't running!" (read by the real status.py; synthetic):

         click 1                      click 2 (6 s later)
base     start runs, prompt remains   start runs again (retry)
head     linkPending = true           no start runs; the row stays in
                                      the waiting state (per Panel.qml)

Impact: after a start that failed, the Login row stays locked for 5 minutes and the failure text is not shown. The header controls are hidden while unauthenticated, so the only ways to run another start are the p (Resume) key or a shell reload, and the Login row itself stays waiting until the timeout or authentication.

Suggested change: do not enter the no-URL wait when the start output contains "The Dropbox daemon is not installed!", or let a pending no-URL click fall through to a fresh start after a shorter grace period. Broader string matches are risky: a healthy cold start can print "Dropbox isn't running!" before "Done!". running from status.py is not a reliable dead-daemon signal either: status.py stops dropbox-cli status after 4 seconds, so an alive daemon that does not answer also reads as not running.

Optional test improvement: the fixture adds id: testStatusMessage to the first Text block that matches its pattern in Panel.qml. Open #13412 inserts a sync-status Text with the same leading lines above the status message, so after it lands the id would attach to the wrong element and the fixture's status-message assertions would then fail. Giving the status Text a real id in Panel.qml avoids this. Separately, the fixture's status helper always reports unlinked and it sets the linkWait interval to 50 ms before asserting anything, so neither the poll-to-finishLink() chain through a real status process nor the production 3-second interval is covered.


Review information

Test scope: Source review of head 38c0ba78 against its base and current quattro (3faafba2), related open PRs and issues, and the public dropbox-cli source. The PR's fixture, 11 mutants and four scenarios ran in an isolated sandbox with Quickshell 0.3.1 offscreen, with the layer-shell keyboard panel stubbed. Apart from the fixture's own test hooks and the deliberate mutants, Service.qml and the tested Panel.qml bindings were unmodified. No compositor, real popup window, Dropbox daemon, account or browser was used. The live timing in the PR description was not reproduced.

AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

dropbox-cli start returns normally after printing "The Dropbox daemon is not installed!", which it also prints when no daemon pid appears within 60 seconds, so a zero exit with no URL entered the five-minute link wait: the failure was hidden, the row said to finish linking in the browser, and every Login click was a no-op until the deadline. Treat that output as the failure it is.

Pausing or resuming with the panel's p key stops or restarts the daemon, which abandons the link it was waiting on, but the wait, the captured URL and the deadline survived it, so Login again did nothing until the deadline. A pause or resume now ends the pending link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5 · The PR still needs a fix so users can restart Dropbox when it stops during a pending link.RetriggerView in GreptileConfidence Score: 4/5

[Low impact] The changes stay within the Dropbox panel’s account-link flow.

The PR still needs a fix so users can restart Dropbox when it stops during a pending link.

Findings

  1. P1 Stopped daemon blocks login ▶
  2. P2 Deadline can show false timeout ▶

Summary

The PR keeps checking Dropbox while the user finishes linking in the browser.

  • Dropbox’s login panel waits for the browser link to finish.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Login click] --> B{Already waiting?}
  B -->|Yes| C[Reopen captured URL or keep waiting]
  B -->|No| D[Start Dropbox]
  D --> E[URL received or start succeeds]
  E --> F[Check every three seconds]
  F --> G{Account linked?}
  G -->|Yes| H[Stop checking and clear link error]
  G -->|No, before deadline| F
  G -->|No, deadline reached| I[Show timeout and allow retry]
  I -->|Later check confirms link| H
Loading

Reviews (2) · Last reviewed commit: "Merge quattro and update the Dropbox tes..." · Reviewed by Greptile

quotaKnown = parsed.quotaKnown === true
files = parsed.files || []
lastError = ""
if (authenticated) finishLink()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Stopped daemon blocks login If Dropbox stops during a link attempt that returned no URL, status polls update running but leave linkPending set. Clicking Login then does nothing, so the user cannot restart Dropbox through the panel for up to five minutes.

Comment on lines +238 to +243
if (ticks >= 100) {
root.finishLink()
root.linkError = "Dropbox never confirmed the link. Try logging in again."
return
}
root.refresh()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Deadline can show false timeout If linking completes just before the deadline while a status check is still running, this branch reports that Dropbox never confirmed the link without waiting for that result or starting a final check. The panel shows a false timeout until the in-flight check finishes.

@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 1, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and run on a disposable Omarchy worker. The fix works, I pushed one small commit on top, and one ordering question is left for the maintainer.

Reproduced. I ran a harness of my own against the real Service.qml, with a fake dropbox-cli start that prints no URL and a status helper that reports the account as linked 3 seconds after the click. On quattro (8b4eae6), and on this branch with Service.qml/Panel.qml reverted, the panel still had not seen the link 15 seconds later; it would have waited for the 60-second refresh. On this branch, merged onto current quattro, it saw the link on the first 3-second poll. test/shell.d/dropbox-test.sh passes (13/13), as do qml-text-format-test.sh, plugins-test.sh, the plugin contract tests and ./test/cli. ./test/cli has one failure, vscode generated theme references current theme file, and that test fails on quattro too.

Pushed f4b09c5, which fixes two cases where the wait locked Login for the full five minutes:

  • dropbox-cli start exits 0 even after printing The Dropbox daemon is not installed!. It prints that when dropboxd isn't executable or no daemon pid shows up within 60 seconds (see start()/start_dropbox() in dropbox-cli 2026.05.06). So a failed start entered the no-URL wait: the error was hidden, the row said "Waiting for Dropbox to confirm the link", and every Login click did nothing. That output now counts as a failure and is shown, as a non-zero exit already was.
  • Pausing or resuming with p during the wait stops or restarts the daemon and abandons its link, but the pending state, the captured URL and the deadline survived. runControl() now ends the pending link, so the next Login starts fresh.

The fixture has two new steps, one per fix. With either fix reverted on the worker, the fixture fails on the matching step.

Still open: the faster poll and the link nonce (#12637). Each poll runs status.py, which always runs dropbox-cli status. On the worker, with the current client (dropbox 270.4.3312, dropbox-cli 2026.05.06, unlinked), the daemon answers its socket: start printed a cli_link_nonce URL, and four dropbox-cli status calls two seconds apart returned four different nonces. I could not check whether a new nonce invalidates the old one, because that needs a real account. #12637 reports that it does. If so, this PR makes that problem much worse: about 100 status calls per wait instead of one a minute, and "Click to reopen the Dropbox page" reopens the URL from start. The client measured in the description didn't answer its socket, so it would not have shown this. #12988 stops calling dropbox-cli status while the account is unlinked, which would make the 3-second poll read only info.json. Landing #12988 first (or together with this PR) avoids the problem. That ordering is the maintainer's call, so I didn't duplicate that change here. @llstrk's review above raised this and the failed-start case first. Both were checked against the dropbox-cli source and on the worker before acting on them.

Second opinion: Codex at medium effort reviewed the PR and then my commit. On the first round it agreed with the nonce and failed-start findings (independence is not guaranteed, since it can read this session's working notes). It also found the pause/resume case on its own, which is why that fix is in the commit. It flagged two more things that I judged not worth changing. Polls set busy, which briefly disables the row, but when a URL has been captured the daemon answers its socket and the poll is quick. And the runtime test skips without a compositor, which is the house convention; here it ran against a real compositor. On the second round it found nothing in f4b09c5.

Waiting on the maintainer: whether this lands after #12988 or together with it.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 14, 2026
Bring the link wait across quattro's i18n and lazy panel content: the five new panel strings go through I18n.t with English catalog entries, dropbox.openedLogin is dropped from every catalog now that a captured URL starts the wait instead of showing it, and the runtime test reaches the status line through the panel's loaded content.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

This pull request had stopped merging into quattro after the i18n work (#15326) and lazy panel content (#15044) landed, so I merged quattro into the branch in ca3dd12 and resolved it. It merges cleanly again.

What the merge changed beyond the conflicts:

  • The five new panel strings ("Finish linking in your browser", "Click to reopen the Dropbox page", "Waiting for Dropbox to confirm the link", "Reopened the Dropbox page", and the link timeout message) go through I18n.t with English entries in default/i18n/en/shell.json. Translations are left to the sync workflow, as quattro's structural i18n check expects.
  • dropbox.openedLogin is no longer used, because a captured URL now starts the link wait instead of showing "Opened Dropbox login". quattro requires every catalog key to be referenced, so that key is removed from every locale and from the translation manifest.
  • dropbox-test.sh reads the status line through the panel's loaded content, the way the network captive portal test does, now that the panel builds its content on first open.

Checked on a worker built from the Omarchy ISO, with the shell linked to this branch. The earlier reproduction still holds against current quattro: with the real Service.qml and a dropbox-cli that prints no link URL, a link finished in the browser is seen on the first 3-second poll at this head. It is not seen within 15 seconds on quattro or with the fix reverted. ./test/cli, dropbox-test.sh (13 checks), keyboard-panel-lazy-test.sh, panel-open-budgets-test.sh, bar-widget-contract-test.sh, shell-idle-spawn-test.sh and the structural i18n check all pass. extract-scan --check finds no untranslated literals. The full (non-structural) i18n test reports the new keys as untranslated, which is expected until the sync runs.

Codex Medium reviewed the merge resolution and found nothing to change: both sides are preserved, the catalog edits are consistent, and the test still exercises the real status line. Independence is not guaranteed, since it can read this session's notes.

The classification is unsettled at this head. I read this as a bug fix: the panel does not notice a completed link for up to a minute, and that is reproduced above. Codex Medium, asked separately, classed it as an enhancement. The pull request does also add new waiting and timeout states to the panel. Because the two disagree, omabot will not mark it verified, although the reproduction passed. It is waiting on the maintainer to settle what it is.

@omarchybot omarchybot removed the bug Something isn't working label Oct 14, 2026
Bring in the current i18n checks and test isolation. On an installed worker, the old i18n test calls the packaged locale helper instead of the checkout helper and fails to generate a locale; the same failure occurs at the merge base and the current base passes. Retain this branch’s Dropbox lifecycle coverage where upstream removed the old test file, and qualify the fixture’s palette references for Qt 6.12, which introduces a conflicting QtQuick Color type.

Co-Authored-By: GPT-6 (Codex) <noreply@openai.com>
@omarchybot omarchybot added the enhancement New feature or request label Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants