Repository navigation
fix(ssh): retry failed plugin installation on settings change - #24140
AhmedNAgy25 wants to merge 2 commits into
Conversation
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe SSH relay session now retries eligible plugin-install failures up to three times after the initial attempt, with a 1,000 ms delay. It checks that the session and mux remain active before retrying and cancels a pending retry when a new install starts or provider teardown occurs. Tests cover retries using the latest settings, cancellation after session disposal, byte-cap errors, and superseded failures. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to No merge-blocking issue is identified in the supplied evidence. The retry change appears ready to merge after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The retries are bounded and cancel outdated work without adding permissions or accepting new plugin-source inputs. No introduced security issue was established, but behavior across older remote installations remains partially verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: b20c0103-9f08-424c-954a-ec9cd796c3ad
📒 Files selected for processing (2)
src/main/ssh/ssh-relay-session-managed-hooks.test.tssrc/main/ssh/ssh-relay-session.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| err instanceof Error ? err.message : String(err) | ||
| }` | ||
| ) | ||
| if (retryAttempt < SSH_RELAY_PLUGIN_INSTALL_MAX_RETRIES) { |
There was a problem hiding this comment.
Permanent errors trigger retries The retry condition also accepts errors that another attempt cannot resolve. For example, the relay rejects an oversized plugin source, but this code sends three more installation requests and logs more warnings for the same invalid source. Limit retries to transient failures to avoid unnecessary SSH traffic and warning noise.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Fixed in commit 069a97d. Added isTransientPluginInstallError helper to filter out non-transient errors such as relay byte cap limits (PLUGIN_SOURCE_MAX_BYTES), -32602 invalid params, and teardowns. Non-transient errors log a warning once and do not schedule retries. Added unit test asserting oversized payloads are not retried.
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Reviewed changes
- Retry on transient install failure —
SshRelaySession.installPluginsOnRelaynow retries a failedagent_hook.installPluginsrequest up to 3 times at a fixed 1,000ms delay, re-readingstore.getSettings()on every attempt so settings edits during the retry window are reflected (src/main/ssh/ssh-relay-session.ts). - Teardown-aware cancellation — a single pending retry timer is cancelled at the start of any new install and in
teardownProviders; the callback re-checksisDisposed()/this.mux === mux/mux.isDisposed()before re-issuing. - Tests — added retry-with-latest-settings and no-retry-after-teardown cases in
ssh-relay-session-managed-hooks.test.ts(I ran the file: 5 passed).
I traced the lifecycle interaction (establish / reconnect / registerProviders / teardownProviders / dispose / detach) and could not construct a sequence where a request is issued against a disposed session or a non-current mux, or where a needed retry is silently dropped. The retry budget is bounded and retryAttempt is passed by value.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…skip non-transient errors
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Install-generation tracking —
installPluginsOnRelaynow carries apluginInstallGeneration; each fresh settings-triggered install callscancelPluginInstallRetry()(bump generation + clear timer) so superseded attempts and their retries are invalidated before issuing another request (src/main/ssh/ssh-relay-session.ts). - Single retry timer guaranteed — every fresh install clears the prior handle before scheduling, so at most one retry timer is live; this resolves the timer-overwrite concern raised in the prior review and by CodeRabbit.
- Permanent-error filtering —
isTransientPluginInstallErrorskips retries for-32601/-32602/CONNECTION_LOST/DISPOSEDand the relay's byte-cap message (exceeds … byte cap), so deterministic failures no longer burn the retry budget. - Tests — added permanent-error and superseded/overlapping-failure cases; ran
src/main/ssh/ssh-relay-session-managed-hooks.test.ts(7 passed). Both new tests can fail: the permanent-error case would retry without the filter, and the overlapping case would fire a second retry without the generation guard.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
SSH still works: Orca connects to the host over SSH and routes workspace operations through the managed remote Orca server (orcad). These merges remove the legacy SSH relay, not SSH support. Closing as obsolete after the merged SSH relay retirement in #27214 and #27215. This PR concerns the SSH relay server and its relay-only handlers. #27214 removed the desktop relay connection/fallback path; #27215 deleted the SSH relay server, deployment assets, and relay-only tests. SSH hosts now use the managed Orca server (orcad), and unsupported hosts fail explicitly, so this relay-specific work is no longer planned. This closes the proposed relay implementation; it does not claim that any independent local, WSL, or managed-server behavior was fixed. |
|
Thanks @AhmedNAgy25 — on current main, SSH hosts run Orca's managed server (orcad), which installs agent hooks itself on start (#27319) and re-applies them on the host when hook settings change, so there's no network request left to retry. Closing as fixed. |

ELI5
Retry failed remote agent hook/plugin installation requests on SSH hosts with backoff when settings change, re-reading the latest configuration on each attempt.
What Changed
disabledTuiAgents,agentStatusHooksEnabled) changed while connected to an SSH host,SshRelaySession.registerProviderscalledinstallPluginsOnRelay(mux)in the background without retry. If theagent_hook.installPluginsmultiplexer request encountered a transient failure (e.g.SSH_MUX_REQUEST_TIMEOUTor network congestion), the warning was logged and the relay retained stale plugin sources until reconnect. Disabling an agent left its plugin active on the remote host, and newly enabled agents failed to report status.agent_hook.installPluginsrequests automatically retry up to 3 times with a 1,000ms delay (SSH_RELAY_PLUGIN_INSTALL_MAX_RETRIES= 3,SSH_RELAY_PLUGIN_INSTALL_RETRY_DELAY_MS= 1,000ms). Each retry attempt queries the latest settings state, ensuring that subsequent settings edits during the retry window are reflected. If a new settings change occurs or if the session tears down (teardownProviders/dispose), pending retry timers are cancelled immediately to prevent leaks or duplicate requests.pluginInstallRetryTimerandcancelPluginInstallRetry()inSshRelaySession. IninstallPluginsOnRelay(mux, retryAttempt = 0), guarded execution against disposed multiplexers or torn-down sessions (this.isDisposed(),this.mux !== mux,mux.isDisposed()). Added retry scheduling incatchfor transient errors, while keeping immediate returns for unrecoverable codes (-32601,'CONNECTION_LOST','DISPOSED').Why
SSH hosts operate over remote network multiplexers where transient RPC timeouts can occur under load or connection jitter. Retrying transient failures with backoff while respecting teardown boundaries prevents status reporting from silently dropping out until the user reconnects.
Linked Issue
If you do not have one and are an outside contributors, your PR wiil be ignored. Refs is not sufficient. Link an actual issue
Fixes #24122
Visual Proof
N/A— Background SSH relay session RPC retry mechanism; no UI modifications.Testing
Added unit tests in
src/main/ssh/ssh-relay-session-managed-hooks.test.ts:retries failed plugin installation on settings change and re-reads latest settingscancels pending plugin installation retry on session teardownRan full test suites:
src/main/ssh/ssh-relay-session-managed-hooks.test.ts(5 passed)src/main/ssh/ssh-relay-session-agent-hooks.integration.test.ts(13 passed)Quality gates passed:
check-changed-code-quality.mjspassed with 0 findings across changed files.pnpm tc:nodepassed with 0 errors.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Assisted by Google DeepMind Antigravity agent.
Review
Backward-compatible RPC retry on the existing
agent_hook.installPluginschannel. No protocol or serialization changes.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)