Skip to content

Fix xdg-open error spam during login on headless Linux#641

Merged
svarlamov merged 2 commits intomainfrom
fix/suppress-xdg-open-errors
Mar 10, 2026
Merged

Fix xdg-open error spam during login on headless Linux#641
svarlamov merged 2 commits intomainfrom
fix/suppress-xdg-open-errors

Conversation

@acunniffe
Copy link
Collaborator

@acunniffe acunniffe commented Mar 6, 2026

Summary

  • Suppress stdout/stderr from the browser-open command during git-ai login so xdg-open errors don't spam the terminal on headless Linux environments
  • Refactor platform-specific command construction into shared let mut cmd blocks, then apply Stdio::null() redirects before spawning
  • Keep .spawn() (non-blocking, fire-and-forget) so the login/token-polling flow is never stalled by a slow or hanging browser command

Updates since last revision

  • Reverted from .status() back to .spawn() to address Devin Review feedback: .status() blocks until the process exits, which can stall the login flow and cause the device authorization code to expire before token polling begins. The Stdio::null() redirects are kept to suppress error output.

Review & Testing Checklist for Human

  • Run git-ai login on a headless Linux environment (e.g. Docker/sandbox) and confirm no xdg-open error output appears in the terminal
  • Run git-ai login on macOS/Linux with a desktop and confirm the browser still opens normally and login completes without delay
  • Verify the "(Could not open browser automatically)" message appears when the browser command is not found (e.g. xdg-open not installed)

Notes

  • The fallback message at line 47 only triggers when .spawn() itself fails (command not found), not when the browser command exits with an error code. This matches the original pre-PR behavior.
  • 🤖 Generated with Claude Code

Link to Devin session: https://app.devin.ai/sessions/a17b93339b0b4c55b240c81e9bdb4886
Requested by: @svarlamov


Open with Devin

Suppress stdout/stderr from the browser-open command and use .status()
instead of .spawn() so failures are properly detected and the fallback
message is shown instead of raw xdg-open errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
devin-ai-integration[bot]

This comment was marked as resolved.

@git-ai-cloud-dev
Copy link

git-ai-cloud-dev bot commented Mar 6, 2026

Stats powered by Git AI

🧠 you    █░░░░░░░░░░░░░░░░░░░  5%
🤖 ai     ░███████████████████  95%
More stats
  • 1.4 lines generated for every 1 accepted
  • 0 seconds waiting for AI
  • Top model: claude::claude-opus-4-6 (17 accepted lines, 26 generated lines)

AI code tracked with git-ai

Keep Stdio::null() redirects to suppress xdg-open error spam,
but use non-blocking .spawn() so token polling can start immediately
without waiting for the browser command to return.

Co-Authored-By: Sasha Varlamov <sasha@sashavarlamov.com>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ acunniffe
❌ devin-ai-integration[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.


cmd.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.spawn()
Copy link
Contributor

Choose a reason for hiding this comment

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

Addressed — reverted to .spawn() (non-blocking, fire-and-forget) while keeping the Stdio::null() redirects to suppress xdg-open error spam. This preserves the original non-blocking behavior so token polling starts immediately.

@svarlamov svarlamov merged commit 25423bf into main Mar 10, 2026
23 checks passed
@svarlamov svarlamov deleted the fix/suppress-xdg-open-errors branch March 10, 2026 16:54
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.

3 participants