fix(desktop): capture zshrc-only gpg/ssh-agent env vars for signed commits - #176
Merged
Conversation
added 2 commits
August 31, 2026 09:36
…mmits (#171) init_login_shell_env() probed `$SHELL -l -c env` to backfill the minimal launchd env of a Finder/Dock-launched app. `-l` alone doesn't source `~/.zshrc` on zsh (only an interactive shell does), so GPG_TTY and agent-socket exports conventionally placed there never reached the process env. A signed git commit from the GUI then hit gpg-agent/ssh-agent without a working socket, while the same commit worked from Terminal. Add `-i` to the probe so `.zshrc`-only exports are captured too.
…de error Its only consumers (the production probe and the macOS-gated test module) are both target_os = "macos" — gating the const on `any(test, ...)` made it compile under `cfg(test)` on Linux too, with no user there, which clippy's -D warnings flagged as dead code on the ubuntu-22.04 job.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
git commitfrom the GUI failed witherror: Couldn't get agent socket? fatal: failed to write commit objecton macOS, while the identical commit succeeded from Terminal.shell_env::init_login_shell_env()backfills the minimallaunchdenvironment of a Finder/Dock-launched GitWand.app by probing$SHELL -l -c env. On zsh,-l(login) alone does not source~/.zshrc— only an interactive shell does, and a-cscript stays non-interactive even with-l. GPG/SSH-agent setup (export GPG_TTY=$(tty), agent-socket exports from common guides like 1Password/YubiKey) is conventionally placed in.zshrc, so it never reached the process env thatgit commitinherits.-ito the probe ($SHELL -i -l -c env) so.zshrc-only exports are captured too, same as any other shell-rc variable.Test plan
login_shell_flags_tests(macOS-only) that spawns realzshagainst an isolatedZDOTDIRfixture with a.zshrc-only marker var: one test proves the new flags capture it, one documents that the old-l-only invocation misses it.cargo test --lib— 250 passed, 0 failed.cargo clippy --lib -- -D warnings— clean.cargo fmt --check— clean.CHANGELOG.mdupdated under[Unreleased] → Fixed.