Add explicit remote executor connection refresh (#40710)

## Why

Planned executor replacement needs a fresh session without waiting for the old
session's transient-disconnect recovery to finish.

## What changed

- Add `Environment::refresh_connection` for remote Noise registry-backed
  environments. It performs a fresh registry lookup, reuses a healthy session
  when the executor identity is unchanged, and connects to a replacement when
  it has changed.
- Retire superseded sessions and connection attempts so they cannot publish
  stale state, accept late RPC results, or replay outstanding work.
- Preserve the existing environment and filesystem handles while replacing the
  underlying client, and require a live status probe before refresh succeeds.

## Testing

Add coverage for replacement and session reuse, recovery and connection races,
lookup and handshake failures, handle preservation, and late RPC responses.

GitOrigin-RevId: f1d11208cbfe8af8feb25f6b6b8100da82169a99
This commit is contained in:
Rasmus Rygaard authored and copyberry committed 2026-08-25 21:23:17 +00:00
1 parent 5ca4175295
commit eb49f491c6
8 files changed
+1029 -83

No files matched your search

@@ -85,6 +85,7 @@ impl SequenceNoiseConnectProvider {
),
)
.await
.map(|(connection, options, _)| (connection, options))
}
}
@@ -340,6 +341,7 @@ async fn noise_session_resume_leaves_offline_retries_to_recovery() -> Result<()>
));
let identity = NoiseChannelIdentity::generate()?;
let strategy = ExecServerReconnectStrategy::NoiseRendezvous {
executor_public_key: NoiseChannelIdentity::generate()?.public_key(),
provider: sequence.clone(),
identity: identity.clone(),
client_name: "test".to_string(),