Skip to content

feat(rooms): route a room post by mention or a decision model - #1955

Merged
edenreich merged 2 commits into
mainfrom
fix/issue-1945
Nov 23, 2026
Merged

edenreich merged 2 commits into
mainfrom
fix/issue-1945

Conversation

@edenreich

@edenreich edenreich commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #1945

Summary

Second step of rooms (#1943): decide which members of a room get a post. Nothing calls the router yet. #1946 logs routed posts and delivers them to member sessions.

Changes

  • internal/rooms/domain/mention.go: Mentions returns the agents a text @mentions. An @x that starts the text or follows whitespace is a mention only when x names an agent the CLI knows, with trailing punctuation dropped. @README.md, @./tester and email addresses are never mentions.
  • internal/rooms/router.go: the Router domain service.
    • A post that pings agents never asks the model. Pinged members get it with probability 1, and a pinged agent outside the room gets a @x is not in room <room>. notice. Pings are never capped.
    • A post that mentions no member asks the decision context one Decide request with one predicate per member, named by the agent and carrying its description. The evidence is the last context_posts posts and the new one, each capped at 2000 columns.
    • The post goes to at most rooms.router.max_members (default 2) of the members at or above min_confidence, the most relevant first, so a noisy room with five members doesn't get five answers. When nobody passes, fallback: top routes to the most relevant member (first in room order on a tie), and fallback: none asks the author for a mention.
    • Without rooms.router.model only mentions route, and an unmentioned post gets the mention notice.
    • The Routing result carries the mentions, the routes with their probabilities, and the notices, so [FEATURE] The daemon hosts rooms: post, deliver to members and log their replies #1946 can record them on the post.
  • config.NeedsGatewayDecisions() covers the judge's decisions backend and a rooms router model. internal/gateway/supervisor.go uses it in both the container and the binary start path, so either starts the gateway with DECISIONS_ENABLED=true.
  • rooms.router.model must be provider/model and rooms.router.max_members at least 0 (0 means the default), checked at load.
  • Docs: internal/rooms/README.md describes the router, internal/decision/README.md lists rooms as a consumer, and docs/judge-mode.md notes that a router model also enables decisions.

Notes for #1946

  • A member's name wins over a file of the same name at routing time. Delivery must keep it that way in the member's turn: headless control.go runs ExpandFileReferences on the text, which would inline a project file named tester for @tester.
  • A failed decision request returns an error, so delivery decides whether to log the post unrouted.

Tests

  • TestMentions: order, repeats, trailing punctuation, dashed names, file references, @./<name>, email addresses and unknown names.
  • TestRouterRoute, with the counterfeiter Decider fake:
    • member mentions
    • a ping of an agent outside the room (no model call), and of a member plus an outsider
    • a file reference and a dot-slash path left alone
    • the threshold
    • both fallbacks
    • no model
    • a failed request
  • TestRouterCapsUnmentionedPosts: the default cap of 2, a higher cap, and pings left uncapped.
  • TestRouterAsksOnePredicatePerMember: the request's model, its questions, and the context_posts evidence window.
  • TestNeedsGatewayDecisions and the router model check in TestRoomsConfigValidate.

No test covers the supervisor's environment, as there is no harness for its start args. Both call sites now read NeedsGatewayDecisions().

The Router in internal/rooms decides which members get a post. An @x is a
mention only when x names an agent the CLI knows, so @README.md and
@./tester stay file references and a member's name wins over a file of the
same name. Mentioned members get the post with probability 1 and no model
call, and a mentioned agent outside the room gets a notice.

A post that mentions no member asks the decision context one predicate per
member on rooms.router.model, with the member's description and the last
context_posts posts as evidence. It goes to every member at or above
min_confidence, and otherwise fallback top sends it to the most relevant
member while none asks the author for a mention. Without a model only
mentions route. The routes carry the router's probability for the post.

config.NeedsGatewayDecisions covers the judge's decisions backend and a rooms
router model, and the supervisor starts the gateway with
DECISIONS_ENABLED=true for either, in the container and the binary path.
rooms.router.model must be provider/model.
@edenreich
edenreich requested a review from a team as a code owner November 23, 2026 19:01
@github-project-automation github-project-automation Bot moved this to Todo in 2026 Nov 23, 2026
…a ping

A post that pings agents never asks the decision model. Pinged members get it
and a pinged agent outside the room gets a notice, where an outsider-only ping
used to fall through to a decision request.

rooms.router.max_members (default 2) caps how many members answer a post that
pings nobody, the most relevant first, so a noisy room with five members does
not get five answers to one question. Pings are never capped. The routes now
list the most relevant member first, and 0 means the default.
@edenreich
edenreich merged commit d545b06 into main Nov 23, 2026
14 checks passed
@edenreich
edenreich deleted the fix/issue-1945 branch November 23, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

[FEATURE] Route a room post by mention or a decision model

1 participant