cua icon indicating copy to clipboard operation
cua copied to clipboard

Fix Computer Server/Lume version compatibility (Issue #544)

Open mmarfinetz opened this issue 1 month ago • 0 comments

Summary

Adds protocol version compatibility checking between Computer SDK and Computer Server to prevent integration failures when Computer Server is updated in VM images.

Problem

When Computer Server is updated and VM images are rebuilt with new versions, there was no version checking between the Computer SDK (client) and Computer Server (running in VMs). This caused silent failures or confusing errors when protocol versions didn't match (Issue #544).

Solution

  • Added version verification in GenericComputerInterface.wait_for_ready()
  • Checks protocol version on both REST and WebSocket connection paths
  • Raises clear error with fix instructions when versions mismatch
  • Logs Computer Server version info for debugging
  • Includes comprehensive unit tests for version compatibility

Changes

  • Modified: libs/python/computer/computer/interface/generic.py

    • Added EXPECTED_PROTOCOL_VERSION = 1 constant
    • Calls version command on connection and validates protocol version
    • Provides helpful error message with upgrade instructions on mismatch
    • Logs version info: Computer Server version: {package} (protocol: {version})
  • Added: libs/python/computer/tests/test_version_compatibility.py

    • Tests compatible versions connect successfully
    • Tests incompatible versions raise clear errors
    • Tests backward compatibility with servers missing version info
    • Tests WebSocket fallback path version checking

Backward Compatibility

Old Computer Server instances without version info will log a warning but continue to work, ensuring backward compatibility.

Testing

from computer import Computer

async with Computer(provider_type="lume") as computer:
    # Version checking happens automatically
    # Logs: "Computer Server version: 0.1.29 (protocol: 1)"
    screenshot = await computer.interface.screenshot()

Fixes #544

mmarfinetz avatar Nov 07 '25 19:11 mmarfinetz