Repository navigation
fix(dg): dg ipfs up no longer hangs on the browser it opens - #695
Conversation
On Linux, `dg ipfs up` opened the web app's connect page with `xdg-open` and waited for its output. Without a desktop environment xdg-open runs the browser in the foreground, and the browser inherits the pipe, so `dg ipfs up` sat after its last check until the browser was closed, without printing the connection code. The opener now runs with no pipes, and one still running after three seconds counts as opened. The no-keychain notice also says what DASH_FORGE_KUBO_AUTH must hold (`Bearer <token>`) and where the token is; a bare token is refused by kubo with 403. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 47 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
PastaPastaPasta
left a comment
There was a problem hiding this comment.
Verdict: approve
The spawn no longer blocks. run_opener (crates/dg/src/ipfs/mod.rs:628) nulls all three stdio streams before spawn(), so a browser that xdg-open starts inherits no pipe dg reads, and wait() is capped at 3 s. Verified on a clean Linux sandbox: with run_opener's body put back to the old command.output(), the new test fails after 60.006 s. With the PR, all 41 ipfs:: tests pass in 1.7 s.
Zombies don't matter here. On timeout (:638) the Child is dropped without kill_on_drop, so the opener and browser keep running, which is what we want. Tokio puts the dropped child in its orphan queue and reaps it on a later SIGCHLD, and dg exits shortly after anyway, at which point init re-parents and reaps it. A zombie lasts at most one per dg ipfs up, for the life of the process.
macOS and Windows still work. open and cmd /c start "" <link> (:609) both return at once, so they take the Ok(status) branch as before. Null stdio is harmless for both. The link (…/settings/storage/#kubo=<port>.<code>) has no & or ^ that cmd would split on.
Bearer matches kubo. dg writes API.Authorizations."dash-forge".AuthSecret = "bearer:<forge>" (config.rs:449). Kubo turns the bearer: prefix into the expected header Authorization: Bearer <forge> and compares it exactly, so a bare token gets 403. The keychain path already stores format!("Bearer {}", tokens.forge) (mod.rs:291), and the profile's api_auth is the full header value (profiles.rs:302). The new notice (mod.rs:301) and the guide row (run-your-own-ipfs-node.md:202) now say the same thing.
Minor, non-blocking:
- An opener that fails slowly (more than 3 s, then non-zero) counts as opened, and the user sees "opened" with no browser. This is acceptable: the connection code is printed either way.
- The test leaves two
sleep 30orphans per run. Harmless.
CI: everything is green except playwright (read-only, testnet), which was still pending when I checked and is unrelated to this change.
🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.
On Linux,
dg ipfs uphangs after its last check when it opens the web app's connect page. It never prints the connection code and exits only once the browser is closed. In the mainnet-readiness CLI QA (Ubuntu 24.04, Chrome, no desktop environment), it sat there untiltimeout 240killed it:open_linkranxdg-open <link>with.output().await. Without a desktop environment, xdg-open runs the browser in the foreground, and any browser it starts inherits the stdout/stderr pipes, so dg waits on both. Nowrun_openerspawns the opener with null stdio and waits at most 3 s. An opener still running after that has started a browser, so it counts as opened. macOSopenand Windowsstartreturn at once, so they behave as before.The same run also hit the no-keychain path. The notice said to set
DASH_FORGE_KUBO_AUTHto "the node's Forge bearer token", but the profile wants the full header value, and kubo answers a bare token with 403. The notice andrun-your-own-ipfs-node.mdnow sayBearer <token>, using theforgevalue fromtokens.toml.Test:
an_opener_that_leaves_the_browser_running_does_not_blockcovers an opener that backgrounds a child and exits, one that stays in the foreground, and one that fails. With the old.output()it fails after 60 s; with this change allipfs::tests pass in 2 s. Clippy and fmt are clean.🤖 Generated with Claude Code