Skip to content

Find the Linux user session bus when agents drop its variables - #45

Merged
mohsen1 merged 1 commit into
mainfrom
session-bus-fallback
Nov 8, 2026
Merged

mohsen1 merged 1 commit into
mainfrom
session-bus-fallback

Conversation

@mohsen1

@mohsen1 mohsen1 commented Nov 7, 2026

Copy link
Copy Markdown
Member

On Linux, proofline mcp could not read the stored sign-in when Codex or the Cursor agent started it. Both start stdio MCP servers with a reduced environment: Codex passes HOME LANG NODE_EXTRA_CA_CERTS PATH PWD SSL_CERT_FILE TERM, and the Cursor agent passes HOME PATH PWD TERM. The keychain library finds the Secret Service bus only through DBUS_SESSION_BUS_ADDRESS or $XDG_RUNTIME_DIR/bus, so the server failed with:

proofline: the operating system keychain is unavailable (Platform secure storage failure: DBus error: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead); set PROOFLINE_TOKEN to a personal token instead

Change

  • credentials::default_session_bus returns unix:path=/run/user/<uid>/bus when neither variable is set and that path is a socket. systemd and elogind serve the user bus there. The uid comes from the owner of /proc/self.
  • main sets DBUS_SESSION_BUS_ADDRESS to that address as its first statement, before the update check can start a thread. The keychain library opens the bus with libdbus's Connection::new_session(), which reads the address only from the environment. In edition 2024 set_var is unsafe, so the workspace lint moves from forbid to deny, and this one call carries #[expect(unsafe_code, reason = ...)] and a SAFETY comment.
  • An address or runtime directory in the environment still wins. Other platforms are unchanged, and the PROOFLINE_TOKEN fallback message is unchanged.
  • Entries that proofline agent install already wrote get the fix without a configuration change.

Verification

  • cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings and cargo test --locked pass: 93 passed, 1 ignored, including the new credentials::tests::user_bus_is_used_only_when_the_environment_names_no_bus. python3 -m unittest discover -s scripts -p 'test_*.py' passes.
  • Ubuntu 24.04.5 x86_64, x86_64-unknown-linux-musl release build. A user bus ran at /run/user/0/bus with an unlocked gnome-keyring 46.1, and each host ran in a fresh HOME after curl -fsSL https://proofline.sh/cli | sh -s -- --setup:
Started by 0.1.8 as published This branch, nothing stored This branch, placeholder credential stored
codex exec (codex-cli 0.167.0) keychain unavailable not signed in to https://proofline.sh; run proofline login, or set PROOFLINE_TOKEN reads it and sends it; proofline.sh answers HTTP 401 (with only Codex's variables plus an HTTPS proxy)
cursor-agent mcp list-tools proofline (2026.11.05-86047df) keychain unavailable not signed in … reads it; the request then fails because the Cursor agent also drops the proxy that host needs

The MCP configuration files that the installer wrote were byte-for-byte the same before and after.


Generated by Claude Code

Codex and the Cursor agent start stdio MCP servers with a reduced
environment that has neither DBUS_SESSION_BUS_ADDRESS nor XDG_RUNTIME_DIR.
The keychain library finds the Secret Service bus only through those
variables, so `proofline mcp` reported the keychain as unavailable and
could not use the credential that `proofline login` stored.

When neither variable is set and /run/user/<uid>/bus is a socket, the
CLI now points DBUS_SESSION_BUS_ADDRESS at it before any thread starts.
An address or runtime directory in the environment still wins, and the
PROOFLINE_TOKEN fallback message is unchanged. Entries that are already
installed pick this up without a configuration change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mohsen1
mohsen1 marked this pull request as ready for review November 7, 2026 07:09
@mohsen1
mohsen1 merged commit 9b6209e into main Nov 8, 2026
7 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.

2 participants