Skip to content

fix(dg): dg ipfs up no longer hangs on the browser it opens - #695

Merged
PastaPastaPasta merged 1 commit into
masterfrom
fix/ipfs-up-browser-hang
Nov 24, 2026
Merged

PastaPastaPasta merged 1 commit into
masterfrom
fix/ipfs-up-browser-hang

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

On Linux, dg ipfs up hangs 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 until timeout 240 killed it:

  [ OK ] cleanup        probe unpinned
The OS keychain is unavailable. ...
exit=124

open_link ran xdg-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. Now run_opener spawns 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. macOS open and Windows start return at once, so they behave as before.

The same run also hit the no-keychain path. The notice said to set DASH_FORGE_KUBO_AUTH to "the node's Forge bearer token", but the profile wants the full header value, and kubo answers a bare token with 403. The notice and run-your-own-ipfs-node.md now say Bearer <token>, using the forge value from tokens.toml.

Test: an_opener_that_leaves_the_browser_running_does_not_block covers 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 all ipfs:: tests pass in 2 s. Clippy and fmt are clean.

🤖 Generated with Claude Code

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]>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b2e5e7bd-db7f-42ae-ad08-67967c6bcf4e
Commits

Reviewing files that changed from the base of the PR and between d582ba2 and 3e88300.

Files selected for processing: 2

  • crates/dg/src/ipfs/mod.rs
  • docs/guides/run-your-own-ipfs-node.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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 30 orphans 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.

@PastaPastaPasta
PastaPastaPasta merged commit 0394cc5 into master Nov 24, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant