agent-zero icon indicating copy to clipboard operation
agent-zero copied to clipboard

Host Computer Use silently disarms after a few minutes (session-scoped metadata cleared on reconnect or refresh)

Open bdunn77 opened this issue 2 months ago • 0 comments

Summary

Host Computer Use arms correctly, works briefly, then silently returns to rearm required / disabled within a few minutes, forcing the user to re-run /computer-use on repeatedly. Reproduced on a Windows host through the A0 CLI connector.

Environment

  • Agent Zero Core: agent0ai/agent-zero @ e6d9a1157652c7b9d1f5231e06c73b6a4eda4fef
  • Connector: agent0ai/a0-connector (A0 CLI, Windows)
  • Observed live status while armed: status=persistent, trust_mode=persistent, backend=windows/windows, contract=v1

Expected

Once Computer Use is armed, it stays armed until the user disables it or the CLI/Launcher session legitimately ends.

Actual

It works for a short period (minutes), then computer_use_remote reports COMPUTER_USE_REARM_REQUIRED (or the tool prompt disappears) with no user action.

Root cause (from source)

1. Core stores enablement per-session, with no TTL

plugins/_a0_connector/helpers/ws_runtime.py

_sid_computer_use_metadata: dict[str, ComputerUseMetadata] = {}

store_sid_computer_use_metadata() records updated_at=time.time(), but nothing ever compares it to the current time. There is no minutes-scale timer anywhere in the connector plugin. The drop is event-driven, not a TTL.

2. Core deletes the metadata whenever a refresh omits the key

plugins/_a0_connector/api/ws_connector.py (approx. lines 348-357)

def _store_remote_tool_metadata(self, data, sid):
    computer_use = data.get("computer_use")
    if isinstance(computer_use, dict):
        store_sid_computer_use_metadata(sid, computer_use)
    else:
        clear_sid_computer_use_metadata(sid)   # <-- silently disarms

Also cleared on SID disconnect (ws_runtime.py, unregister_sid).

3. The CLI only includes the key when a dict is present

a0-connector src/agent_zero_cli/client.py (approx. line 1655)

if isinstance(computer_use, dict):
    payload["computer_use"] = dict(computer_use)

send_hello is re-invoked on reconnect (connection.py ~278 and ~473, app.py ~1837, session.py ~792/1035), so a WebSocket drop/reconnect that lands before the backend re-advertises is enough to clear the Core metadata. No user action required.

4. Windows uses automatic arming, so the drop is silent

a0-connector src/agent_zero_cli/computer_use.py

def _uses_automatic_arming(self) -> bool:
    return backend_id == "windows" or backend_family == "windows"

def _starting_status(self, *, allow_prompt: bool) -> str:
    if allow_prompt and not self._uses_automatic_arming():
        return "approval required"
    return _ARMING_STATUS

No platform approval prompt appears on Windows, so re-arming gives no visible signal that it had been dropped.

5. Clean CLI exit persists enabled = False

a0-connector src/agent_zero_cli/connection.py (approx. line 642)

app._computer_use.reset_enabled_for_shutdown()

which calls save_computer_use_enabled(False) (computer_use.py, reset_enabled_for_shutdown).

6. rearm required is also a distinct configured state

def _configured_status(self) -> tuple[str, str]:
    if not self.enabled:
        return "disabled", ""
    if self.trust_mode == "allow" and not _normalize_restore_token(self.restore_token):
        return "rearm required", _REARM_REQUIRED_MESSAGE
    if self.trust_mode == "allow":
        return "allow", ""
    return self.trust_mode, ""

Why this affects everyone, not one instance

Enablement is intentionally scoped to the CLI session / Launcher host-access lease (per the computer_use_remote tool contract), and Core drops it on any session churn or metadata refresh that omits the field. Nothing persists the grant across a reconnect. This is a design sharp edge any user on a reconnecting CLI/Launcher connection will hit, not local corruption.

Proposed fix

  1. Core: distinguish "CLI explicitly says computer use is off" from "this refresh did not include computer use". Only clear on explicit disable or SID unregister.
  2. CLI: re-send the current computer_use metadata on every hello/reconnect while still enabled, instead of omitting the key.
  3. CLI: do not persist enabled = False on transient shutdown paths; only on explicit user disable.
  4. UX: surface a visible notice when the session-scoped grant is dropped so the user is not silently disarmed.

Diagnostics

Set A0_COMPUTER_USE_DEBUG=1 and A0_COMPUTER_USE_DEBUG_LOG=<path> in the CLI, run /computer-use on, then compare log timestamps against the moment the tool reports rearm required or disappears. Correlate with any WebSocket reconnect in the CLI log.

bdunn77 avatar Sep 22 '26 18:09 bdunn77