Skip to content

fix(native): honor LCM_DEFAULT_URL in the rust LCM transport - #3740

Open
jeff-hykin wants to merge 2 commits into
mainfrom
claude/fix/rust_lcm_default_url
Open

fix(native): honor LCM_DEFAULT_URL in the rust LCM transport#3740
jeff-hykin wants to merge 2 commits into
mainfrom
claude/fix/rust_lcm_default_url

Conversation

@jeff-hykin

@jeff-hykin jeff-hykin commented Aug 27, 2026

Copy link
Copy Markdown
Member

liblcm reads LCM_DEFAULT_URL, so every python module lands on the bus it
names, but the rust transport hardcoded 239.255.76.67:7667. The two halves
of a pipeline then sit on different buses and nothing is delivered, with no
error on either side.

This is also why no python-to-native LCM integration test can pass: dimos'
conftest pins each pytest session to its own udpm port for isolation, which
the native side never joined.
@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This change lets the native Rust LCM transport read LCM_DEFAULT_URL so it can join the multicast bus configured for Python modules. Focused execution found that malformed udpm:// endpoints still apply a valid ttl query parameter while falling back to the default group and port, creating a mixed configuration that contradicts the fallback warning. Align the parser behavior and warning before merging.

Confidence Score: 4/5

The URL fallback path needs correction or clearer semantics before merging because malformed endpoint values can still change the effective multicast TTL.

The malformed-group and malformed-port paths were both executed with a valid TTL and consistently produced the default endpoint with an overridden TTL.

Files Needing Attention: native/rust/dimos-module/src/lcm.rs, particularly the invalid group/port handling and subsequent TTL query parsing.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex produced a proof for the posted P2 finding and built a focused Rust test for an invalid endpoint with a valid TTL, which showed the full-fallback expectation failed and the partial-fallback observation test passed.
  • T-Rex validated the contract behavior after changes, confirming that invalid endpoint variants now produce group=239.255.76.67, port=7667, ttl=42, and verified the TTL parsing logic in native/rust/dimos-module/src/lcm.rs at lines 64-75, with the warning in 64-67 followed by continued parsing and TTL assignment.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. General comment

    P2 Invalid udpm endpoint warning claims a full fallback while TTL is retained

    • Bug
      • For udpm://not-an-ip:7667?ttl=42 and udpm://239.255.76.67:not-a-port?ttl=42, options_from_url returns the default multicast group 239.255.76.67 and port 7667, but returns TTL 42 rather than default TTL 1.
    • Cause
      • After group/port parsing fails, the match arm logs a warning but does not return the default options; execution continues into the query loop, which parses and assigns ttl.
    • Fix
      • Either return options immediately after the invalid group/port warning to make behavior match the message, or revise the warning to explicitly state that endpoint defaults are retained while valid query options such as TTL are still applied. Add coverage for invalid group and invalid port with a valid TTL.

    T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "fix(native): honor LCM_DEFAULT_URL in th..." | Re-trigger Greptile

Comment thread native/rust/dimos-module/src/lcm.rs Outdated
Comment on lines +64 to +75
_ => tracing::warn!(
url,
"LCM_DEFAULT_URL has no parsable group:port; using the defaults"
),
}
}
for (key, value) in query.split('&').filter_map(|pair| pair.split_once('=')) {
if key == "ttl" {
if let Ok(ttl) = value.parse() {
options.ttl = ttl;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Invalid endpoints still override TTL

When group or port parsing fails, this branch warns that defaults are being used but continues into the query loop. URLs such as udpm://not-an-ip:7667?ttl=42 therefore retain the default group and port while changing the TTL to 42. Return immediately after the invalid-endpoint warning, or change the warning and document the intentional partial-fallback behavior, so malformed URLs cannot silently produce a hybrid configuration.

Artifacts

Temporary focused Rust test source for invalid endpoint with valid TTL

  • This is the exact temporary test source copied into the private lcm test module and executed, covering invalid group and invalid port inputs with ttl=42.

Focused full-fallback expectation test failed

  • The executed Rust test expected defaults after invalid endpoints and failed with actual TTL 42 versus default TTL 1, proving the claimed mismatch.

Focused partial-fallback observation test passed

  • The executed Rust test printed both invalid URL results with default group and port but TTL 42, confirming partial fallback behavior.

View artifacts

T-Rex Ran code and verified through T-Rex

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
4633 1 4632 39
View the top 1 failed test(s) by shortest run time
dimos.utils.test_shm::test_attach_shm_waits_out_the_race
Stack Traces | 0.311s run time
name = 'dimos_test_c2bb44fe5ea7'
slow_ftruncate = <function slow_ftruncate.<locals>.delayed at 0x7fa348e1a980>

    def test_attach_shm_waits_out_the_race(name, slow_ftruncate):
        """attach_shm blocks through the window and returns a fully sized segment."""
        result: list[object] = []
    
        def attacher() -> None:
            try:
                shm = attach_shm(name, timeout=5.0)
                result.append(shm.size)
                shm.close()
            except BaseException as exc:
                result.append(exc)
    
        t = threading.Thread(target=attacher, daemon=True)
        t.start()
        time.sleep(0.01)
        owner = SharedMemory(create=True, size=SIZE, name=name)
        t.join(timeout=6)
        owner.close()
    
>       assert result == [SIZE], f"attacher did not survive the window: {result}"
E       AssertionError: attacher did not survive the window: [0]
E       assert [0] == [65536]
E         
E         At index 0 diff: #x1B[0m#x1B[94m0#x1B[39;49;00m#x1B[90m#x1B[39;49;00m != #x1B[0m#x1B[94m65536#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
E         
E         Full diff:
E         #x1B[0m#x1B[90m #x1B[39;49;00m [#x1B[90m#x1B[39;49;00m
E         #x1B[91m-     65536,#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
E         #x1B[92m+     0,#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
E         #x1B[90m #x1B[39;49;00m ]#x1B[90m#x1B[39;49;00m

attacher   = <function test_attach_shm_waits_out_the_race.<locals>.attacher at 0x7fa348e1ab60>
name       = 'dimos_test_c2bb44fe5ea7'
owner      = SharedMemory('dimos_test_c2bb44fe5ea7', size=65536)
result     = [0]
slow_ftruncate = <function slow_ftruncate.<locals>.delayed at 0x7fa348e1a980>
t          = <Thread(Thread-1535 (attacher), stopped daemon 140337502742208)>

dimos/utils/test_shm.py:98: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Comment thread native/rust/dimos-module/src/lcm.rs Outdated
Hand-splitting on "://", "?", ":" and "&" reimplements a parser that is
already a dependency and gets the edge cases wrong.
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