Skip to content

The agent that grows with you

test(bot-screen): follow the round-6 contracts

teknium158fc7fe10f4b
diff --git a/apps/desktop/src/plugins/hermes-bots/screen-pane-status-events.test.tsx b/apps/desktop/src/plugins/hermes-bots/screen-pane-status-events.test.tsx
index a3dec1810f8..9ff71c7f30e 100644
--- a/apps/desktop/src/plugins/hermes-bots/screen-pane-status-events.test.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/screen-pane-status-events.test.tsx
@@ -109,7 +109,7 @@ it('a stopped pane learns of an external start from the pushed display.status ev
expect(view.getByText('Stopped')).toBeTruthy()
act(() => emitGatewayEvent({ type: 'display.status', connectionId: 'host-a', profile: 'ops', payload: running }))
- await waitFor(() => expect(vi.mocked(displayRequest)).toHaveBeenCalledWith(bot, 'display.observe'))
+ await waitFor(() => expect(vi.mocked(displayRequest)).toHaveBeenCalledWith(bot, 'display.observe', expect.anything()))
expect(view.queryByText('Stopped')).toBeNull()
view.unmount()
})
diff --git a/apps/desktop/src/plugins/hermes-bots/screen-viewer-identity.test.tsx b/apps/desktop/src/plugins/hermes-bots/screen-viewer-identity.test.tsx
index 6210fca8ec0..fa660132bcc 100644
--- a/apps/desktop/src/plugins/hermes-bots/screen-viewer-identity.test.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/screen-viewer-identity.test.tsx
@@ -111,7 +111,7 @@ const emitLease = (viewer_hash: string) =>
it('holds control when the lease names the hash of the server-minted viewer id, not when it names another', async () => {
const view = render(<BotScreenPane bot={bot} />)
- await waitFor(() => expect(vi.mocked(displayRequest)).toHaveBeenCalledWith(bot, 'display.observe'))
+ await waitFor(() => expect(vi.mocked(displayRequest)).toHaveBeenCalledWith(bot, 'display.observe', expect.anything()))
await act(async () => {})
emitLease(await viewerHash('someone-else'))
@@ -125,7 +125,7 @@ it('holds control when the lease names the hash of the server-minted viewer id,
it('hands back with the minted id, never a client-generated one', async () => {
const view = render(<BotScreenPane bot={bot} />)
- await waitFor(() => expect(vi.mocked(displayRequest)).toHaveBeenCalledWith(bot, 'display.observe'))
+ await waitFor(() => expect(vi.mocked(displayRequest)).toHaveBeenCalledWith(bot, 'display.observe', expect.anything()))
await act(async () => {})
emitLease(await viewerHash(MINTED))
@@ -138,7 +138,7 @@ it('hands back with the minted id, never a client-generated one', async () => {
it('offers a forced hand-back for a human lease this window does not hold, sending {force: true} and no viewer id', async () => {
const view = render(<BotScreenPane bot={bot} />)
- await waitFor(() => expect(vi.mocked(displayRequest)).toHaveBeenCalledWith(bot, 'display.observe'))
+ await waitFor(() => expect(vi.mocked(displayRequest)).toHaveBeenCalledWith(bot, 'display.observe', expect.anything()))
await act(async () => {})
emitLease(await viewerHash(MINTED))
diff --git a/tests/hermes_cli/test_profiles.py b/tests/hermes_cli/test_profiles.py
index 4fbef4a10a0..fc8e82edead 100644
--- a/tests/hermes_cli/test_profiles.py
+++ b/tests/hermes_cli/test_profiles.py
@@ -1202,6 +1202,9 @@ def test_profile_delete_and_rename_stop_the_profiles_bot_desktop(profile_env, op
"""Deleting or renaming a profile stops its gateway, and must stop its Bot Desktop launcher too: the
Xvnc/Xfce session otherwise keeps running against a directory that no longer exists (or now belongs to
another name), holding its display number and an rfb.sock nobody can reach through status()."""
+ import time
+ from tools.bot_desktop import runtime
+
profile_dir = create_profile("coder", no_alias=True)
proc = _live_bot_desktop_launcher(profile_dir)
try:
@@ -1211,7 +1214,12 @@ def test_profile_delete_and_rename_stop_the_profiles_bot_desktop(profile_env, op
delete_profile("coder", yes=True)
else:
rename_profile("coder", "hacker")
- assert proc.wait(timeout=10) != 0, "the launcher was signalled by the profile op"
+ # The runtime reaps what it kills (a later gateway holds no Popen for the launcher), so our own
+ # Popen may see the status already collected; liveness, not the exit code, is the contract.
+ deadline = time.monotonic() + 10
+ while time.monotonic() < deadline and runtime._pid_alive(proc.pid):
+ time.sleep(0.05)
+ assert not runtime._pid_alive(proc.pid), "the launcher was not stopped by the profile op"
finally:
proc.kill()