Skip to content

fix(cli): bail early with human-readable error if gpg-agent socket missing#26125

Open
TheRealShek wants to merge 1 commit into
coder:mainfrom
TheRealShek:fix/gpg-agent-early-exit
Open

fix(cli): bail early with human-readable error if gpg-agent socket missing#26125
TheRealShek wants to merge 1 commit into
coder:mainfrom
TheRealShek:fix/gpg-agent-early-exit

Conversation

@TheRealShek
Copy link
Copy Markdown

Fixes #12681

Problem

coder ssh -G fails with raw no such file or directory when the local
gpg-agent isn't running. The error appears deep in the forwarding logic
with no actionable guidance.

Fix

Added early os.Stat check on the gpg-agent extra socket in both
cli/ssh_other.go (Linux/macOS) and cli/ssh_windows.go before any
forwarding is attempted. If the socket doesn't exist, returns a
human-readable error suggesting gpg-agent --daemon.

Verification

image image

Tests

Added TestSSH_ForwardGPG_AgentNotRunning. Sets GNUPGHOME to an empty
temp dir so the socket is guaranteed missing, then calls forwardGPGAgent
directly with nil sshClient — safe because the os.Stat check exits
before the client is touched. No live server needed.

AI Disclosure

AI tools were used to assist with codebase tracing. All code written
and verified manually by me.

@github-actions github-actions Bot added the community Pull Requests and issues created by the community. label Jun 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@TheRealShek
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

cdrci2 added a commit to coder/cla that referenced this pull request Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Pull Requests and issues created by the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GPG forwarding should bail early if GPG agent isn't running locally

1 participant