Repository navigation
fix(gate): batched wakes route to their addressed message's channel #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| - A debounced (batched) gate wake that contains an addressed message — | ||
| mention, reply, or DM — now routes the turn's plain speech to that | ||
| message's channel, the same rule the direct wake path already applies. | ||
| Previously a batched wake carried no channel and fell back to the | ||
| process-global most-recent-inbound channel, so ambient traffic elsewhere | ||
| in the debounce window (or before a DM, which never updates that | ||
| fallback) received the reply. Push events are mapped to their registered | ||
| composite channel id via a new `EventGate` option `resolveRouteChannel` | ||
| (the framework supplies it); batched-wake lines now show that id instead | ||
| of the adapter's raw one. Ambient-only batches keep the legacy fallback. | ||
| - When a batch holds several addressed wakes, the newest addressed EVENT now | ||
| decides the turn's channel, not the most recently queued request. A gate | ||
| wake flushed after a busy turn no longer outranks a newer mention's direct | ||
| wake. A conversation fork takes a batched wake's route only for its home | ||
| channel, so a fork bound elsewhere shows no typing in the addressed | ||
| channel. An addressed wake with no author no longer borrows another | ||
| request's author for its turn telemetry. |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Knowledge Base Used: MCPL conversation and inference routing
Prompt To Fix With AI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not fixing this here. It already happens on
main. There,getAgentNamesbroadcasts every gate wake to the trunk, andrequestInferencesets no locus, so a fork-owned addressed batch already wakes the trunk onto the most-recent-inbound fallback. The guard leaves the trunk exactly wheremainhas it. Before the guard, the trunk would have answered inside the fork's own channel, a second reply next to the fork's.The real fix is per-agent wake provenance: work out each agent's provenance only from events it owns, and skip agents that own none. That changes gate broadcast semantics. Conversation routing is also being deprecated (chore/deprecate-conversation-routing), and no deployed config enables it. That makes it a follow-up at most, not part of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That’s fair. Given the current broadcast semantics,
mayTakeGateRouteprevents the trunk from producing a second reply in the fork’s channel while preserving the existingmainbehavior for the trunk (waking it on the legacy fallback). Fixing that remaining misroute requires per-agent provenance and changing which agents receive or act on a gate wake, which is separate from this PR—especially with conversation routing being deprecated and disabled in deployed configurations. I’ll treat the earlier finding as non-blocking and withdraw it for this change.