core: skip the model for human-directed web project mentions - #854
Open
irisfeng wants to merge 1 commit into
Open
core: skip the model for human-directed web project mentions#854irisfeng wants to merge 1 commit into
irisfeng wants to merge 1 commit into
Conversation
In web project chats, a message from a human that @-mentions another human member is person-to-person communication routed through the bot. Running it through the model costs a turn, adds latency, and can make the model interject where nobody asked it to. Append the message to the session transcript and end the turn silently when the incoming web group turn is human-originated, carries no approval and no attachments, and mentions another named audience member. Matching runs on the display text, not the wake envelope the spine rewrite substitutes for input.text — envelope metadata carries the sender's identity and would trip the bot-name veto for any sender whose id contains the bot label. CJK-aware matching: no-space boundaries, single-character surname prefixes stay ambiguous, ASCII tokens that merely start with a member name do not match, self- and bot-mentions are ignored, emails do not count. Turns with attachments keep the model path so inbound files are materialized and viewable instead of persisting unfetchable blob references.
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.
Problem
In web project chats, a message from a human that @-mentions another human member is person-to-person communication routed through the bot. Running it through the model costs a turn, adds latency, and can make the model interject where nobody asked it to.
Change
Append the message to the session transcript and end the turn silently (
{status: "silent"}) when the incoming web group turn:origin.kind === "human"),Details worth review attention:
input.text. For web group human turns the spine rewrite substitutes a wake envelope forinput.textand moves the typed message todisplayText; the envelope's metadata carries the sender's identity, so matching (and the bot-name veto) must read the display form — otherwise any sender whose id contains the bot label is silently excluded.src/core/orchestrator/human-mention.ts): no-space boundaries; single-character surname prefixes stay ambiguous (not human-directed); an ASCII token that merely starts with a member name (@samplevs a member named Sam) does not match; CJK-suffixed extensions (@李四这个方案) do; self- and bot-mentions are ignored; email addresses do not count.Slack-originated turns are untouched (web-surface only).
Tests
Unit tests for the matcher plus app-level integration tests through
app.turnwith a real project fixture: silent append of the typed message; the envelope-metadata veto case (sender id containing the bot label stays silent); mention-with-attachment still reaches the model; slack-originated mention still reaches the model. Full orchestrator suite passes (132 tests).Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.