Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new “Reload SSH Keys” feature to the SSH agent integration so KeePassXC can re-add previously-added identities that have disappeared from the running agent (e.g., after an agent restart), without requiring a database reopen. This fits into the existing SSH agent lifecycle handling in src/sshagent and is surfaced as a Tools menu action in the main window.
Changes:
- Introduces tracking metadata (
SshKeySettings) and implementsSSHAgent::reloadAllAgentIdentities()to re-add missing identities from currently open/unlocked databases. - Adds a new GUI action (“Reload SSH Keys”) wired into
MainWindowand the Tools menu. - Expands
testsshagentcoverage with several unit tests targeting reload behavior and edge cases.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/TestSSHAgent.h | Adds new reload-focused test declarations and a helper for building a test entry/database. |
| tests/TestSSHAgent.cpp | Implements multiple reload regression tests and updates calls to the new addIdentity() signature. |
| src/sshagent/SSHAgent.h | Adds SshKeySettings, changes addIdentity() API, and declares reloadAllAgentIdentities(). |
| src/sshagent/SSHAgent.cpp | Implements reload logic and updates internal key tracking to store settings. |
| src/gui/MainWindow.ui | Adds the “Reload SSH Keys” QAction under Tools. |
| src/gui/MainWindow.h | Declares the new reloadSSHAgentKeys() slot. |
| src/gui/MainWindow.cpp | Wires the new action, gathers open DBs, and triggers reload from the UI. |
| src/gui/entry/EditEntryWidget.cpp | Updates “Add key to SSH Agent” to pass SshKeySettings. |
| src/gui/DatabaseWidget.cpp | Updates “Add to Agent” flow to pass SshKeySettings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Nikos Apostolakis <nikosapostolakis94@gmail.com>
Signed-off-by: Nikos Apostolakis <nikosapostolakis94@gmail.com>
Signed-off-by: Nikos Apostolakis <nikosapostolakis94@gmail.com>
kaposnick
force-pushed
the
pr_reload_sshagent_keys
branch
from
August 28, 2026 16:51
f86cc5f to
df1c2e8
Compare
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.
Fixes #12180
This PR adds a "Reload SSH Keys" action that re-adds any previously-added SSH identities but are currently gone from the ssh-agent. A useful application of this feature, as stated in #12180 , is when the ssh-agent is restarted and the identities are missing. The user will now have the option to reload the already loaded keys.
Screenshots
Testing strategy
Manual GUI Testing
I first verified it using the GUI. I launched the ssh-agent:
eval $(ssh-agent -s -a /tmp/ssh-agent-testSSH_AUTH_SOCK_OVERRIDEto/tmp/ssh-agent-testAdd key to SSH Agentssh-add -lshould now list this key.ssh-agent -kssh-add -lshould not list the key.eval $(ssh-agent -s -a /tmp/ssh-agent-test. Without this PR, there was no way for the previously loaded keys to be reloaded.Tools > Reload SSH Keysssh-add -lshould list again the key.Unit Testing
Enhanced TestSSHAgent.cpp coverage specifically for
reloadAllAgentIdentities(). All the new and old tests intestsshagentpass locally.Type of change