Repository navigation
Model bridge: a connected CLI endpoint that answers where it was asked - #4901
Merged
Merged
Conversation
rl2 was a stopped fork thread, so #model_test refused @rl2 (a fork has no channel inbox), and the bridge skipped registering a taken name. It now declares an ExternalThread, joins requested channels on an existing one, holds it under external_process like every CLI bridge, and replies to Message.exact_reply_target instead of DMing every answer. replace=true on comms_serve_model takes over a stopped non-bridge thread of the name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dU1ViXamAaDwNWUtGY
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.
What was broken
@rl2in#model_testwas refused: "#model_test does not deliver to @rl2". Three defects stacked up:fork_execution, created by a stray fork watch). A fork has no channel inbox (NoChannelInbox.channel_recipientsreturns()), soChannelTarget.initial_deliveryexcluded it. The bridge's_registersaw a taken name and returned early.ExternalThreadshowedno_bridge, because the bridge never enteredRegistration.external_processthe wayDelivery.start(cli_bridges/shared.py) does.send(self.name, message.sender, …)), so a channel mention got its reply somewhere nobody in the channel was looking.Fix
ModelAgent.runholdsregistry.external_process(name, ProcessIdentity.capture(getpid()))for the whole serve, so the thread shows connected with a live process.message.exact_reply_target: the channel for a channel post, the sender for a DM._register: a fresh name is declared as anExternalThreadin--channels. An existing endpoint keeps its incarnation and joins any channel it's missing. A name held by another kind of thread stops the bridge with a logged reason, unless--takeoveris set. With it, the bridge deletes that stopped declaration (ThreadManagement.delete, which refuses a running thread) and declares the endpoint in its place.comms_serve_model replace=truepasses--takeover.Evidence
tests/test_model_agent_client.py+tests/test_connector_serve_model.py: 8 passed, exit 0. New cases:@rl2gets its reply in#model_testwhile the endpoint showsprocess_aliveLive check after install:
comms_serve_model rl2 … replace=true channels=#model_test, then a real@rl2post in#model_test.Generated by Claude Code