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): keep Antigravity tool calls valid and start resumed Runs early
jeffrey67ac339736ad
diff --git a/apps/computer/local-daemon/README.md b/apps/computer/local-daemon/README.mdindex 3e988987..ce09fa00 100644--- a/apps/computer/local-daemon/README.md+++ b/apps/computer/local-daemon/README.md@@ -280,14 +280,20 @@ for a browser sign-in when signed out.stored is not a usable session: `session/load` accepts it, but the promptthen fails, so Linger never assigns one. A stored session replays at leastthe prompt that made it, so a load that replays no prompt, or that- Antigravity refuses, ends as `session_not_found` before anything is- emitted, and the Run continues once in a new session. A Run yields to the- scheduler only after native work, because its session holds no prompt- before that.+ Antigravity refuses, ends as `session_not_found` before the prompt is sent.+ A resumed Run reports its turn-started event before `session/load`,+ because loading takes seconds and the Room shows the Agent working from+ that event. A Run yields to the scheduler only after native work, because+ its session holds no prompt before that.+- A tool call is named by Antigravity's own tool name, such as+ `run_command`; its title is the whole command line, which the call's+ redacted input already shows.- The Daemon's instructions go in `_meta.antigravity.systemPrompt.append`, andits MCP servers in the session's `mcpServers`.- `session/request_permission` goes to the Run's permission review when the- Context has one, with `execute` calls reviewed as shell commands. Otherwise+ Context has one, with `execute` calls reviewed as shell commands from+ `rawInput.CommandLine`. A completed `run_command` whose `rawOutput.exit_code`+ is not zero finishes as failed. Otherwisethe adapter selects the allow option, as Pi runs without review.- Antigravity reports a model error, such as a rejected API key, as reply textand ends the turn with `end_turn`. With no structured signal, such a Rundiff --git a/apps/computer/local-daemon/internal/provider/events_regression_test.go b/apps/computer/local-daemon/internal/provider/events_regression_test.goindex 43e01e8b..16dca8c5 100644--- a/apps/computer/local-daemon/internal/provider/events_regression_test.go+++ b/apps/computer/local-daemon/internal/provider/events_regression_test.go@@ -19,6 +19,16 @@ func TestFailedToolRemainsFailed(t *testing.T) {}}+func TestToolNameFitsTheGatewayLimit(t *testing.T) {+ name := strings.Repeat("\u00e9", 211)+ for _, kind := range []native.EventKind{native.EventToolCall, native.EventToolOutput} {+ event := normalizeMessage(native.Event{Kind: kind, InvocationID: "call-1", ToolName: name}, "operation-1").(map[string]any)+ if got := utf8.RuneCountInString(event["tool_name"].(string)); got > 200 {+ t.Fatalf("%s tool_name has %d characters", kind, got)+ }+ }+}+func TestFirstTurnPublishesNativeSessionBeforeExecution(t *testing.T) {event := normalizeMessage(native.Event{Kind: native.EventStatus, TurnID: "turn-first", SessionID: "thread-created"}, "operation-first").(map[string]any)session, ok := event["session"].(map[string]any)diff --git a/apps/computer/local-daemon/internal/provider/executor.go b/apps/computer/local-daemon/internal/provider/executor.goindex 91d45c52..af3dded5 100644--- a/apps/computer/local-daemon/internal/provider/executor.go+++ b/apps/computer/local-daemon/internal/provider/executor.go@@ -730,7 +730,9 @@ func normalizeMessage(message native.Event, operationID string) any {if callID == "" {callID = stableEventID("call", operationID+"\x00"+message.ToolName+"\x00"+message.Body)}- toolName := message.ToolName+ // The Runner Gateway caps a tool name at 200 characters and fails the+ // Operation on a longer one; a Runtime may name a tool by its arguments.+ toolName := clip(message.ToolName, 200)if toolName == "" {toolName = "provider_tool"}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.goindex f79e16fc..a27e8ccc 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@@ -125,6 +125,9 @@ func (f *agyFakeProcess) handle(id json.RawMessage, method string, params map[stf.fail(id, -32603, "session could not be loaded")return}+ if f.mode == "load-hang" {+ select {}+ }// Loading replays the stored conversation before answering; an// id Antigravity never stored loads with nothing to replay.if f.mode != "unknown-session" {@@ -154,7 +157,7 @@ func (f *agyFakeProcess) prompt(id json.RawMessage, sessionID string) {map[string]any{"content": "List files", "status": "in_progress", "priority": "high"},map[string]any{"content": "Report", "status": "pending", "priority": "low"},}})- f.update(sessionID, map[string]any{"sessionUpdate": "tool_call", "toolCallId": "call-1", "title": "ls", "kind": "execute", "status": "pending", "rawInput": map[string]any{"CommandLine": "ls", "WaitMsBeforeAsync": 5000}})+ f.update(sessionID, map[string]any{"sessionUpdate": "tool_call", "toolCallId": "call-1", "name": "run_command", "title": "ls", "kind": "execute", "status": "pending", "rawInput": map[string]any{"CommandLine": "ls", "WaitMsBeforeAsync": 5000}})if f.mode == "permission" || f.mode == "permission-no-reject" {command := os.Getenv(agyFakeCommandEnv)if command == "" {diff --git a/apps/computer/local-daemon/internal/provider/native/antigravity_runtime.go b/apps/computer/local-daemon/internal/provider/native/antigravity_runtime.goindex 0a1d9280..16e20864 100644--- a/apps/computer/local-daemon/internal/provider/native/antigravity_runtime.go+++ b/apps/computer/local-daemon/internal/provider/native/antigravity_runtime.go@@ -163,6 +163,11 @@ func (t *antigravityTurn) exchange(prompt string, servers []any) Outcome {failed := func(code, message string) Outcome {return Outcome{Status: statusFailed, FailureCode: code, Error: message, ElapsedMs: time.Since(started).Milliseconds()}}+ // A resumed session is known before agy loads it, which takes seconds,+ // so the Run starts now; a new session reports its id once agy names it.+ if spec.ResumeID != "" {+ t.started(spec.ResumeID, started)+ }if err := acpInitialize(t.runCtx, conn); err != nil {return failed("protocol_incompatible", "Antigravity ACP handshake failed: "+err.Error())}@@ -224,11 +229,8 @@ func (t *antigravityTurn) exchange(prompt string, servers []any) Outcome {t.mu.Unlock()dispatched := time.Now()t.requests.begin("", dispatched)- if spec.ExposeTurnStarted {- // The turn-started status carries the session, which is the- // checkpoint a first Run reports for its new session.- reused := false- t.emit(Event{Kind: EventStatus, Status: "running", TurnID: "antigravity-turn-" + piRandomHex(12), SessionID: session.SessionID, ProcessReused: &reused, SentAt: dispatched})+ if spec.ResumeID == "" {+ t.started(session.SessionID, dispatched)}raw, err = conn.call(t.runCtx, "session/prompt", map[string]any{"sessionId": session.SessionID,@@ -333,6 +335,7 @@ func (t *antigravityTurn) handle(frame acpFrame) {type acpUpdate struct {SessionUpdate string `json:"sessionUpdate"`Content json.RawMessage `json:"content"`+ Name string `json:"name"`MessageID string `json:"messageId"`ToolCallID string `json:"toolCallId"`Title string `json:"title"`@@ -346,8 +349,18 @@ type acpUpdate struct {} `json:"entries"`}+// started reports the turn-started status, which carries the session: the+// checkpoint a first Run reports for its new session.+func (t *antigravityTurn) started(sessionID string, at time.Time) {+ if !t.spec.ExposeTurnStarted {+ return+ }+ reused := false+ t.emit(Event{Kind: EventStatus, Status: "running", TurnID: "antigravity-turn-" + piRandomHex(12), SessionID: sessionID, ProcessReused: &reused, SentAt: at})+}+// resumeRefused marks an outcome whose retained session Antigravity does-// not hold; nothing was emitted, so the executor may start a fresh session.+// not hold.func (t *antigravityTurn) resumeRefused(outcome Outcome) Outcome {outcome.ResumeRefused = truereturn outcome@@ -525,8 +538,13 @@ func antigravityReview(call acpUpdate, workspace string) permission.Request {return request}-// antigravityToolName is the tool's own title, or its kind without one.+// antigravityToolName is the tool's own name, such as run_command. The+// title is a fallback only: Antigravity titles a command with its whole,+// unredacted command line, which the call's input already carries.func antigravityToolName(update acpUpdate) string {+ if update.Name != "" {+ return update.Name+ }if update.Title != "" {return update.Title}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.goindex 87df8bf4..10129cbb 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@@ -2,6 +2,7 @@ package nativeimport ("bufio"+ "context""encoding/json""os""path/filepath"@@ -112,7 +113,7 @@ func TestAntigravityRunsOneTurnOverACP(t *testing.T) {if !reflect.DeepEqual(kinds, want) {t.Fatalf("kinds=%v", kinds)}- if call.ActivityKind != ActivityCommand || call.InvocationID != result.InvocationID || call.Input["command"] != "ls" || result.Output != "a.txt" || result.Status != "completed" {+ if call.ToolName != "run_command" || call.ActivityKind != ActivityCommand || call.InvocationID != result.InvocationID || call.Input["command"] != "ls" || result.Output != "a.txt" || result.Status != "completed" {t.Fatalf("call=%+v result=%+v", call, result)}if events[1].ID == events[5].ID || events[5].ID != events[6].ID {@@ -237,8 +238,8 @@ func TestAntigravityReportsAnUnknownRetainedSessionAsNotFound(t *testing.T) {if outcome.Status != statusFailed || outcome.FailureCode != "session_not_found" || !outcome.ResumeRefused || outcome.SessionID != "" {t.Fatalf("outcome=%+v", outcome)}- // Nothing reached the Room, so the executor may start afresh.- if len(events) != 0 {+ // The Run started on the retained session before agy refused it.+ if len(events) != 1 || events[0].Kind != EventStatus || events[0].SessionID != "moved-session" {t.Fatalf("events=%+v", events)}if requests := h.requests(t); len(requests["session/prompt"]) != 0 {@@ -380,3 +381,23 @@ func TestAntigravityRunCommandMapsToSharedCommandShape(t *testing.T) {}}}++func TestAntigravityStartsAResumedRunBeforeTheSessionLoads(t *testing.T) {+ h := newAgyHarness(t, "load-hang", nil)+ ctx, cancel := context.WithCancel(t.Context())+ defer cancel()+ run, err := h.runtime.Start(ctx, "again", RunSpec{Dir: h.dir, ResumeID: "earlier-session", ExposeTurnStarted: true})+ if err != nil {+ t.Fatal(err)+ }+ select {+ case started := <-run.Events:+ if started.Kind != EventStatus || started.TurnID == "" || started.SessionID != "earlier-session" {+ t.Fatalf("first event=%+v", started)+ }+ case <-time.After(10 * time.Second):+ t.Fatal("the Run did not start while its session was loading")+ }+ cancel()+ drainAgy(t, run)+}diff --git a/contracts/generated/go/teamhubinternal/openapi.gen.go b/contracts/generated/go/teamhubinternal/openapi.gen.goindex 4d9d5a34..973b9bd8 100644--- a/contracts/generated/go/teamhubinternal/openapi.gen.go+++ b/contracts/generated/go/teamhubinternal/openapi.gen.go@@ -1321,13 +1321,16 @@ func (e RuntimeHumanInteractionCreatedStatus) Valid() bool {// Defines values for RuntimePermissionActionRuntime.const (- RuntimePermissionActionRuntimeClaude RuntimePermissionActionRuntime = "claude"- RuntimePermissionActionRuntimeCodex RuntimePermissionActionRuntime = "codex"+ RuntimePermissionActionRuntimeAntigravity RuntimePermissionActionRuntime = "antigravity"+ RuntimePermissionActionRuntimeClaude RuntimePermissionActionRuntime = "claude"+ RuntimePermissionActionRuntimeCodex RuntimePermissionActionRuntime = "codex")// Valid indicates whether the value is a known member of the RuntimePermissionActionRuntime enum.func (e RuntimePermissionActionRuntime) Valid() bool {switch e {+ case RuntimePermissionActionRuntimeAntigravity:+ return truecase RuntimePermissionActionRuntimeClaude:return truecase RuntimePermissionActionRuntimeCodex:diff --git a/contracts/generated/typescript/src/generated/teamhub-internal/types.ts b/contracts/generated/typescript/src/generated/teamhub-internal/types.tsindex 58113d94..ac92b50e 100644--- a/contracts/generated/typescript/src/generated/teamhub-internal/types.ts+++ b/contracts/generated/typescript/src/generated/teamhub-internal/types.ts@@ -1682,7 +1682,7 @@ export interface components {};RuntimePermissionAction: {/** @enum {string} */- runtime: "claude" | "codex";+ runtime: "claude" | "codex" | "antigravity";/** @enum {string} */surface:| "shell"diff --git a/contracts/openapi/components/agent-runtime-state.yaml b/contracts/openapi/components/agent-runtime-state.yamlindex 67e3c4d7..3da827d2 100644--- a/contracts/openapi/components/agent-runtime-state.yaml+++ b/contracts/openapi/components/agent-runtime-state.yaml@@ -1800,7 +1800,7 @@ components:additionalProperties: falserequired: [runtime, surface, tool]properties:- runtime: { type: string, enum: [claude, codex] }+ runtime: { type: string, enum: [claude, codex, antigravity] }surface:type: stringenum: [shell, file_edit, connected_app, browser, computer, web, other]