fix(ida): wait out a transient busy worker health in headless sessions (#1778)

* test(ida): expect a transient busy worker health to be waited out

* fix(ida): wait out a transient busy worker health before reading identity

* docs(ida): record the verified macOS arm64 headless workflow and the busy-health wait

* test(ida): pin the busy wait deadline, cause and reported tool, and assert clean release

* fix(ida): repeat only a tool-name-shaped busy tool and keep the wait in its own module

* test(ida): drive the busy wait with a virtual clock and pin its bound and cancellation

* fix(ida): stop the busy wait at its deadline without another read and honour a late abort

* docs(ida): state when the busy wait times out, cancels or reports an unknown tool
This commit is contained in:
Mykola Dementiev
2026-10-11 17:25:27 +08:00
committed by GitHub
parent 6e38529333
commit 0bdc7a40ac
7 changed files with 524 additions and 12 deletions
+7 -4
View File
@@ -20,6 +20,7 @@ import { jsonValueSchema, type JsonValue } from "../domain/jsonValue.js";
import { err, ok, type Result } from "../domain/result.js";
import type { IdaConfiguration } from "./IdaConfiguration.js";
import type { IdaMcpConnection } from "./IdaMcpConnection.js";
import { readSettledHealth } from "./IdaBusyHealth.js";
import { IdaOperationRunner } from "./IdaOperationRunner.js";
import {
IDA_LIMITATIONS,
@@ -183,7 +184,7 @@ export class IdaSessionClient implements AnalysisClient {
);
try {
await this.#start();
const before = await this.#observe();
const before = await this.#observe(options);
if (wasCancelled(options))
return err(new AnalysisCancelledError(operation));
if (operation === "health") return this.#health(before);
@@ -200,7 +201,7 @@ export class IdaSessionClient implements AnalysisClient {
const result = await runner.run(operation, parameters);
if (wasCancelled(options))
return err(new AnalysisCancelledError(operation));
const after = await this.#observe();
const after = await this.#observe(options);
if (wasCancelled(options))
return err(new AnalysisCancelledError(operation));
return ok(
@@ -339,7 +340,7 @@ export class IdaSessionClient implements AnalysisClient {
}
}
async #observe(): Promise<JsonValue> {
async #observe(options?: ExecutionOptions): Promise<JsonValue> {
let identity: string;
if (this.config.mode === "attached") {
const raw = await this.connection.call("get_metadata", {});
@@ -359,8 +360,10 @@ export class IdaSessionClient implements AnalysisClient {
throw new AnalysisProtocolError(
"IDA headless session has no database binding.",
);
const raw = await this.connection.call("server_health", {
const raw = await readSettledHealth(this.connection, {
database: this.#database,
timeoutMs: this.config.timeoutMs,
signal: options?.signal,
});
const metadata = modernHealthSchema.parse(raw);
if (