fix(session): verify retained client liveness on open fast path

Verify retained provider operation health before reusing the same target and profile. Retire failed Hopper clients through existing owned cleanup, preserve healthy reuse and cancellation, and start replacement children lazily on the next query.

Refs #1719. Actual headless Linux Hopper child-death/reopen recovery and 85 related tests passed against the current-main merge tree; Ghidra/IDA liveness and the historical snapshot report remain outside this verification.

Co-authored-by: sx4im <sx4im@users.noreply.github.com>
Co-authored-by: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
Saim Shafique
2026-10-12 03:16:13 +08:00
committed by GitHub
co-authored by sx4im N0zoM1z0 Kaoru0822
parent d802304c54
commit e59db2f5de
4 changed files with 533 additions and 6 deletions
@@ -249,6 +249,32 @@ it("blocks a fresh launch while cleanup remains unverified", async () => {
});
});
it("preserves failed startup state through a blocked retry until cleanup succeeds", async () => {
const launcher = new RetryCleanupLauncher();
const { client } = await failedStartup(launcher);
// The startup timeout leaves the client in not_started with retained
// resources; cleanup is still incomplete.
expect(client.operationHealth()).toMatchObject({ state: "not_started" });
// An intervening retry is blocked by the retained resources, and now
// surfaces the recorded startup failure (upstream 069308bb) instead of
// a generic protocol error...
await expect(client.start()).resolves.toMatchObject({
ok: false,
error: {
_tag: "ProviderAdapterError",
cleanupIncomplete: true,
cause: { _tag: "HopperTimeoutError" },
},
});
// ...but must not wipe the failed-startup state: the client still
// reports not_started (never idle) until cleanup succeeds, so a
// same-target open_binary keeps retiring the wedged client instead of
// fast-pathing it.
expect(client.operationHealth()).toMatchObject({ state: "not_started" });
launcher.allowCleanup = true;
await expect(client.close()).resolves.toEqual({ ok: true, value: null });
});
it("permits a fresh launch after stopping an owned bridge-request provider without an acknowledgement", async () => {
const fixture = new RetryCleanupLauncher();
fixture.allowCleanup = true;