Skip to content

fix(secrets): detect headless Linux and avoid D-Bus hangs - #51

Closed
salmonumbrella wants to merge 0 commit into
openclaw:mainfrom
salmonumbrella:fix/keyring-timeout-headless
Closed

salmonumbrella wants to merge 0 commit into
openclaw:mainfrom
salmonumbrella:fix/keyring-timeout-headless

Conversation

@salmonumbrella

Copy link
Copy Markdown
Contributor

Summary

  • Detect missing DBUS_SESSION_BUS_ADDRESS on Linux and automatically use file backend (avoids hang entirely)
  • Add 5-second timeout fallback for edge cases where D-Bus is present but unresponsive
  • Provides actionable error message guiding users to GOG_KEYRING_BACKEND=file

Background

Issue #45 reported that gog auth tokens import hangs indefinitely on headless Raspberry Pi. The root cause is the keyring library trying to connect to D-Bus SecretService when gnome-keyring is installed but not running.

Approach

Two-layer protection:

  1. D-Bus detection (primary): If DBUS_SESSION_BUS_ADDRESS is not set on Linux with "auto" backend, force file backend. This handles the common headless case cleanly with no goroutine leaks.
  2. Timeout fallback (safety net): If D-Bus is present but unresponsive, timeout after 5 seconds with guidance to use file backend.

Test plan

  • TestOpenKeyring_NoDBus_ForcesFileBackend - verifies D-Bus detection
  • TestOpenKeyring_ExplicitBackend_IgnoresDBusDetection - explicit backend bypasses detection
  • TestOpenKeyringWithTimeout_Success - timeout wrapper works
  • TestOpenKeyringWithTimeout_Timeout - timeout error message is correct
  • All existing tests pass

Fixes #45

🤖 Generated with Claude Code

@steipete

steipete commented Jan 8, 2026

Copy link
Copy Markdown
Collaborator

Thanks!!

@steipete steipete closed this Jan 9, 2026
@steipete
steipete force-pushed the fix/keyring-timeout-headless branch from e47060d to 088bb6c Compare January 9, 2026 01:00
@steipete

steipete commented Jan 9, 2026

Copy link
Copy Markdown
Collaborator

Landed on main as 088bb6c.

Tests: pnpm lint && pnpm build && pnpm test (from internal/tracking/worker)

Thanks @salmonumbrella!

This branch was previously deployed

1 inactive deployment
github-pages — 088bb6c8 Deployed Jan 9, 2026 by steipete via deploy #94
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.

Headless mode does not accept redirect url

2 participants