Skip to content

feat(rooms): rooms in the TUI, like a Slack channel, with members that talk like teammates - #1957

Merged
edenreich merged 27 commits into
mainfrom
feat/issue-1954
Nov 24, 2026
Merged

edenreich merged 27 commits into
mainfrom
feat/issue-1954

Conversation

@edenreich

@edenreich edenreich commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #1954. Part of #1943.

The chat TUI enters the rooms the daemon hosts, and a room reads like a Slack channel. The members talk like teammates there.

TUI

  • A Room: - / Room: #public status indicator (composer.status_bar.indicators.room, default true). Enter on the focused indicator or a mouse click opens a dropdown with No room first, then every room and its member count.
  • A left click now activates every actionable status indicator, not only Room. The status bar records where each indicator sits, and the layout records the status bar's row.
  • Inside a room the conversation area shows a Slack-like room view:
    • a pinned header with what the room spent (48.2k tokens · $0.031, what the posts in its log cost: the members' turns, and the tokens of routing, which carry no cost) and each member's presence (○ idle, ● working, ◐ waiting for approval)
    • each message under its author and time, with an author's consecutive messages grouped
    • joins and room notes as quiet lines
    • a "tester is working…" line under the posts
  • The composer posts to the room with the room trigger table of composer.yaml and the placeholder Message #public. ! and !!, and a message with an image, stay in the composer until you leave the room, and / works as usual.
  • No room brings the chat back untouched. The room view is a separate component, so the chat's conversation view never gets swapped out.
  • A plain chat reaches rooms through a sessionless daemon connection. It dials a daemon that is already running and never starts one. With no daemon the dropdown says so and the chat stays as it is. A daemon chat reuses its thread. After a reconnect the room is followed again, without a welcome.

Rooms (daemon)

  • Members talk like teammates. The turn tells a member to answer what a post asks and to keep greetings and small talk to one short line.

  • @all reaches every member with no router model. It is the one way to reach them all.

  • One member picks up a request. A post that pings nobody, a greeting included, goes to one member at a time, the best match first, as a room's new pickup says:

    • offer (default): the offered member answers it or replies exactly PASS. A PASS notes <member> passed it on - offered to <next>. and offers the post to the next best, up to max_members, and the room says so when nobody takes it.
    • top: the best match alone gets it, with no way to pass it on.

    RouteSummary reads Offered to researcher (0.94), then tester (0.81).

  • The router runs on ollama_cloud/clef:27b by default. A fresh room routed only @mentions, so "Hi all" reached nobody until rooms.router.model was set. Without an ollama_cloud key, a post that pings nobody is still logged and its author is told to ping a member. The cli-managed gateway now starts with DECISIONS_ENABLED=true by default. An empty router.model keeps @mentions-only routing.

  • Welcome on the first visit. A new join_room frame follows the room like follow_room. The first time the user ever enters a room, it logs a kind: join post, and the first max_members members welcome them.

  • Members run in Auto+Judge. A room's mode sets the agent mode its members' workers start in, auto-with-judge by default, since nobody watches a member's own chat. A judge decides the gated tool calls, and only a call it escalates still waits for the user. mode: standard keeps a human on every approval. The judge is judge.model, else the model the member runs on, so a fresh infer init works.

  • Missed posts are quoted. The posts a member missed are quoted in its turn as context, so neither the member nor its judge reads another member's words as the user's request.

  • What a room spent. Every post carries usage (tokens, cost): the tokens of routing it for the user's post, which carry no cost, and the member's turn for its answer or the room's note that it passed a post on. The turn's spend comes from the new runTokens and runCost in a headless run's RUN_FINISHED result, what the session spent during the run, an approval pause included. A turn that fails ends on RUN_ERROR, which reports no spend, so its note carries none. roomsdomain.Spent adds up the log, so a cleared room starts over, a daemon restart loses nothing, and chats with a member directly stay out. A room member's worker makes no next-step suggestion, which nobody read.

  • infer rooms clear <room> empties a room's log. It goes through a running daemon, whose new clear_room frame tells the followers with room_cleared, so an open room view empties. Each member then reads the room from its start again. Without a daemon the command clears the log where it runs. Members keep their own sessions.

  • "*" seats the user's own agents. The built-ins (main, explore, general-purpose, plan) join a room only by name, also once infer init seeded their files. SubagentInfo carries BuiltIn.

  • The room status, snapshot and posted shapes live in the rooms domain and are shared by the host, the CLI and the TUI. Posted.RouteSummary is shared too.

Fixes found while verifying

  • Room turns never ended. The serve worker names its runs itself, so a member waiting for the RUN_FINISHED of its input's run id stayed "working" forever. The first run that starts while a turn waits now becomes the turn's run. Registry refusals still match the input.
  • The @ menu kept the old order after a trigger-table switch. SetTriggerSources now forgets the menu it loaded.
  • Clicks missed indicators after a focused row's selected pill. The hit ranges now count the pill's padding.
  • Members crashed after a fresh infer init. A headless worker refused auto-with-judge without judge.model or agent.model, although the loop's judge falls back to the session's model. That startup check is gone, and the judge's tokens count under the model that judged. tools.safety.approval_behaviour: judge keeps its config-load check.
  • Ctrl+L in a room said "Session cleared" while it wiped the chat hidden under the room. Ctrl+L, /clear and /new now clear nothing inside a room, which other people read too, and point to infer rooms clear <room> or No room.

Fixes from the review

  • "Lost infer daemon" outlived the outage. A plain chat in a room kept that status after the reconnect followed the room again. It now reads #public is back.
  • The room view rendered its whole log on every event. Each new post and presence change ran the markdown renderer over every post. A member's message is now rendered once and kept by its post id, until a new width, a new snapshot or a cleared log.
  • The rooms client returned a reply while it decoded it. List and Post read the value and filled it in one return statement, an order the Go spec leaves open. They now decode first.
  • A failed turn's note claimed a spend it never had. The code and the docs now say a failed run reports none.

Verification

  • go test -race for internal/rooms/..., internal/presentation/..., cmd/rooms/..., cmd/chat/..., internal/container/... and config/..., plus the pre-commit gate on every commit.
  • New tests cover the picker, the room indicator, the hit test (wrapped and focused rows), the status bar's row in a rendered frame, the room view (header and presence, grouping, join line, follow and scroll, the render cache) and room mode with a counterfeiter FakeRooms. Room mode means entering and leaving, the trigger table, posting, ! refused, an unreachable daemon and a failed join.
  • Daemon-side tests cover the Rooms adapter (list, join, post, leave, streaming, re-follow after a reconnect, the sessionless thread and its room-is-back status), @all, the pickup (offered to the best match only, passed on, nobody taking it, top), what each post cost and a run's own spend, the suggestion skip for room workers, the first-visit welcome, worker-named runs and FirstVisit.
  • Mock run (INFER_GATEWAY_MOCK, tmux) covered:
    • clicking the indicator
    • the welcome on the first visit only
    • hi @all answered by both members
    • !ls refused
    • No room restoring the chat
    • presence changing live
    • the daemon stopping and coming back
  • Real run with routing on ollama_cloud/clef:27b and members on ollama_cloud/glm-5.3-flash, over six user agents:
    • The first visit got two one-line welcomes.
    • Before the pickup, "What's the current weather?" was judged room-wide (0.81) and all six answered, which led to pickup. The pickup itself is covered by tests, not yet by a real run.
    • A research question went to researcher only (0.94).
    • A member asking for a tool approval shows as waiting in the header, with the room's note.

Cross-repo impact

A join_room frame follows the room like follow_room. On the user's first visit
it logs a join post that the first max_members members answer with a welcome.
The Rooms port lists, joins, posts to and leaves rooms over the daemon chat's
thread. A plain chat dials a sessionless thread to a running daemon on first
use, one that never starts the daemon nor reports a placement. A reconnect
follows the joined room again without a welcome.
The rows, title and keys come from the caller, so the room switcher reuses
the agent switcher's dropdown.
The Room indicator reads Room: - or Room: #name and switches with
composer.status_bar.indicators.room. A left click on any actionable indicator
activates it like Enter on the focused one.
Picking a room in the Room dropdown joins it and shows it in place of the
conversation: a channel header, each message under its author and time,
grouped like Slack, joins and room notes as quiet lines, and who is working
below. The composer posts to the room with the room's trigger table, and !
commands stay in the composer. No room brings the chat back untouched.

A new trigger table now forgets the menu loaded under the old one.
The serve worker names its runs itself, so a member waiting for a RUN_FINISHED
of its input's run id never saw its turn end. The first run that starts while
a turn waits becomes the turn's run, and refusals still match the input.
The built-ins (main, explore, general-purpose, plan) join a room only by name,
also once init seeded their files. SubagentInfo marks them as BuiltIn.
Each member sits in the pinned header with a presence dot and idle, working
or waiting for approval, as a Slack sidebar shows who is around.
@edenreich
edenreich requested a review from a team as a code owner November 23, 2026 23:20
@edenreich edenreich added the enhancement New feature or request label Nov 23, 2026
@github-project-automation github-project-automation Bot moved this to Todo in 2026 Nov 23, 2026
A room's mode sets the agent mode its members' workers start in, and defaults
to auto-with-judge, since nobody watches a member's own chat. A judge decides
the gated calls, and only a call it escalates waits for the user. The posts a
member missed are quoted in its turn, so neither the member nor its judge reads
another member's words as the user's request.
A clear_room frame empties the log through the daemon, tells the room's
followers with room_cleared, so an open room view empties, and makes each member
read the room from its start again. Without a daemon the command clears the log
where it runs. Members keep their own sessions.
- The room view redraws only when its width changes, so typing in a room
  no longer renders every post through the Markdown renderer again.
- The rooms frame names live once in the rooms domain, shared by the
  daemon, the TUI and the CLI.
- Clearing a room drops the posts its members held. A run already going
  still answers.
- infer rooms clear clears the log here only when no daemon listens. A
  daemon that listens but does not answer keeps its log, and the command
  fails.
- A room refuses a post with an image instead of dropping the image.
- Rooms.Leave goes through Thread.unfollowRoom, and the router and the
  first-visit welcome share RoomsRouterConfig.EffectiveMaxMembers.
A fresh room routed only @mentions, so "Hi all" reached nobody until the
user set rooms.router.model. The router now defaults to the clef decision
model on ollama_cloud. Without an ollama_cloud key a post that pings nobody
still logs and tells the author to ping a member, and pings route as before.
The local gateway now starts with DECISIONS_ENABLED=true by default, since
the router needs it. An empty router.model keeps @mentions-only routing.
The room header reads "# public · 6 members · 48.2k tokens · $0.031":
every member's session plus the router's decisions.

- A member keeps the session totals its worker's terminal event reports
  (usage and result.cost) and sends them with every room_activity and in
  the room status. Totals that drop mean the session rolled over, so the
  old session's spend carries over.
- A routed post records the decision model's input tokens as
  router_tokens, kept in the room log.
- roomsdomain.Spent adds both up, and the room view shows it once the
  room spent anything. The cost shows only when the model has a price.
After a fresh infer init neither judge.model nor agent.model is set, so a
headless worker refused auto-with-judge at startup, and every room member
crashed with "the session worker exited before it answered", although each
runs on its agent file's model.

The agent loop already resolves the judge as judge.model, then the
session's current model, then agent.model. The headless startup check now
leaves it to that, since a headless run always selects a model before its
first turn. A session with no model at all still fails every gated call
closed. The judge's tokens are recorded under the model that judged
instead of an empty one.

tools.safety.approval_behaviour: judge keeps its config-load check.
Inside a room these wiped the chat hidden under it and said "Session
cleared", while the room stayed as it was. A room is read by other people
too, so it is never cleared from the chat. The configured new_session key,
/clear and /new now clear nothing there and say how to empty the room on
purpose, with infer rooms clear, or to pick No room to clear your own chat.
A post that pinged nobody went to every member the router passed, or to
all of them when the decision model judged it room-wide, so a question
like "What's the current weather?" got six answers and six runs.

A room's new pickup setting decides how one member takes it:

- offer (default): the post goes to the best match first. Its turn says it
  may answer, or reply exactly PASS. A PASS notes "<member> passed it on -
  offered to <next>." and offers the post to the next best, up to
  router.max_members members, and the room says so when nobody takes it.
- top: the best match alone gets it, with no way to pass it on.

The room-wide predicate is gone. A greeting is offered like any post, and
@ALL stays the one way to reach every member. RouteSummary reads "Offered
to researcher (0.94), then tester (0.81)." for an offered post.
The header added each member's whole session to the router's tokens, so two
one-line welcomes read "417k tokens · $1.01": the two sessions' 18 turns
since they started, direct chats included, while the welcomes cost 70.6k
tokens and $0.085. The member half never reset with infer rooms clear, it
went to 0 on a daemon restart, and a rollover was only guessed at.

- A headless run's RUN_FINISHED result carries runTokens and runCost, what
  the session spent between the run's start and its end, a run that
  suspended on an approval included.
- Every room post carries usage: routing it for the user's, the member's
  turn for its answer or the note of a failure or a pass. The header adds up
  the log, so a cleared room starts over and a restart loses nothing.
- The member's running totals, the rollover guess and the usage on
  room_activity and member status are gone.
- A room member's worker makes no next-step suggestion, which nobody read
  but which cost every turn another model call.
When every member scored below min_confidence, fallback top offered the
post to its single most relevant member, so a PASS had nobody to go to: "Can
someone else tell me a joke?" was offered to writer (0.24), writer passed,
and the room said nobody picked it up.

The fallback now lines the ranked members up like any offer, up to
max_members in a room whose pickup is offer, and the top match alone with
top.
…tory

The serve worker recorded every run input into the project's shared
arrow-up history. A room member's worker gets the turn the room composed,
so arrow-up in the chat recalled "You are writer, chatting in #public..."
instead of the user's last message. A subagent's worker recorded its parent
agent's task the same way.

A worker started for a room (INFER_INVOKED_BY=room) or by an agent
(INFER_INVOKED_BY=agent) now leaves the history alone, and still lists it.
…turns

A plain chat in a room kept "Lost infer daemon" on its status line after the
reconnect followed the room again. The sessionless thread now posts that the
room is back, next to where it posts that the daemon was lost.

The rooms client also decodes a reply before it returns it. List and Post
read the value and filled it in one return statement, an order the Go spec
leaves open.
A run that fails ends on RUN_ERROR, which carries no result, so the spend a
member read from it was always zero. The failure note now says so in the code
and the docs instead of promising a number that never arrives. The docs also
say that routing a post counts its tokens without a cost.
Every new post and activity change redrew the room by rendering the markdown
of every post in its log. A member's message is now kept by its post id and
rendered again only for a new width, a new snapshot or a cleared log. The
unused RoomView.Room is gone.
@edenreich
edenreich merged commit 81be893 into main Nov 24, 2026
14 checks passed
@edenreich
edenreich deleted the feat/issue-1954 branch November 24, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

[FEATURE] Rooms in the TUI: a Room status indicator with a dropdown to switch rooms

1 participant