Skip to content

Conversation

@mmarfinetz
Copy link

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

Add protocol version compatibility checking to prevent integration
failures when Computer Server is updated in VM images.

## Changes

- Add version verification in GenericComputerInterface.wait_for_ready()
- Check protocol version on both REST and WebSocket connection paths
- Raise clear error with fix instructions when versions mismatch
- Log Computer Server version info for debugging
- Add comprehensive unit tests for version compatibility

## Problem Solved

When Computer Server is updated and VM images are rebuilt, 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.

## Solution

The SDK now calls the `version` command on connection and validates
that the protocol version matches the expected version (currently 1).
If there's a mismatch, it raises a RuntimeError with clear instructions
on how to fix the issue by updating either the SDK or the VM image.

## Backward Compatibility

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

Fixes trycua#544
@f-trycua f-trycua requested a review from ddupont808 November 10, 2025 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Lume] Computer server updates break Lume

1 participant