Repository navigation
feat(rooms): approve or reject a member's tool call from the room - #1963
Merged
Merged
Conversation
…ecision A member whose run suspends on a tool call, such as one the judge rejected and the member escalated, now posts the call to its room as kind approval, with the judge's reason and the member's justification. A client decides it with the new decide_room_approval frame, approve or reject. The member resumes its run with that decision, the room logs who decided as kind decision, and the client gets room_approval_decided. The first decision wins and a later one is refused. A call resumed from the member's own chat, or one whose run ended first, is closed in the room the same way. A run suspended on anything else, such as a question, still waits in the member's own chat with a note.
The room view shows a member's call waiting for you with its note and [ Approve ] [ Reject ] while it is open. A click on either decides it, and alt+y or alt+n decide the newest open call. The keys are chat_room_approve and chat_room_reject in keybindings.yaml, since ctrl+y is the composer's redo. A refusal, such as a call already decided, shows as an error. The layout records the row the conversation area starts on, so a click maps onto the room's buttons the way it maps onto the status indicators.
…at shows A room's mode never took effect after the daemon started. The daemon read rooms.yaml once at its start, and a member's worker kept the mode it was spawned with, so a room switched to mode: standard still ran its members in auto-with-judge or auto, and a delete ran without asking. The rooms host now reads its settings through a function the daemon backs with a fresh config load, so an edit reaches the next post, the last good settings standing in for a file that does not load. Every member turn resolves its room from those settings and sends set_mode with the room's mode before its run input, so a worker that started under the old mode switches too. Inside a room the chat's mode indicator showed the chat's own mode, which says nothing about the members. It now names the room's mode, such as #public > STANDARD, from the room's snapshot and the mode each member turn reports on room_activity, and shift+tab is held back there, pointing at rooms.yaml. No room shows the chat's own mode again. Verified in tmux against the tokenless mock: with the room switched from auto to standard while the daemon ran, the unfixed build deleted the file without approval, and this build held the call in the room until alt+y approved it.
…report Inside a room the indicator fell back to STANDARD whenever the daemon reported no mode for the room, which a daemon of an older build never does. So a room that daemon ran in auto-with-judge showed #public > STANDARD while its members wrote files without asking. It now shows the room alone, #public, until the daemon reports the mode. Verified in tmux against the tokenless mock with the binary of a daemon started before this branch: the chat at the branch head showed #public > STANDARD while the writer wrote the file unasked, and this build shows #public.
A room's call expired after five minutes. The agent gave up on every approval after ApprovalTimeout, so a member's call nobody had decided yet failed with "approval request timed out", and the room said it was decided in the member's own chat. A daemon worker suspends its run on an approval as an interrupt until a client resumes it, and the registry already stops a suspended thread nobody follows. So the worker sets no deadline of its own. tools.safety.approval_timeout now bounds the wait, five minutes by default and 0 waiting until it is decided, and every session worker the daemon launches gets 0. The local chat and a one-shot headless run keep five minutes. Verified in tmux with the user's rooms.yaml and a real model: a Write call left undecided for 6m42s still waited in the room, and approving it wrote the file.
The room drew its own [ Approve ] [ Reject ] under a member's call, with a click hit test and alt+y / alt+n keys, beside the approval box every tool call of the chat already uses. Now the newest open call of the room on screen opens in that box, naming the member and the room, with its diff preview, and the answer goes to the room. A room's call offers no Auto-Approve, since a room never switches its member's mode. Esc rejects it in the room too, through the same answer the box gives. A call decided elsewhere or a room the chat leaves takes the call off the box, and the chat's own approval keeps the box until it is answered. The room's buttons, the chat_room_approve and chat_room_reject bindings and the layout's ConversationTop, kept only for clicks on those buttons, are gone. Verified in tmux with the user's rooms.yaml and a real model: Enter on Approve wrote the file, Esc rejected the call and wrote nothing, and Auto-Approve never showed.
edenreich
added a commit
that referenced
this pull request
Nov 24, 2026
…infer sessions (#1968) ## Summary The daemon is the process that hosts sessions, not the place to act on them. Yet `infer daemon` carried `workspaces`, `run`, `stop` and `teleport`, so `infer daemon stop` stopped one session, and nothing stopped the daemon itself. Cleaning up a daemon meant reading `~/.infer/run/daemon.pid` and killing it by hand, which is how a daemon from a stale build kept running members in the wrong mode during testing of #1963. Now `infer daemon` starts and stops the process, the session commands live under `infer sessions`, and a stop ends everything the daemon runs gracefully. ```bash infer daemon # start it infer daemon stop # stop it, and everything it runs, gracefully infer sessions workspaces # moved from infer daemon, unchanged infer sessions run|stop|teleport <session-id> # moved from infer daemon, unchanged ``` ### `infer daemon stop` - **It stops the daemon this user runs**, the one holding the lock on `~/.infer/run/daemon.pid`. It sends SIGTERM, waits for the daemon's own shutdown, and kills it if it still runs after a minute. - **A pid file no daemon holds is left alone.** A daemon that crashed leaves its file behind, and that pid may name another process by now, so the pid counts only while the daemon holds the file's lock. - **Stopping no daemon is not an error.** It prints `no infer daemon is running` and exits 0. - **It needs no binding**, so it also stops a daemon from another build that would refuse a client's hello. - `infer daemon` takes no arguments, so a leftover `infer daemon run <id>` fails instead of starting a daemon. ### `infer sessions` `workspaces`, `run`, `stop` and `teleport` move from `cmd/daemon` to `cmd/sessions` unchanged, apart from naming their argument `<session-id>`. The command tree now mirrors the bounded contexts: the daemon hosts the sessions context, it does not own its verbs. ### Everything the daemon runs shuts down gracefully - **Session workers** already did: the daemon sends each an `interrupt`, closes its stdin, and the worker ends its turn and cleans up. - **Scheduled, heartbeat and A2A runs and subagents did not.** `agentheadless.Run` started them with `exec.CommandContext`, whose cancel is a SIGKILL, so a run never got to stop its MCP servers, browser and background shells. `process.TerminateOnCancel` now sends SIGTERM and gives the run 25 seconds before a kill. `infer headless` already shuts down on SIGTERM. - **The scheduler left running jobs behind.** Each job ran on `context.Background()`, so a stop waited 30 seconds and then let the job run on for up to 30 minutes after the daemon exited. The scheduler now cancels its jobs on stop and waits for them. - **Windows** has no SIGTERM, so there `infer daemon stop` kills the daemon. Its session workers still clean up as their stdin closes, but one-shot runs outlive it. This is marked as a `shortcut:` on `daemon.Stop`, to be replaced by a stop frame over the binding once windows needs one. `infer daemon workspaces`, `run`, `stop <id>` and `teleport` are gone. Use `infer sessions workspaces`, `run`, `stop` and `teleport`. There are no deprecated aliases, since keeping them under `infer daemon` would keep the daemon tied to the session verbs. The docs, the examples' Taskfiles and READMEs, and the chat's error hint use the new commands. ## Verification - **End to end in tmux against the tokenless mock** (`INFER_GATEWAY_MOCK`, an isolated `HOME` and binding port), with three children of the daemon running: a chat session worker, a room member holding a `Write` call for approval, and a heartbeat run whose mock turn stalls forever. - `infer daemon stop` printed `stopped the infer daemon (pid 98322)` and returned in 0.13s, with no infer process left. - The daemon log shows every child running its own shutdown (`stopping background shell service`, `stopping job supervisor`, `shutting down agent containers`), the heartbeat run included, the member's pending approval moving to `Cancelled`, then `heartbeat service stopped` and `daemon stopped.` - A second `infer daemon stop` printed `no infer daemon is running`. - `TestStopStopsOnlyTheDaemonHoldingThePidFile`: no pid file, a pid file no daemon holds (its process is not signalled), and the daemon holding it (stopped, its pid returned). - `TestStopKillsAProcessThatIgnoresTheRequestOnceGracePasses`: a process that traps SIGTERM is killed once the grace passes, not before. - `TestACancelledRunShutsDownOnItsOwnBeforeAnyKill`: a cancelled run gets to run its SIGTERM handler. It fails without the change (`lines = ["ready"]`, killed before the handler ran). - `TestCommandTopology` lists `sessions`. `go test -race` for `cmd/...`, `internal/daemon`, `internal/platform/process`, `internal/agent/headless` and `internal/scheduler/...`, plus the pre-commit gate. - **Not run:** the Kubernetes teleport examples whose Taskfiles now call `infer sessions`, which need a cluster. The edit there is the command name only. ## Cross-repo impact - inference-gateway/docs#1307 updates the CLI page, `cli.md`: `infer daemon stop`, the session commands under `infer sessions`, and the workspace listing as `infer workspaces list`, which #1970 moves there from `infer sessions workspaces`. - inference-gateway/infrastructure: its README mentions `infer daemon teleport`. - A code search finds no use of these commands in the desktop app or the opentask extension, which talk to the daemon over the binding.
edenreich
added a commit
that referenced
this pull request
Nov 24, 2026
…build (#1972) ## Summary Closes #1966. A daemon runs until `idle_exit` passes with no threads and no clients, and every dev build declares the version `dev`, so a chat built from newer code joined an older daemon without a word, and whatever the new code added on the daemon's side was silently missing. That is how the room approvals of #1963 never appeared during testing: the daemon and its members ran a branch without them. - **The daemon declares a build identity.** Its hello ack carries `build`, the SHA-256 of its executable, which tells two dev builds of one version apart and two releases too. - **A chat that joins a daemon of another build says so once** and keeps working: ```text ✗ infer daemon runs another build than this chat, so what this build changed there is missing - stop it (pid 86806) and run again ``` Both `infer chat --daemon` and a plain chat's rooms warn, on the first connection and again only if a reconnect lands on yet another build. A daemon that declares no build predates this change and counts as another build. - **Released builds compare the same way**, so a chat after an upgrade notices a daemon still running the previous version. - `docs/daemon.md` describes the notice under the chat TUI section. ## Verification - **In tmux against the tokenless mock**, with an isolated `HOME` and binding port: - a daemon built from `main` and a chat built from this branch: the notice above appeared with the daemon's real pid, and a turn ran to `Done.` - the same binary as daemon and chat: no notice - `TestBuildNoticeTellsAnotherBuildApart`: the same build, another build and a daemon declaring none, with and without a pid file. - `TestSessionlessThreadSaysOnceThatTheDaemonRunsAnotherBuild`: a plain chat's rooms dial warns once across two requests, and a same-build daemon never warns. - `TestThreadHandsTheBuildNoticeOverOnce`: the `--daemon` chat path hands the notice over once. - `go test -race` for `internal/daemon` and `internal/presentation/tui/daemonthread`, golangci-lint, the import check and `task precommit:run`. - **Not run:** Windows. ## Cross-repo impact - inference-gateway/docs#1309 adds the notice to the CLI page, `cli.md`, next to `infer daemon stop`.
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.
Summary
Closes #1958. Part of #1943.
Room members run in Auto+Judge by default, so the only call that still needs a person is one the judge rejected and the member escalated. Until now it waited in the member's own chat, and you had to leave the room and resume
room-<room>-<agent>to decide it. Now the room shows the call, and the chat opens it in the approval box every tool call uses, so you decide it without leaving the room, like answering in a Slack channel.Testing it turned up three more bugs, fixed here too. A room in
mode: standardstill ran its members without asking, because the room's mode never took effect after the daemon started. The chat's mode indicator showed the chat's own mode instead of the room's. And a member's call expired after five minutes, while the room claimed it was decided in the member's own chat.Rooms (daemon)
kind: approval. The post carries the call in a newapprovalfield (id,tool,arguments) and the note it came with as its text: the judge's reason and the member's justification. A run always suspends on one interrupt, so a waiting member holds at most one call.decide_room_approval(room,member,tool_call_id,decision:approveorreject) decides it. The member resumes its run with arun_agent_inputresume entry,resolvedorcancelled, the way the daemon chat answers an interrupt. The room logsYou approved tester's Bash call.askind: decision, and the client that decided getsroom_approval_decided.RUN_ERRORwithtester's call was already decided. Anything butapproveorrejectis refused, so a room cannot switch a member to auto-accept.kind: decisionpost withoutapproval.decision, such astester's Bash call was decided in its own chat.roomsdomain.OpenApprovalsreads which approval posts are still open from the log, for the host's tests and every client.TUI
wants to run Bash {"command":"go test ./..."}and the note. The header keeps◐ waiting for approval.writer in #public asks to run this., above the note. It offers Approve and Reject but no Auto-Approve, and the answer goes to the room throughRooms.Decide, Esc's rejection included. The room draws no buttons of its own.tui.RoomsgainsDecide.A room's mode takes effect, and the chat shows it
rooms.yamlonce, at its start. An edit, such as a room'smode, never reached a running daemon, so a room switched tostandardkept running its members inauto-with-judgeorauto. The rooms host now reads its settings through a function the daemon backs with a fresh config load (roomsSettingsincmd/daemon), so an edit reaches the next post. A config that does not load keeps the last good settings.set_modewith the room's mode before its run input, the frame the daemon chat sends for its own worker, so a worker that started under the old mode switches too.#public ▸ STANDARD, instead of the chat's own. The room'smodereaches the TUI on its snapshot and on everyroom_activity, which now carries the mode the member's turn runs in.#public, rather than claiming▸ STANDARDfor members that may run in any mode.modeinrooms.yamltakes precedence, so shift+tab there only says#public's mode is set in rooms.yaml (rooms.public.mode). No room shows the chat's own mode again, and shift+tab switches it as usual.A member's call waits until someone decides it
approval request timed out, and the room said it was decided in the member's own chat.tools.safety.approval_timeoutnow bounds the wait,5mby default, and0waits until it is decided. Every session worker the daemon launches gets0. Its run suspends on the approval as an interrupt until a client resumes it, and the registry already stops a suspended thread nobody follows. The local chat and a one-shot headless run keep five minutes.The issue's open questions
Known limit
A decision from the room that crosses one from the member's own chat in flight loses to it at the registry, which takes the first resume, while the room already logged the room's decision. The window is the time a resume takes to reach the daemon. It is named in
member.decide's doc comment.Verification
go test ./...,golangci-lintand the import check, plus the pre-commit gate on every commit.INFER_GATEWAY_MOCK, an isolatedHOMEand binding port), with awritermember in#public. The room started inmode: auto, androoms.yamlwas switched tomode: standardwhile the daemon ran before@writer delete dummy.txt:565149b5): the writer ranrm dummy.txtwithout asking and the file was gone, the room showed no mode, and shift+tab switched the chat's own mode to▶ PLAN.#public ▸ AUTOon entry and#public ▸ STANDARDonce the edit applied, and shift+tab was refused. The call waited aswants to run Bash {"command":"rm dummy.txt"}, the file still in place, and approving it loggedYou approved writer's Bash call.and the resumed run deleted the file. The writer's worker had been spawned with--mode auto, so the switch happened on the running worker.9a0a5b1bshowed#public ▸ STANDARDwhile that daemon ran the writer inautoand it wrotedummy.txtwithout asking. With9ed9242ethe indicator shows#public.~/.inferconfig:rooms.yamlwithmode: standard,pickup: offerand every agent,ollama_cloud/glm-5.3-flashthrough the local gateway, andWrite a dummy.txt file in the current diroffered to the writer rather than pinged:writer in #public asks to run this.and the new file's diff, ←/→ moved between Approve and Reject only, and Enter on Approve loggedYou approved writer's Write call.and wrote the fileYou rejected writer's Write call.and wrote nothing60eeb189, a call left undecided for five minutes failed withapproval request timed outand the room said it was decided in the member's own chat. With it, a call left for 6m42s still waited, and approving it wrote the file. The writer's worker ran withINFER_TOOLS_SAFETY_APPROVAL_TIMEOUT=0.mode: auto-with-judge: the mock judge rejectedDelete {"path":"dummy.txt"}, the writer escalated it withRequestApproval, the room posted it with the judge's reason and the writer's justification, and approving it deleted the file.TestEveryTurnRunsInTheRoomsModeAsItIsNow(theset_modeframe before every run input, following an edit),TestRoomsSettingsFollowRoomsYaml(an edit read on the next use, the last good settings kept), andTestARoomShowsItsOwnModeAndHoldsBackShiftTab(a snapshot without a mode shows the room alone).resolvedand reject withcancelledroom_approval_decidedOpenApprovalsandDecision.Validin the domain.Rooms.Decideagainst a fake daemon, its confirmation and its refusal.TestAMembersCallIsDecidedInTheApprovalWindow: the call in the approval box with who asks and no Auto-Approve, Approve and Reject reachingRooms.Decide, a refusal shown as an error and the call offered again, a call decided elsewhere or a room left taking it off the box, and the chat's own approval keeping itTestAnApprovalIsAnsweredWhereItCameFrom: the box's answer and Esc's rejection go to the room for a room's call and to the agent for the chat's ownTestAnApprovalWaitsAsLongAsApprovalTimeoutSays(on a fake clock: five minutes by default, a set timeout, and0never giving up) andTestWorkerArgsAndEnv(every session worker getsINFER_TOOLS_SAFETY_APPROVAL_TIMEOUT=0).Cross-repo impact
kind: approvalpost with Approve and Reject that senddecide_room_approval, and treat a laterkind: decisionpost with the sameapproval.idas closing it. It can also show the room'smodefrom the snapshot and fromroom_activity.decide_room_approvaland thealt+y/alt+nkeys, which are gone: the call now opens in the approval box. It does not yet cover the room's mode in the indicator, shift+tab held back in a room,rooms.yamledits taking effect without a restart, ortools.safety.approval_timeout.