Skip to content

feat(computer-use): headless control surface for host UIs - #1075

Merged
edenreich merged 10 commits into
mainfrom
fix/issue-1074
Aug 19, 2026
Merged

edenreich merged 10 commits into
mainfrom
fix/issue-1074

Conversation

@inference-gateway-maintainer

@inference-gateway-maintainer inference-gateway-maintainer Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #1074

Summary

Adds a headless computer-use control surface so the desktop app (and other host UIs) can configure action-gating, pause/resume sessions, and observe computer-use state changes through the infer headless --format ag-ui protocol. Three capabilities that were only wired into infer chat are now available headlessly: approval gating, pause/resume IPC, and a documented frame-delivery plan.

Changes

  • computer_use.approval config knob - three levels: never (default, current bypass behaviour), destructive (MouseClick and ActivateApp require approval), always (every computer-use tool requires approval). The StandardApprovalPolicy checks this setting instead of unconditionally bypassing all computer-use tools. Unknown values are rejected at config load (Config.Validate) and fail closed in the policy; overridable via INFER_COMPUTER_USE_APPROVAL.

  • ComputerUseControlMessage IPC type - adds {"type":"computer_use_control","action":"pause|resume"} as a recognised stdin message following the approval_response IPC pattern.

  • Working headless pause/resume - a single stdin-reader goroutine in cmd/headless.go (headlessControl) owns the IPC line stream for the json, json-pretty, and ag-ui formats — control messages work even with computer_use.approval: never and without --require-approval. Pause mirrors chat mode: agentService.CancelRequest(sessionID) + SetComputerUsePaused. Resume mirrors chat mode's restart: the pump appends the hidden "Please continue from where you left off." message and starts a new RunWithStream over the same conversation. Real ComputerUsePausedEvent/ComputerUseResumedEvent are injected into the event stream, so both renderers emit them through their normal event handling: AG-UI CUSTOM events (computer_use_paused / computer_use_resumed) and matching JSON lines with the real session request_id.

  • Channel-based approval broker - renderers no longer scan stdin; answerApproval consumes ApprovalResponse values from the control reader's channel, keeping a single stdin owner and letting approvals and control messages interleave freely.

  • Frame delivery decision - documented as host-side polling (desktop app reads the get_latest_frame source directly). AG-UI frame events are deferred; a follow-up issue may add a lightweight frame-available notification.

  • Swift floating window deprecation path - documented: once the desktop monitor ships, flip the YAML default for floating_window.enabled to false, add a deprecation notice to the Swift README, and remove after a deprecation cycle.

Comment thread internal/render/render.go Resolved
Comment thread internal/render/render.go Resolved
Comment thread internal/services/approval_policy.go Resolved
Comment thread internal/services/approval_policy.go Resolved
Comment thread internal/render/render.go Resolved
Comment thread internal/render/render.go Resolved
@edenreich

edenreich commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

@infer Can you review this PR? use /ponytail:ponytail /ponytail:ponytail-review /go /go-concurrency

From a first look I don't like that we use goto, that's a bad practice.

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Model: ollama_cloud/deepseek-v4-flash:preview · View Job

Todos

  • Read full codebase and trace the flow end-to-end
  • ponytail-review: find over-engineering in the diff
  • go idioms: check goto, select, and channel patterns
  • go-concurrency: check channel ownership and goroutine safety
  • Deliver complete review with findings and proposed fix

Pull Request

#1075

✅ Infer Result: Success

Here is my complete review of PR #1075, covering over-engineering (ponytail-review), idiomatic Go, and concurrency correctness.


ponytail-review: over-engineering findings

net: -18 lines possible from the PR diff.


Finding 1: goto done + for/select + buffered channel in renderJSON

render.go:L191-236 — the PR converts a clean for event := range events loop into a for { select { ... } } with a goto done to exit when the events channel closes. The sole reason is the controlMessages channel, which carries ComputerUseControlMessage values from answerApproval (the stdin scanner) back to the loop body.

Problem: The channel is producer-and-consumer in the same goroutine. answerApproval is called from inside the select case (case event := <-events: ... case domain.ToolApprovalRequestedEvent: answerApproval(e, stdin, controlMessages)) and blocks there until a valid approval response arrives. Control messages accumulate in the buffer until answerApproval returns. There is no concurrency — no goroutine, no parallelism — so the chan + select buys exactly nothing that a direct function call wouldn't.

Fix: Replace the channel parameter with a func(action string) callback. Inside answerApproval, call onControl(ctrl.Action) instead of controlMessages <- ctrl. This eliminates the channel, the select, and the goto — the loop collapses back to for event := range events.

Finding 2: Channel overflow risk

render.go:L188 — make(chan domain.ComputerUseControlMessage, 4). If the host sends 5+ control messages between two approval cycles, the 5th send blocks answerApproval forever. Since answerApproval runs inside the select handler, this wedges the entire render loop — no events are consumed until the goroutine hosting this select is killed.

With a callback this isn't a concern: the call is synchronous, no buffering, no blocking.

Finding 3: The AGUI renderer doesn't use the channel at all

render.go:L332 — answerApproval(ev, stdin, nil) passes nil for controlMessages. So the for/select complexity was built for the JSON renderer only, while the AGUI renderer sticks with the simple for range loop. This is a YAGNI flag: if only one of two renderers needs control-message support, the pattern should match the simpler one and not restructure both.


goto analysis (the user's specific concern)

The concern is justified. Go goto is almost never the right tool. The one place it's argued is inside a select inside a for loop, because a plain break only exits the select, not the for. But Go has break label:

loop:
    for {
        select {
        case event, ok := <-events:
            if !ok {
                break loop  // exits the for, not just the select
            }
            // ...
        }
    }

This is idiomatic Go and avoids goto entirely. However, even break label is unnecessary here since the whole for/select can vanish with the callback approach.


go-concurrency: channel ownership

The channel rule is: one goroutine owns a channel — it creates, writes, and closes it. Receivers never close. In this PR:

  • Owner: the renderJSON goroutine (creates controlMessages)
  • Producer: answerApproval (same goroutine, called inline from the select case)
  • Consumer: the select loop's case ctrl := <-controlMessages (same goroutine)

This violates no ownership rules because everything is single-goroutine. But it also means the channel is dead weight: there is no concurrent producer to synchronize with. The idiomatic Go rule "share memory by communicating" applies when goroutines need to coordinate; when everything is synchronous, a direct call is clearer.


Proposed fix: one file, two changes

File: internal/render/render.go

Change 1: answerApproval — channel parameter → callback

-func answerApproval(e domain.ToolApprovalRequestedEvent, in *bufio.Scanner, controlMessages chan<- domain.ComputerUseControlMessage) {
+func answerApproval(e domain.ToolApprovalRequestedEvent, in *bufio.Scanner, onControl func(action string)) {

Inside the loop that detects computer_use_control on stdin:

-if controlMessages != nil && json.Unmarshal(in.Bytes(), &ctrl) == nil && ctrl.Type == "computer_use_control" {
-    controlMessages <- ctrl
-}
+if onControl != nil && json.Unmarshal(in.Bytes(), &ctrl) == nil && ctrl.Type == "computer_use_control" {
+    onControl(ctrl.Action)
+}

Change 2: renderJSON — remove channel, restore for range

Delete:

var controlMessages chan domain.ComputerUseControlMessage
if stdin != nil {
    controlMessages = make(chan domain.ComputerUseControlMessage, 4)
}

Add instead:

var onControl func(string)
if stdin != nil {
    onControl = func(action string) {
        emit(map[string]any{"type": "computer_use_" + action, "request_id": ""})
    }
}

Replace:

for {
    select {
    case event, ok := <-events:
        if !ok {
            goto done
        }
        // ... switch ...
    case ctrl := <-controlMessages:
        emit(...)
    }
}
done:

With:

for event := range events {
    // ... same switch, no goto, no extra case ...
}

Change the call:

-answerApproval(e, stdin, controlMessages)
+answerApproval(e, stdin, onControl)

Change 3: RenderAGUI — no change needed

Already passes nil. The type changes to func(string) but nil is valid for both.


What stays

  • The ComputerUseControlMessage struct in ipc.go — still used for json.Unmarshal inside answerApproval, just not as a channel element type
  • The emitComputerUsePaused/emitComputerUseResumed methods in agui.go
  • The ComputerUsePausedEvent/ComputerUseResumedEvent cases in both renderers (these are domain events from the channel, not from stdin)
  • The config/computer_use.go approval knob and approval_policy.go logic — unrelated to the goto issue, no change needed

Summary

Before (PR) After (proposed)
goto done natural for range exit
for/select + break label workaround for range
buffered channel (cap 4) func(action string) callback
channel overflow risk (5th send blocks forever) synchronous call, no buffer
18 extra lines for the channel loop callback integrated into existing for range

The three new capabilities the PR adds — approval gating, pause/resume IPC, and event emission — are preserved. The only thing removed is unnecessary concurrency plumbing that a goto was gluing together.

Model: ollama_cloud/deepseek-v4-flash:preview · Exit Code: 0 · Duration: 3m 3s

Tokens: 934,529 in · 17,636 out · 952,165 total (15 requests)

Tool calls: 24 total · 100% success rate

Traces
Session: 1787142510-b1aaf597

session (headless, success)                                                  2m55s
├── chat ollama_cloud/deepseek-v4-flash:preview                               3.0s
│   ╰── POST /v1/chat/completions [inference-gateway]                         3.0s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     3.0s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               3.0s
│               ╰── POST /v1/chat/completions [inference-gateway]             3.0s [error: *errors.errorString]
├── execute_tool Read call_f5ifrkez                                          245µs
├── execute_tool Read call_7ytcji74                                          322µs
├── execute_tool Bash call_airgw1fw                                            5ms
├── execute_tool Bash call_jkoy8wf8                                            4ms
├── chat ollama_cloud/deepseek-v4-flash:preview                               3.4s
│   ╰── POST /v1/chat/completions [inference-gateway]                         3.3s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     3.3s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               3.3s
│               ╰── POST /v1/chat/completions [inference-gateway]             3.3s [error: *errors.errorString]
├── execute_tool Read call_13hx5x47                                          144µs
├── execute_tool Read call_5gt7nnfh                                          118µs
├── execute_tool Read call_6ydmjgb6                                          266µs
├── execute_tool Read call_d1dwn1zt                                           99µs
├── execute_tool Read call_7f8vu89x                                          105µs
├── chat ollama_cloud/deepseek-v4-flash:preview                              33.7s
│   ╰── POST /v1/chat/completions [inference-gateway]                        33.7s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]    33.7s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]              33.7s
│               ╰── POST /v1/chat/completions [inference-gateway]            33.7s [error: *errors.errorString]
├── execute_tool Grep call_6xv7eh37                                          350ms
├── execute_tool Grep call_13zseu40                                           74ms
├── execute_tool Read call_lh8jfr1v                                          207µs
├── chat ollama_cloud/deepseek-v4-flash:preview                              19.0s
│   ╰── POST /v1/chat/completions [inference-gateway]                        19.0s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]    19.0s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]              19.0s
│               ╰── POST /v1/chat/completions [inference-gateway]            19.0s [error: *errors.errorString]
├── execute_tool TodoWrite call_b7r686r5                                      62µs
├── chat ollama_cloud/deepseek-v4-flash:preview                               2.8s
│   ╰── POST /v1/chat/completions [inference-gateway]                         2.8s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     2.8s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               2.8s
│               ╰── POST /v1/chat/completions [inference-gateway]             2.8s [error: *errors.errorString]
├── execute_tool Read call_n108pgjs                                          222µs
├── execute_tool Grep call_2tb10mj5                                           69ms
├── chat ollama_cloud/deepseek-v4-flash:preview                              23.9s
│   ╰── POST /v1/chat/completions [inference-gateway]                        23.9s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]    23.8s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]              23.8s
│               ╰── POST /v1/chat/completions [inference-gateway]            23.8s [error: *errors.errorString]
├── execute_tool TodoWrite call_iz8djb9s                                      76µs
├── chat ollama_cloud/deepseek-v4-flash:preview                               6.4s
│   ╰── POST /v1/chat/completions [inference-gateway]                         6.4s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     6.4s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               6.4s
│               ╰── POST /v1/chat/completions [inference-gateway]             6.4s [error: *errors.errorString]
├── execute_tool Read call_fxnlcvxt                                          127µs
├── chat ollama_cloud/deepseek-v4-flash:preview                              15.8s
│   ╰── POST /v1/chat/completions [inference-gateway]                        15.8s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]    15.8s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]              15.8s
│               ╰── POST /v1/chat/completions [inference-gateway]            15.8s [error: *errors.errorString]
├── chat ollama_cloud/deepseek-v4-flash:preview                              11.8s
│   ╰── POST /v1/chat/completions [inference-gateway]                        11.8s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]    11.8s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]              11.8s
│               ╰── POST /v1/chat/completions [inference-gateway]            11.8s [error: *errors.errorString]
├── chat ollama_cloud/deepseek-v4-flash:preview                              18.6s
│   ╰── POST /v1/chat/completions [inference-gateway]                        18.6s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]    18.6s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]              18.6s
│               ╰── POST /v1/chat/completions [inference-gateway]            18.6s [error: *errors.errorString]
├── chat ollama_cloud/deepseek-v4-flash:preview                               3.7s
│   ╰── POST /v1/chat/completions [inference-gateway]                         3.7s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     3.7s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               3.7s
│               ╰── POST /v1/chat/completions [inference-gateway]             3.7s [error: *errors.errorString]
├── execute_tool TodoWrite call_zkbi7i6h                                      94µs
├── chat ollama_cloud/deepseek-v4-flash:preview                               4.1s
│   ╰── POST /v1/chat/completions [inference-gateway]                         4.0s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     4.0s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               4.0s
│               ╰── POST /v1/chat/completions [inference-gateway]             4.0s [error: *errors.errorString]
├── execute_tool TodoWrite call_0jkznfsn                                      59µs
├── chat ollama_cloud/deepseek-v4-flash:preview                               3.9s
│   ╰── POST /v1/chat/completions [inference-gateway]                         3.9s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     3.9s
│           ╰── POST /proxy/:provider/*path [inference-gateway]               3.9s
│               ╰── POST /v1/chat/completions [inference-gateway]             3.9s
├── execute_tool TodoWrite call_xvkui4jw                                      67µs
├── chat ollama_cloud/deepseek-v4-flash:preview                               3.6s
│   ╰── POST /v1/chat/completions [inference-gateway]                         3.6s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     3.6s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               3.6s
│               ╰── POST /v1/chat/completions [inference-gateway]             3.6s
├── execute_tool TodoWrite call_t7bh8dxd                                      48µs
├── chat ollama_cloud/deepseek-v4-flash:preview                               3.0s
│   ╰── POST /v1/chat/completions [inference-gateway]                         3.0s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     3.0s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               3.0s
│               ╰── POST /v1/chat/completions [inference-gateway]             3.0s [error: *errors.errorString]
├── execute_tool TodoWrite call_1ujhpo16                                      61µs
╰── chat ollama_cloud/deepseek-v4-flash:preview                              15.4s
    ╰── POST /v1/chat/completions [inference-gateway]                        15.3s
        ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]    15.3s [error: *errors.errorString]
            ╰── POST /proxy/:provider/*path [inference-gateway]              15.3s
                ╰── POST /v1/chat/completions [inference-gateway]            15.3s [error: *errors.errorString]
Stats
Tool Calls

╭───────────┬───────┬───────┬───────╮
│ Tool      │ Calls │ Fail% │ Avg   │
├───────────┼───────┼───────┼───────┤
│ Read      │ 10    │ 0%    │ 0ms   │
│ TodoWrite │ 7     │ 0%    │ 0ms   │
│ Grep      │ 3     │ 0%    │ 164ms │
│ Bash      │ 2     │ 0%    │ 5ms   │
╰───────────┴───────┴───────┴───────╯

Token Usage

╭────────────────────────────────────────┬─────────┬────────┬────────────┬─────────┬──────╮
│ Model                                  │ Prompt  │ Cached │ Completion │ Total   │ Cost │
├────────────────────────────────────────┼─────────┼────────┼────────────┼─────────┼──────┤
│ ollama_cloud/deepseek-v4-flash:preview │ 1004333 │ 0      │ 18779      │ 1023112 │ -    │
╰────────────────────────────────────────┴─────────┴────────┴────────────┴─────────┴──────╯

Sessions

╭───────────┬──────────┬──────────╮
│ Execution │ Mode     │ Sessions │
├───────────┼──────────┼──────────┤
│ headless  │ headless │ 1        │
╰───────────┴──────────┴──────────╯

Triggered by edenreich · Infer Action · OSS

Comment thread internal/services/approval_policy.go Resolved
@edenreich

Copy link
Copy Markdown
Contributor

@infer Can you address the review comments above? use /ponytail:ponytail

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Model: ollama_cloud/deepseek-v4-flash:preview · View Job

Todos

  • Read ponytail and ponytail-review skill files
  • Read go and go-concurrency skill files
  • Read the full diff to understand existing changes
  • Read changed files to see the goto and other concerns
  • Remove goto in render.go - replace with labeled break
  • Run precommit hooks and push

Pull Request

#1075

✅ Infer Result: Success

All complete. The change is pushed at 6f541ce, git status is clean, and the PR is updated automatically.

Model: ollama_cloud/deepseek-v4-flash:preview · Exit Code: 0 · Duration: 3m 52s

Tokens: 1,065,088 in · 7,285 out · 1,072,373 total (19 requests)

Tool calls: 27 total · 100% success rate

Traces
Session: 1787142838-20ac3cb1

session (headless, success)                                                  3m44s
├── chat ollama_cloud/deepseek-v4-flash:preview                               3.6s
│   ╰── POST /v1/chat/completions [inference-gateway]                         3.6s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     3.6s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               3.6s
│               ╰── POST /v1/chat/completions [inference-gateway]             3.6s [error: *errors.errorString]
├── execute_tool TodoWrite call_wkfakpvr                                      76µs
├── chat ollama_cloud/deepseek-v4-flash:preview                               2.6s
│   ╰── POST /v1/chat/completions [inference-gateway]                         2.6s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     2.6s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               2.6s
│               ╰── POST /v1/chat/completions [inference-gateway]             2.6s [error: *errors.errorString]
├── execute_tool Read call_pj9syh0s                                          197µs
├── execute_tool Read call_kkrnxx9w                                          231µs
├── execute_tool Read call_jblquf2n                                          202µs
├── execute_tool Read call_2zxhimkt                                          162µs
├── chat ollama_cloud/deepseek-v4-flash:preview                               3.0s
│   ╰── POST /v1/chat/completions [inference-gateway]                         3.0s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     2.9s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               2.9s
│               ╰── POST /v1/chat/completions [inference-gateway]             2.9s [error: *errors.errorString]
├── execute_tool Bash call_r5n735s7                                            9ms
├── execute_tool Bash call_gqu9x9s8                                            9ms
├── execute_tool Bash call_3pcg5lak                                            9ms
├── execute_tool Bash call_lby02w8j                                            9ms
├── execute_tool Bash call_lhvjuihg                                            8ms
├── chat ollama_cloud/deepseek-v4-flash:preview                               7.7s
│   ╰── POST /v1/chat/completions [inference-gateway]                         7.7s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     7.7s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               7.7s
│               ╰── POST /v1/chat/completions [inference-gateway]             7.7s
├── execute_tool Read call_0efyh0j3                                          299µs
├── execute_tool Read call_dohpeg0a                                          197µs
├── execute_tool Read call_czzaqjt1                                          196µs
├── chat ollama_cloud/deepseek-v4-flash:preview                              14.8s
│   ╰── POST /v1/chat/completions [inference-gateway]                        14.7s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]    14.7s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]              14.7s
│               ╰── POST /v1/chat/completions [inference-gateway]            14.7s [error: *errors.errorString]
├── execute_tool TodoWrite call_6pid2bnl                                      61µs
├── chat ollama_cloud/deepseek-v4-flash:preview                               4.0s
│   ╰── POST /v1/chat/completions [inference-gateway]                         4.0s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     4.0s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               4.0s
│               ╰── POST /v1/chat/completions [inference-gateway]             4.0s [error: *errors.errorString]
├── execute_tool Edit call_k1js2s1y                                          484µs
├── chat ollama_cloud/deepseek-v4-flash:preview                               2.4s
│   ╰── POST /v1/chat/completions [inference-gateway]                         2.4s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     2.4s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               2.4s
│               ╰── POST /v1/chat/completions [inference-gateway]             2.4s [error: *errors.errorString]
├── execute_tool Edit call_u73sv81y                                          187µs [error: tool_error]
├── chat ollama_cloud/deepseek-v4-flash:preview                               2.4s
│   ╰── POST /v1/chat/completions [inference-gateway]                         2.4s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     2.4s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               2.4s
│               ╰── POST /v1/chat/completions [inference-gateway]             2.4s [error: *errors.errorString]
├── execute_tool Read call_0z77n3g8                                          161µs
├── chat ollama_cloud/deepseek-v4-flash:preview                               3.0s
│   ╰── POST /v1/chat/completions [inference-gateway]                         3.0s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     3.0s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               3.0s
│               ╰── POST /v1/chat/completions [inference-gateway]             3.0s [error: *errors.errorString]
├── execute_tool Edit call_ug3afcvi                                          418µs
├── chat ollama_cloud/deepseek-v4-flash:preview                               2.3s
│   ╰── POST /v1/chat/completions [inference-gateway]                         2.3s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     2.3s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               2.3s
│               ╰── POST /v1/chat/completions [inference-gateway]             2.3s [error: *errors.errorString]
├── execute_tool Bash call_j3w6husk                                          22.2s
├── chat ollama_cloud/deepseek-v4-flash:preview                               2.0s
│   ╰── POST /v1/chat/completions [inference-gateway]                         2.0s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     2.0s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               2.0s
│               ╰── POST /v1/chat/completions [inference-gateway]             2.0s [error: *errors.errorString]
├── execute_tool Bash call_up56wt6l                                          1m35s
├── chat ollama_cloud/deepseek-v4-flash:preview                               3.4s
│   ╰── POST /v1/chat/completions [inference-gateway]                         3.4s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     3.4s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               3.4s
│               ╰── POST /v1/chat/completions [inference-gateway]             3.4s [error: *errors.errorString]
├── chat ollama_cloud/deepseek-v4-flash:preview                               2.8s
│   ╰── POST /v1/chat/completions [inference-gateway]                         2.8s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     2.8s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               2.8s
│               ╰── POST /v1/chat/completions [inference-gateway]             2.8s [error: *errors.errorString]
├── execute_tool Bash call_8fx8klg9                                           10ms
├── chat ollama_cloud/deepseek-v4-flash:preview                               2.8s
│   ╰── POST /v1/chat/completions [inference-gateway]                         2.8s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     2.8s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               2.8s
│               ╰── POST /v1/chat/completions [inference-gateway]             2.8s [error: *errors.errorString]
├── execute_tool Bash call_77abpriv                                          11.4s
├── chat ollama_cloud/deepseek-v4-flash:preview                               2.5s
│   ╰── POST /v1/chat/completions [inference-gateway]                         2.5s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     2.5s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               2.5s
│               ╰── POST /v1/chat/completions [inference-gateway]             2.5s [error: *errors.errorString]
├── execute_tool Bash call_47tv8si8                                           1.5s
├── chat ollama_cloud/deepseek-v4-flash:preview                              12.0s
│   ╰── POST /v1/chat/completions [inference-gateway]                        12.0s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]    12.0s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]              12.0s
│               ╰── POST /v1/chat/completions [inference-gateway]            12.0s [error: *errors.errorString]
├── execute_tool TodoWrite call_zhbg165m                                      66µs
├── chat ollama_cloud/deepseek-v4-flash:preview                               3.8s
│   ╰── POST /v1/chat/completions [inference-gateway]                         3.8s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     3.8s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               3.8s
│               ╰── POST /v1/chat/completions [inference-gateway]             3.8s [error: *errors.errorString]
├── execute_tool Bash call_psb2d9ct                                            9ms
├── chat ollama_cloud/deepseek-v4-flash:preview                               9.1s
│   ╰── POST /v1/chat/completions [inference-gateway]                         9.1s
│       ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     9.1s [error: *errors.errorString]
│           ╰── POST /proxy/:provider/*path [inference-gateway]               9.1s
│               ╰── POST /v1/chat/completions [inference-gateway]             9.1s [error: *errors.errorString]
├── execute_tool Memory call_8fbcf4p7                                         1.1s
╰── chat ollama_cloud/deepseek-v4-flash:preview                               4.5s
    ╰── POST /v1/chat/completions [inference-gateway]                         4.5s
        ╰── POST /proxy/ollama_cloud/chat/completions [inference-gateway]     4.5s [error: *errors.errorString]
            ╰── POST /proxy/:provider/*path [inference-gateway]               4.5s
                ╰── POST /v1/chat/completions [inference-gateway]             4.5s [error: *errors.errorString]
Stats
Tool Calls

╭───────────┬───────┬───────┬─────────╮
│ Tool      │ Calls │ Fail% │ Avg     │
├───────────┼───────┼───────┼─────────┤
│ Bash      │ 11    │ 0%    │ 11867ms │
│ Read      │ 8     │ 0%    │ 0ms     │
│ TodoWrite │ 3     │ 0%    │ 0ms     │
│ Edit      │ 3     │ 33%   │ 0ms     │
│ Memory    │ 1     │ 0%    │ 1144ms  │
╰───────────┴───────┴───────┴─────────╯

Token Usage

╭────────────────────────────────────────┬─────────┬────────┬────────────┬─────────┬──────╮
│ Model                                  │ Prompt  │ Cached │ Completion │ Total   │ Cost │
├────────────────────────────────────────┼─────────┼────────┼────────────┼─────────┼──────┤
│ ollama_cloud/deepseek-v4-flash:preview │ 1065088 │ 0      │ 7285       │ 1072373 │ -    │
╰────────────────────────────────────────┴─────────┴────────┴────────────┴─────────┴──────╯

Sessions

╭───────────┬──────────┬──────────╮
│ Execution │ Mode     │ Sessions │
├───────────┼──────────┼──────────┤
│ headless  │ headless │ 1        │
╰───────────┴──────────┴──────────╯

Triggered by edenreich · Infer Action · OSS

inference-gateway-maintainer Bot and others added 3 commits August 19, 2026 12:36
@edenreich flagged the 'goto done' as non-idiomatic. Replaced with 'break eventLoop' - a labeled break is the standard Go pattern for breaking out of a for-select loop without a goto label. Removes the 'done:' label entirely.
Move IPC handling out of the renderers into a single stdin reader in
cmd/headless.go. Pause now cancels the in-flight request and sets the
paused state (mirroring chat mode); resume appends the hidden continue
message and restarts the run. Real ComputerUsePaused/Resumed events flow
through both the JSON and ag-ui renderers, control messages work without
--require-approval, and the renderer's speculative select loop and its
self-deadlocking control channel are removed.
@edenreich
edenreich merged commit 8129b3d into main Aug 19, 2026
1 check passed
@edenreich
edenreich deleted the fix/issue-1074 branch August 19, 2026 13:52
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.175.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

edenreich added a commit that referenced this pull request Aug 19, 2026
The desktop app's monitor, screen overlay, and approval surface
(inference-gateway/desktop#135) replace the CLI's macOS-only Swift
floating window, consuming the headless control surface from #1074/#1075.

- delete internal/display/macos/ComputerUse/ (Swift app), the embed and
  FloatingWindowManager lifecycle (manager.go, manager_stub.go, types.go),
  and the cmd wiring (floating_window_darwin.go, floating_window_stub.go)
- drop floating_window from computer_use config, env overrides, and
  defaults; unknown keys stay tolerated on load (covered by test fixture)
- chat: control-event forwarding to Bubble Tea now gates on an EventBridge
  being present instead of the floating window
- release workflow: remove the Swift build step
- CI: add a macos-latest build job so darwin cgo code compiles in CI
  (was ubuntu-only, which previously masked darwin breakage)
- README: point at the desktop app for visualization
edenreich added a commit that referenced this pull request Aug 19, 2026
Resolves #1077

## Summary

Removes the macOS-only Swift floating window outright (no deprecation
cycle). The desktop app's computer-use monitor, screen overlay, and
approval surface (inference-gateway/desktop#135) are the visualization
layer, consuming the headless control surface from #1074/#1075.

## Changes

- **Deleted**: `internal/display/macos/ComputerUse/` (Swift app), the
`//go:embed` + `FloatingWindowManager` lifecycle (`manager.go`,
`manager_stub.go`, `types.go`), and the cmd wiring
(`floating_window_darwin.go`, `floating_window_stub.go`)
- **Config**: `floating_window` section removed from `computer_use.yaml`
schema, defaults, and `INFER_COMPUTER_USE_FLOATING_WINDOW_*` env
overrides. Existing config files with the old keys still load (yaml
unmarshal is lenient; covered by a test fixture that keeps the removed
keys)
- **Chat**: control-event forwarding to Bubble Tea now gates on an
EventBridge being present instead of the floating window; EventBridge
itself stays (extension bridge / control surface use it)
- **Release workflow**: Swift build step removed
- **CI**: new `build-macos` job (`macos-latest`, plain `go build`) so
darwin cgo code compiles in CI — the previous ubuntu-only matrix masked
darwin breakage (see #1078). Now trivial since the Swift embed is gone
- **README**: points at the desktop app for visualization

## Acceptance criteria

- [x] `ComputerUse/` and `cmd/chat.go` wiring removed
- [x] `floating_window` dropped; unknown keys don't break config load
(test-covered)
- [x] `infer chat` computer-use session verified against the mock
gateway (model select, prompt, reply; 42 tools registered, no
floating-window errors)
- [x] README no longer references the Swift window

## Impacted repos

- **docs**: inference-gateway/docs#578
- **desktop**: no action required — tool names unchanged; schema change
(`bundle_id` → `app_id`/`name`) noted on desktop#70 separately

## Docs

Filed: inference-gateway/docs#578
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Headless computer-use control surface for host UIs

1 participant