Repository navigation
feat(chat): render a local chat's runs through AG-UI by default - #1728
Merged
Merged
Conversation
edenreich
force-pushed
the
feat/issue-1713-loopback-default
branch
5 times, most recently
from
November 6, 2026 22:32
6f81a70 to
498f7c3
Compare
Base automatically changed from
fix/issue-1713-approve-before-running
to
main
November 6, 2026 22:32
…irect one A rejection from the judge was written to stderr, which printed over the screen while the TUI owned the terminal. The encoder now stays off stderr for such a host. A prompt the agent gave up on held the run, since the encoder waited for an answer that nobody needed any more. A timeout or a spent time budget only showed once the user answered. The agent's prompts now carry a Done channel that closes when it stops waiting, and AnswerApproval and AnswerQuestions let go on it. Both are shared, so a serve worker gets this too. A run that hit its time budget or turn limit failed with a sticky error. A local chat completes it, as it does without AG-UI, and a serve worker still fails it for its exit code.
Nothing drove the question form, a cancel, a queued message, todos, a provider error, auto-approve, a plan decided either way, a sandbox prompt, a judge rejection or a time budget ending a run through the TUI. These tests do, and the same suite proves either path. startLocalChat now runs its tests in parallel, which keeps them well under a minute apart from the time budget's.
infer chat now takes the path a daemon chat takes: the encoder writes each run and the reducer reads it back, so both chats share one mapping. Setting chat.agui_loopback to false falls back to the handlers reading the agent directly. CI's e2e job now covers the new default, and a second step keeps the fallback honest by running the local chat tests on the direct path.
edenreich
force-pushed
the
feat/issue-1713-loopback-default
branch
from
November 6, 2026 22:32
498f7c3 to
eacc802
Compare
Contributor
|
🎉 This PR is included in version 0.246.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Part of #1713. Stacked on #1727.
Summary
infer chatnow renders its runs through AG-UI by default, the path a daemon chat takes: the encoder writes each run and the reducer reads it back, so both chats share one mapping.chat.agui_loopback: false(INFER_CHAT_AGUI_LOOPBACK=false) falls back to the handlers reading the agent directly.This also closes the gaps #1725 listed, and one it did not know about.
Gaps closed
RunEncoderwrote it to stderr while the TUI owned the terminal, which only showed in Auto+Judge mode.RunEncoderDeps.Quietkeeps a run off stderr for such a host.ToolApprovalRequestedEventandUserQuestionRequestedEventnow carry aDonechannel that closes when the agent stops waiting, andrender.AnswerApprovalandrender.AnswerQuestionslet go on it.Changes
internal/presentation/tui/loopback: a prompt's wait ends once the encoder has moved past it, so a late answer goes nowhere. A completion loses its limit flags before the encoder sees it.internal/platform/render: both answer functions select onDoneas well as the broker. A nilDonenever fires, so other emitters behave as before.internal/agent/loop: the approval, sandbox and question prompts closeDonewhen they return.config:chat.agui_loopbackdefaults totrue, andinfer initwrites it to new config files.tests/e2e/chat_tui_flows_test.go(new): question form, cancel, queued message, todos, provider error, auto-approve, plan reject, plan approve-each-step, sandbox prompt, judge rejection and a time budget ending a run with a prompt open.startLocalChatruns its tests in parallel, which keeps the added CI time small.Verification
synctestdeadlock on the answer functions, the stream staying open, andmax_duration_reachedsurfacing as an error.go test -race ./...on all 120 packages,task precommit:run, and the full e2e suite with the loopback on and off.infer chatand writes its result file, gives the same result onmainand here. It has no permanent test.Behavior change
Tools completed (1/1 successful) - preparing response...instead ofStarting response..., because the wire has no step start event.Still different from a daemon chat
Not in this PR
ChatEventdispatch from the TUI handlers, the last step of [TASK] Refactor the chat TUI to render its agent runs through the AG-UI protocol #1713, and the plan bypass with it.Seen while testing, not changed here
/tasksreports it is unavailable, the same as onmain.Downstream
chat.agui_loopbackis listed indocs/configuration-reference.md. A docs follow-up forinference-gateway/docsis not filed.