fix: isolate self-hosted Letta MCP tools - #609
Closed
AlexanderZ-Band wants to merge 1 commit into
Closed
Conversation
AlexanderZ-Band
requested review from
amit-gazal-band,
bandzalkin and
nir-singher-band
September 4, 2026 18:27
AlexanderZ-Band
added a commit
that referenced
this pull request
Sep 4, 2026
PR #609 correctly classified Letta Cloud via urlsplit(...).hostname (case-insensitive, trailing-slash-agnostic) but had a whitespace gap. This branch's pagination/live-test fixes superseded #609 as the base for INT-985, but its cloud-detection rewrite regressed to a raw base_url string compare that no longer normalizes host casing, silently misclassifying a Cloud URL as self-hosted and bypassing the org_scoped+Cloud construction guard. Restore is_letta_cloud_url() with a .strip() added to close the whitespace gap, restore the case/trailing-slash regression tests dropped when the helper was removed, and add a whitespace case to both. Also fixes a stale docstring in test_rehydration_partial.py that still described the Letta exclusion as unresolved after the code below it already re-enabled Letta in that scenario. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ezy1XrPH9G8wScBdjBLvA
Collaborator
Author
|
Closing as a duplicate of #610 for the same ticket (INT-985) — #610 already fixed both critical bugs found in review of this PR (the org/user pagination-stall hang and the broken live cross-instance isolation test), and #610 has now also picked up this PR's correct case/trailing-slash-insensitive Cloud URL detection (with a whitespace-trim fix on top). See #610 for the consolidated fix. |
AlexanderZ-Band
added a commit
that referenced
this pull request
Sep 5, 2026
…tion.py tests/runtime/test_execution.py had a recurring anti-pattern: start background async work, sleep a fixed duration, then assert on mock call counts or internal state that depends on that work having finished. Under CI load the fixed sleep isn't always long enough -- this surfaced as real flakes on PR #610's CI (test_pending_next_message_present_in_context_still_executes, twice) and PR #609's CI (test_sync_removes_duplicate_from_ws_queue, a different commit, same class). tests/runtime/test_resync.py already had the correct fix pattern locally: a wait_for_condition(predicate, timeout, interval) poller. Hoist it into tests/runtime/conftest.py as the shared source of truth, and convert every settle-then-assert sleep in test_execution.py (and two in TestExecutionContextEvents/ TestExecutionContextParticipantEvents) to wait on the exact predicate the following assertion checks -- ctx._sync_complete, ctx.is_processing, ctx.queue.qsize(), or a mock call/await count. Left untouched: sleeps that are the actual behavior under test (a deliberately slow fake handler body, a real elapsed-time threshold assertion), an asyncio.sleep(0) yield-once idiom, and two sleeps whose following assertions don't actually depend on the sleep's duration. Verified with 10 repeated full-file runs, 30 repeated runs of the two previously-observed-flaky tests, and one run under artificial CPU contention -- zero failures, and the suite runs faster (~1.4s vs ~4-5s) since polling resolves as soon as the condition is true instead of always waiting out the fixed sleep. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ezy1XrPH9G8wScBdjBLvA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification
uv run pytest tests/adapters/test_letta_mcp.py tests/adapters/test_deprecation_shims.py tests/adapters/test_letta_orgscope.py -q --no-covuv run ruff check ...uv run pyrefly check src/band/adapters/letta.py src/band/integrations/letta/config.pyCloses INT-985