fix(ssh): link only a forwarded agent that holds a key #56
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
public/dotfiles-public!56
Loading…
Reference in a new issue
No description provided.
Delete branch "maximus/ssh-rc-live-agent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
~/.ssh/rcre-pointed~/.ssh/auth_sockat every forwarded agent socket. A login from a device whose agent is empty or not answering then broke SSH in every tmux pane.Incident: 2026-11-23 on spl-vm05, an 18:58 login (agent with no keys) replaced the working 15:03 forward, and
ssh jmz@<Pi>failed withPermission denied (publickey).Change: the link moves only if
ssh-add -lexits 0 on the new socket, i.e. its agent holds at least one key. Exit 1 (empty) and exit 2 (not answering) leave the old link in place.timeout 3is used where it exists, so a hung forward can't stall the login.Trade-off: a key added to that agent after login doesn't re-link; reconnect with the key loaded.
Testing:
bash -npasses. I didn't run the behaviour test (with stub and throwaway agents) in my session because it was refused there. Bear runs/root/ssh-rc-test.sh <worktree>, which uses a stubssh-addand a temporary HOME and touches no real agent.🤖 Generated with Claude Code
https://claude.ai/code/session_01XMf4EHUCusHo4yoiNi7VnR
Behaviour test run by Bear on spl-vm05 (
/root/ssh-rc-test.sh, stubssh-add, temporary HOME), all five cases pass: