Repository navigation
refactor(agent): remove the dead computer-use pause events - #1721
Merged
Merged
Conversation
edenreich
changed the base branch from
main
to
refactor/issue-1713-typed-decode
November 6, 2026 18:36
edenreich
force-pushed
the
refactor/issue-1713-dead-computer-events
branch
from
November 6, 2026 19:38
7c02fc4 to
9c4ce1f
Compare
Nothing constructs ComputerUsePausedEvent or ComputerUseResumedEvent any more: taking over the screen goes through the screen control events. That left the pause state, its guard in the agent loop, the TUI handlers and the JSON renderer's two lines unreachable. Removes them ahead of rendering the TUI from AG-UI events, so the reducer has two fewer events to carry.
edenreich
force-pushed
the
refactor/issue-1713-dead-computer-events
branch
from
November 6, 2026 22:30
9c4ce1f to
ad0278e
Compare
edenreich
added a commit
that referenced
this pull request
Nov 6, 2026
Part of #1713. Stacked on #1722 (which stacks on #1721 and #1719). ## Summary Phase 3 of the plan: the client side of the AG-UI stream moves into the TUI and onto typed events. `headless.RunDecoder` is gone. `tui/runview.Reducer` replaces it, built on `agui.Decode`, and the daemon chat uses it. ## Changes - `internal/presentation/tui/runview` (new): `Reducer` folds a thread's AG-UI events into the chat events the TUI handlers render. `Reduce` takes a typed `agui.Event`, `Decode` takes a raw frame. The step reconstruction, the held completion and the mid-run attach tolerance are unchanged. - The hand-written frame structs (`decodedFrame`, `decodedPatch`) are deleted. The reducer switches on the SDK's event types through the `agui` aliases. - `internal/presentation/headless/run_decoder.go` and its test are deleted from `headless`, which now only writes the protocol. - `agui.InterruptPlanApproval` joins the other interrupt reasons in `agui`, replacing the unexported `headless` constant both sides needed. - The reducer reads the two activities #1722 added, so a daemon chat now shows a cancelled tool call and a conversation optimization. - `tui/daemonthread.Agent` uses the reducer. Nothing else in the TUI changes. ## Deviation from the plan The plan had the reducer return `tui.*` messages directly and bypass the handlers for daemon chats. That would leave two run renderers in the TUI (handlers for local chats, reducer for daemon chats) until the last phase. The reducer keeps returning the chat events the handlers already take, so there is one renderer at every step. The handlers stop depending on agent-owned event types in the last phase, once local chats also arrive as frames. ## Verification - The reducer's round-trip tests against `RunEncoder` moved with it and pass, with one new case for the two activities. - `go test ./...`, `task precommit:run` (0 issues) and the e2e suite with `-race` (`ok tests/e2e 168s`), which covers a daemon chat turn, reattach, direct commands and teleport. ## Downstream - no docs ticket: internal-only refactor
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
Summary
ComputerUsePausedEventandComputerUseResumedEventare never constructed outside tests. Taking over the screen goes through the screen control events, which already reach AG-UI clients as thescreenControlstate key. Everything hanging off the two events was unreachable, so this removes it: 267 lines deleted, 4 added.Changes
internal/agent/domain: the two event types and theComputerUsePausestate interface are gone.internal/agent/loop/agent.go: the "execution is paused" guard inRunWithStreamis gone. Nothing could set the flag it read.internal/presentation/tui: the pause fields and accessors on the application state and the store, the two approval coordinator handlers, the twoChatHandlercases and their contract methods are gone.internal/platform/render/render.go: thecomputer_use_pausedandcomputer_use_resumedJSON lines are gone. They were never emitted and are not documented.Why now
The plan for #1713 moves the chat TUI onto AG-UI events. Each agent event the TUI handles needs a wire form and a reducer case, so events nobody produces are removed first instead of being carried across.
Downstream