Skip to content

fix(tests): fix flakey porcelain test#1900

Merged
leshy merged 1 commit intodevfrom
paul/fix/flakey-porcelain-test
Apr 22, 2026
Merged

fix(tests): fix flakey porcelain test#1900
leshy merged 1 commit intodevfrom
paul/fix/flakey-porcelain-test

Conversation

@paul-nechifor
Copy link
Copy Markdown
Contributor

@paul-nechifor paul-nechifor commented Apr 22, 2026

Problem

Closes DIM-XXX

Solution

Breaking Changes

How to Test

Contributor License Agreement

  • I have read and approved the CLA.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 22, 2026

Greptile Summary

This PR introduces a _rpyc_connect helper in remote_module_source.py that wraps rpyc.connect with an exponential-backoff retry loop (up to 2 seconds) on ConnectionRefusedError. This addresses a flaky test race condition where the RPyC server was not yet accepting connections at the moment the client fixture attempted to connect.

Confidence Score: 5/5

Safe to merge — targeted, well-scoped retry fix with no breaking changes.

The change is small and focused: it adds a retry loop that only triggers on ConnectionRefusedError and is capped at 2 seconds. The logic is correct, no existing behaviour is removed, and the fix directly addresses the stated flakiness cause.

No files require special attention.

Important Files Changed

Filename Overview
dimos/porcelain/remote_module_source.py Adds _rpyc_connect helper with exponential-backoff retry on ConnectionRefusedError, fixing a race condition between server startup and client connect in tests.

Sequence Diagram

sequenceDiagram
    participant Test as Test Fixture
    participant Client as Dimos.connect()
    participant Retry as _rpyc_connect
    participant Server as RPyC Server

    Test->>Server: start_rpyc_service()
    Test->>Client: Dimos.connect(host, port)
    Client->>Retry: _rpyc_connect(host, port)
    loop Until deadline 2s or success
        Retry->>Server: rpyc.connect(host, port)
        alt Server not ready yet
            Server-->>Retry: ConnectionRefusedError
            Retry->>Retry: sleep with exponential backoff
        else Connected
            Server-->>Retry: Connection
            Retry-->>Client: rpyc.Connection
        end
    end
    Client-->>Test: Dimos instance
Loading

Reviews (1): Last reviewed commit: "fix(tests): fix flakey porcelain test" | Re-trigger Greptile

@leshy leshy merged commit 1e9208e into dev Apr 22, 2026
4 checks passed
@leshy leshy deleted the paul/fix/flakey-porcelain-test branch April 22, 2026 05:36
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.

2 participants