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): say an oversized call result belongs to a completed action

jeffrey7e65e20607a7
diff --git a/apps/computer/local-daemon/internal/uiruntime/runtime.go b/apps/computer/local-daemon/internal/uiruntime/runtime.go
index de36580c..8b5d939a 100644
--- a/apps/computer/local-daemon/internal/uiruntime/runtime.go
+++ b/apps/computer/local-daemon/internal/uiruntime/runtime.go
@@ -257,7 +257,7 @@ func (r *Runtime) Exec(hardCtx, schedulingCtx context.Context, code string) (res
if errors.Is(err, errFrameTooLarge) {
// The action has completed; reject only this call so the
// script keeps its state and can read a smaller result.
- err = c.send(hard, map[string]any{"type": "reply", "execution": execution, "id": msg.ID, "error": "UI call result exceeds byte limit"}, r.opts.Limits.MaxProtocolBytes)
+ err = c.send(hard, map[string]any{"type": "reply", "execution": execution, "id": msg.ID, "error": "UI call completed, but its result exceeds the byte limit; do not replay it"}, r.opts.Limits.MaxProtocolBytes)
}
}
if err != nil {
diff --git a/apps/computer/local-daemon/internal/uiruntime/runtime.mjs b/apps/computer/local-daemon/internal/uiruntime/runtime.mjs
index b8c056bf..502d9ef9 100644
--- a/apps/computer/local-daemon/internal/uiruntime/runtime.mjs
+++ b/apps/computer/local-daemon/internal/uiruntime/runtime.mjs
@@ -33,7 +33,7 @@ const guest = await QuickJS.create({
...options,
intrinsics: Intrinsics.ALL & ~Intrinsics.EVAL,
onUnhandledRejection(_promise, _reason, handled) {
- unhandled += handled ? -1 : 1;
+ unhandled = handled ? Math.max(0, unhandled - 1) : unhandled + 1;
},
});
const drain = compiler.compile("__uiBridge.drain()");
diff --git a/apps/computer/local-daemon/internal/uiruntime/runtime_test.go b/apps/computer/local-daemon/internal/uiruntime/runtime_test.go
index 42194a09..3d4aff2f 100644
--- a/apps/computer/local-daemon/internal/uiruntime/runtime_test.go
+++ b/apps/computer/local-daemon/internal/uiruntime/runtime_test.go
@@ -533,7 +533,7 @@ func TestOversizedDispatchResultRejectsOnlyTheCall(t *testing.T) {
r := nodeRuntime(t, func(context.Context, Call) (json.RawMessage, error) { return large, nil }, Limits{MaxProtocolBytes: 2048, MaxOutputBytes: 1024})
first := execute(t, r, `state.kept = 1; try { await ui.browser.snapshot({}); return "delivered"; } catch (error) { return error.message; }`)
second := execute(t, r, `return state.kept;`)
- if !strings.Contains(string(first.Value), "byte limit") || string(second.Value) != "1" || second.Generation != first.Generation {
+ if !strings.Contains(string(first.Value), "do not replay") || string(second.Value) != "1" || second.Generation != first.Generation {
t.Fatalf("first=%+v second=%+v", first, second)
}
}