Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix: settle cancelled create requests in tests and never print key-derived values

rubenluetke10-beepc9935c099b09
diff --git a/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.test.tsx b/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.test.tsx
index 92341c3a44..f01a034647 100644
--- a/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.test.tsx
@@ -41,7 +41,12 @@ function mount() {
}
beforeEach(() => { runtimes.value = READY; });
-afterEach(() => { cleanup(); vi.clearAllMocks(); act(() => useCreateAgentDialog.setState({ open: false })); });
+afterEach(() => {
+ cleanup();
+ vi.clearAllMocks();
+ // Settle anything a test left open, so the next test's request starts clean.
+ act(() => useCreateAgentDialog.getState().cancel());
+});
describe("CreateAgentDialog", () => {
test("creates a named Hermes agent with a provider and a companion", async () => {
@@ -64,7 +69,7 @@ describe("CreateAgentDialog", () => {
test("a Jarvis agent needs nothing but the button", async () => {
createAgent.mockResolvedValue({ agentId: "agent-2" });
mount();
- act(() => { void useCreateAgentDialog.getState().request(); });
+ act(() => { useCreateAgentDialog.getState().request().catch(() => undefined); });
fireEvent.click(await screen.findByTestId("create-agent-submit"));
await waitFor(() => expect(createAgent).toHaveBeenCalled());
expect(createAgent.mock.calls[0][0]).toMatchObject({ runtime: "jarvis", provider: undefined });
@@ -73,7 +78,7 @@ describe("CreateAgentDialog", () => {
test("a runtime that is not installed cannot be created yet", async () => {
mount();
- act(() => { void useCreateAgentDialog.getState().request(); });
+ act(() => { useCreateAgentDialog.getState().request().catch(() => undefined); });
fireEvent.click(await screen.findByRole("radio", { name: "society.runtime.openclaw" }));
const submit = screen.getByTestId("create-agent-submit") as HTMLButtonElement;
await waitFor(() => expect(submit.disabled).toBe(true));
@@ -83,9 +88,10 @@ describe("CreateAgentDialog", () => {
test("closing the dialog cancels the request quietly", async () => {
mount();
let pending!: Promise<unknown>;
- act(() => { pending = useCreateAgentDialog.getState().request(); });
+ // Catch at once: the rejection must never be unhandled, even for a tick.
+ act(() => { pending = useCreateAgentDialog.getState().request().catch((exc: unknown) => exc); });
fireEvent.click(await screen.findByRole("button", { name: "society.create_agent.cancel" }));
- const error = await pending.catch((exc: unknown) => exc);
+ const error = await pending;
expect(isCreateCancelled(error)).toBe(true);
expect(createAgent).not.toHaveBeenCalled();
});
diff --git a/scripts/spikes/agent_runtimes_e2e.py b/scripts/spikes/agent_runtimes_e2e.py
index 76355551e6..941422a5a3 100644
--- a/scripts/spikes/agent_runtimes_e2e.py
+++ b/scripts/spikes/agent_runtimes_e2e.py
@@ -151,14 +151,14 @@ async def main(name: str) -> int:
home = tmp / "agent_runtimes" / name / agent_id
written = sorted(p.name for p in home.iterdir())
print(" runtime home:", written)
- secret_leak = [
- str(p.relative_to(home))
- for p in home.rglob("*")
- if p.is_file()
+ secret_leak = any(
+ p.is_file()
and p.stat().st_size < 5_000_000
and key in p.read_text(encoding="utf-8", errors="replace")
- ]
- print(" key written to disk:", secret_leak)
+ for p in home.rglob("*")
+ )
+ # Only a fixed word is printed: never anything derived from the key.
+ print(" key written to disk:", "YES" if secret_leak else "no")
await driver(name).stop()
ok = first.status == "done" and second.status == "done" and history > 2 and not secret_leak
print("RESULT:", "PASS" if ok else "FAIL")