Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(setup): configure every detected client

N0zoM1z024f9a1ff11e4
diff --git a/src/application/SetupClients.ts b/src/application/SetupClients.ts
index bcaca48e0..c45cfd7b8 100644
--- a/src/application/SetupClients.ts
+++ b/src/application/SetupClients.ts
@@ -14,7 +14,7 @@ const failedConfigurationMessage = (
return "Agent configuration could not be verified after writing. Repair the configuration file or restore its `.rea.backup`, then rerun setup.";
};
-/** Configure each detected agent, stopping after the first failed transaction. */
+/** Configure every detected agent and report the first failed transaction. */
export const configureDetectedClients = async (options: {
readonly host: SetupHost;
readonly detectedClients: readonly SetupClient[];
@@ -23,6 +23,7 @@ export const configureDetectedClients = async (options: {
readonly clients: Record<string, ClientConfigurationResult>;
readonly appliedActions: string[];
}): Promise<string | undefined> => {
+ let failure: string | undefined;
for (const client of options.detectedClients) {
const result = await options.host.configureClient(
client,
@@ -31,9 +32,9 @@ export const configureDetectedClients = async (options: {
);
options.clients[client.name] = result;
if (result.status === "failed")
- return failedConfigurationMessage(result.reason);
- if (result.status === "configured")
+ failure ??= failedConfigurationMessage(result.reason);
+ else if (result.status === "configured")
options.appliedActions.push(`configured_${client.name}`);
}
- return undefined;
+ return failure;
};
diff --git a/tests/setup.test.ts b/tests/setup.test.ts
index 11c79dfb1..421505eb3 100644
--- a/tests/setup.test.ts
+++ b/tests/setup.test.ts
@@ -297,6 +297,31 @@ describe("setup workflow", () => {
expect(result.remediation).not.toContain("internal_client_key");
});
+ it("records every detected client outcome after an earlier failure", async () => {
+ const host = new FakeSetupHost();
+ host.hopper = "/Applications/Hopper";
+ host.clients = [
+ { name: "first", configPath: "/first.json" },
+ { name: "second", configPath: "/second.json" },
+ { name: "third", configPath: "/third.json" },
+ ];
+ host.clientResults.set("first", { status: "failed", reason: "write" });
+ host.clientResults.set("second", { status: "configured" });
+ host.clientResults.set("third", { status: "failed", reason: "readback" });
+
+ const result = await runSetup(options(true), host);
+
+ expect(host.configurations).toBe(3);
+ expect(result.clients).toEqual({
+ first: { status: "failed", reason: "write" },
+ second: { status: "configured" },
+ third: { status: "failed", reason: "readback" },
+ });
+ expect(result.appliedActions).toEqual(["configured_second"]);
+ expect(result.status).toBe("needs_human");
+ expect(result.remediation).toContain("could not be updated");
+ });
+
it("explains skill installation recovery", async () => {
const host = new FakeSetupHost();
host.hopper = "/Applications/Hopper";