Skip to content

fix: keep SSH agent forwarding stable across reconnects (#506) - #828

Merged
MisterTea merged 6 commits into
masterfrom
issue-506
Sep 28, 2026
Merged

MisterTea merged 6 commits into
masterfrom
issue-506

Conversation

@MisterTea

@MisterTea MisterTea commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Keep SSH agent forwarding pointed at a stable per-client symlink, and retarget that symlink to the current SSH_AUTH_SOCK after an in-process reconnect and on saved-session reattach.
  • Returning clients still reuse the original server-side reverse-tunnel destination, so the remote SSH_AUTH_SOCK does not change when the local agent socket does.

Closes #506.

Test plan

  • refreshAgentProxyPath creates and retargets agent proxy socket
  • TerminalClient reattach retargets SSH agent proxy
  • TerminalClient in-process reconnect retargets SSH agent proxy
  • bash format.sh
  • ctest --parallel --output-on-failure in the issue-506 worktree
  • CI on this push

@codecov

codecov Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.06422% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.88%. Comparing base (044bcb5) to head (0b2c80c).

Files with missing lines Patch % Lines
src/terminal/TerminalClient.cpp 58.20% 19 Missing and 9 partials ⚠️
test/unit_tests/TerminalClientTest.cpp 85.03% 9 Missing and 13 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master     #828    +/-   ##
========================================
  Coverage   79.88%   79.88%            
========================================
  Files         152      153     +1     
  Lines       22144    22354   +210     
  Branches    14338    14472   +134     
========================================
+ Hits        17690    17858   +168     
- Misses       2641     2661    +20     
- Partials     1813     1835    +22     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MisterTea MisterTea changed the title Issue: issue-506 fix: refresh forwarded SSH agent sockets when SSH_AUTH_SOCK changes (#506) Sep 20, 2026
@MisterTea MisterTea changed the title fix: refresh forwarded SSH agent sockets when SSH_AUTH_SOCK changes (#506) fix: keep SSH agent forwarding stable across reconnects (#506) Sep 20, 2026
@MisterTea
MisterTea marked this pull request as draft September 20, 2026 16:37
Delegate Agent and others added 3 commits September 20, 2026 19:21
Keep the stable SSH agent proxy path while taking master's TerminalClient changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Returning clients keep the server-side tunnel destination, so the local
symlink has to follow SSH_AUTH_SOCK when the connection comes back.

Co-authored-by: Cursor <cursoragent@cursor.com>
@MisterTea
MisterTea marked this pull request as ready for review September 27, 2026 20:41
Portability CI failed because refreshAgentProxyPath removed agent.sock
before recreating it, so reconnect tests could race on read_symlink.

Co-authored-by: Cursor <cursoragent@cursor.com>
@MisterTea
MisterTea merged commit 16aec0c into master Sep 28, 2026
44 of 45 checks passed
@MisterTea
MisterTea deleted the issue-506 branch September 28, 2026 02:02
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.

ET doesn't notice when SSH_AUTH_SOCK changes underneath

2 participants