Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix(computer): report an Antigravity Run's last text message as its reply

jeffreyf8f36c87a1ca
diff --git a/apps/computer/local-daemon/README.md b/apps/computer/local-daemon/README.md
index 9fec96e9..682fe5be 100644
--- a/apps/computer/local-daemon/README.md
+++ b/apps/computer/local-daemon/README.md
@@ -301,6 +301,8 @@ for a browser sign-in when signed out.
that ends with an open tool call keeps the Run open. The Run ends once no
tool call is open and the session has sent nothing for 15 seconds. ACP has
no event for the end of such a continuation.
+- The Run's reply is its last text message, even when tool calls follow it,
+ because Agent Service reads the reply from the stream the same way.
- The Daemon's instructions go in `_meta.antigravity.systemPrompt.append`, and
its MCP servers in the session's `mcpServers`.
- `session/request_permission` goes to the Run's permission review when the
diff --git a/apps/computer/local-daemon/internal/provider/native/antigravity_fake_test.go b/apps/computer/local-daemon/internal/provider/native/antigravity_fake_test.go
index 932b5136..6ffa9e45 100644
--- a/apps/computer/local-daemon/internal/provider/native/antigravity_fake_test.go
+++ b/apps/computer/local-daemon/internal/provider/native/antigravity_fake_test.go
@@ -191,6 +191,8 @@ func (f *agyFakeProcess) prompt(id json.RawMessage, sessionID string) {
f.update(sessionID, map[string]any{"sessionUpdate": "agent_message_chunk", "content": map[string]any{"type": "text", "text": "Found "}})
f.update(sessionID, map[string]any{"sessionUpdate": "agent_message_chunk", "content": map[string]any{"type": "text", "text": "a.txt"}})
if f.mode == "background" {
+ // A turn may end on a tool call; the reply stays the last message.
+ f.update(sessionID, map[string]any{"sessionUpdate": "tool_call", "toolCallId": "call-2", "name": "run_command", "title": "true", "kind": "execute", "status": "completed", "rawInput": map[string]any{"CommandLine": "true"}})
return
}
f.result(id, map[string]any{"stopReason": "end_turn", "usage": map[string]any{"inputTokens": 10, "outputTokens": 4, "thoughtTokens": 2, "cachedReadTokens": 3}})
diff --git a/apps/computer/local-daemon/internal/provider/native/antigravity_runtime.go b/apps/computer/local-daemon/internal/provider/native/antigravity_runtime.go
index 04380e23..2669b9b0 100644
--- a/apps/computer/local-daemon/internal/provider/native/antigravity_runtime.go
+++ b/apps/computer/local-daemon/internal/provider/native/antigravity_runtime.go
@@ -326,9 +326,8 @@ func (t *antigravityTurn) awaitBackground() bool {
t.mu.Lock()
open := len(t.tools) > 0
if open {
- // The continuation is a new message; the reply is the last one.
+ // The continuation's text is a new message.
t.textID = ""
- t.output.Reset()
}
t.mu.Unlock()
if !open {
@@ -473,7 +472,10 @@ func (t *antigravityTurn) update(params json.RawMessage, observed time.Time) {
t.requests.item("", observed)
t.mu.Lock()
if t.textID == "" {
+ // The reply is the last message, as Agent Service reads the
+ // stream, so a new message replaces the output.
t.textID = "antigravity-text-" + piRandomHex(12)
+ t.output.Reset()
}
id := t.textID
t.output.WriteString(text)
@@ -485,10 +487,9 @@ func (t *antigravityTurn) update(params json.RawMessage, observed time.Time) {
t.emit(Event{Kind: EventReasoning, ObservedAt: observed, ModelMessageID: update.MessageID, Body: text})
}
case "tool_call":
- // Text after a tool call is a new message; the reply is the last one.
+ // Text after a tool call is a new message.
t.mu.Lock()
t.textID = ""
- t.output.Reset()
t.tools[update.ToolCallID] = true
t.mu.Unlock()
t.emit(Event{
diff --git a/apps/computer/local-daemon/internal/provider/native/antigravity_runtime_test.go b/apps/computer/local-daemon/internal/provider/native/antigravity_runtime_test.go
index 73953862..c231c362 100644
--- a/apps/computer/local-daemon/internal/provider/native/antigravity_runtime_test.go
+++ b/apps/computer/local-daemon/internal/provider/native/antigravity_runtime_test.go
@@ -442,7 +442,7 @@ func TestAntigravityWaitsForACommandItMovedToTheBackground(t *testing.T) {
}
var result Event
for _, event := range events {
- if event.Kind == EventToolOutput {
+ if event.Kind == EventToolOutput && event.InvocationID == antigravityInvocationID("call-1") {
result = event
}
}