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): refuse one input on a tab change instead of ending the task

jeffreyd317e75a6ebb
diff --git a/apps/computer/local-daemon/README.md b/apps/computer/local-daemon/README.md
index 43658b50..15d64b3f 100644
--- a/apps/computer/local-daemon/README.md
+++ b/apps/computer/local-daemon/README.md
@@ -376,8 +376,11 @@ the task; `rate_limited` also puts the site (its registrable domain) in a
Once a task opens a site there, the browser tools refuse that site for the
rest of the task, and `launch_app` refuses to open it in another browser.
A change of the front tab between the task's inputs that also changed the
-number of tabs stops the task with `COMPUTER_TAB_CHANGED`, because the next
-input could reach another page. The Daemon reads the tab strip before an input
+number of tabs refuses that one input with `COMPUTER_TAB_CHANGED`, because it
+could reach another page: the Agent reads the window and goes on only when
+the front tab is its page. A tab its own input opened late, after the reads
+that followed the input, looks the same, so the task is not stopped, and the
+next input is held to the tabs the window shows then. The Daemon reads the tab strip before an input
only when the window's title in `list_windows` differs from the front tab's
title after the last input, so a tab opened or closed behind the front tab
does not stop the task: the input still reaches the task's page, and its
diff --git a/apps/computer/local-daemon/internal/linger/localtools/agent_chrome.go b/apps/computer/local-daemon/internal/linger/localtools/agent_chrome.go
index 2eddf2a9..a784b454 100644
--- a/apps/computer/local-daemon/internal/linger/localtools/agent_chrome.go
+++ b/apps/computer/local-daemon/internal/linger/localtools/agent_chrome.go
@@ -732,9 +732,8 @@ func (c *cuaSession) agentChromeTabWindow(pid, window any) (int, float64, heldTa
// checkAgentChromeTabs holds the task to the tabs it left: the Computer's
// own Chrome keeps the tab count that followed this task's last input, so a
-// different count means someone else opened or closed a tab, and the tab in
-// front may not be this task's. The task then stops, as after a reported
-// check. A strip that cannot be read, or a task that has no count yet, is not
+// different count means a tab opened or closed since, and the tab in front
+// may not be this task's. The input is then refused, once. A strip that cannot be read, or a task that has no count yet, is not
// held. The strip is read only when the window's title, which list_windows
// gives without a read, differs from the front tab's title after that input.
func (c *cuaSession) checkAgentChromeTabs(ctx context.Context, pid, window any) error {
@@ -758,10 +757,14 @@ func (c *cuaSession) checkAgentChromeTabs(ctx context.Context, pid, window any)
}
return nil
}
+ // A tab that the task's own input opened after the reads that followed
+ // it looks the same as one someone else opened, so this input is
+ // refused, not the task: the Agent reads the window and judges the
+ // front tab, and the next input is held to what the window shows now.
c.op.mu.Lock()
- c.op.chromeBlocked = "a change of tabs"
+ c.op.chromeHeld[id] = heldTabs{count: got, title: front}
c.op.mu.Unlock()
- return fmt.Errorf("COMPUTER_TAB_CHANGED: the Computer's own browser had %d tab(s) after this task's last input and has %d now, so someone else opened or closed a tab and the tab in front may not be this task's; nothing was sent. Tell the user and end the task: %w", want, got, errNotSent)
+ return fmt.Errorf("COMPUTER_TAB_CHANGED: the Computer's own browser had %d tab(s) after this task's last input and has %d now, with %q in front; a tab may have opened late after that input, or someone else changed the tabs. Nothing was sent. Read the window: go on only if the tab in front is this task's page, otherwise report what was done and end the task: %w", want, got, front, errNotSent)
}
// recordAgentChromeTabs keeps the tab count after this task's own input or
diff --git a/apps/computer/local-daemon/internal/linger/localtools/localtools_test.go b/apps/computer/local-daemon/internal/linger/localtools/localtools_test.go
index 11a3fd6b..a6147e8e 100644
--- a/apps/computer/local-daemon/internal/linger/localtools/localtools_test.go
+++ b/apps/computer/local-daemon/internal/linger/localtools/localtools_test.go
@@ -1086,7 +1086,8 @@ func TestLocalToolCuaMacAgentChromeStopsWhenSomeoneElseChangesTheTabs(t *testing
if c.op.chromeHeld[9].count != 2 {
t.Fatalf("tabs after the task's own tab=%d, want 2", c.op.chromeHeld[9].count)
}
- // A tab someone else opens stops the task before its next input.
+ // A tab someone else opens refuses the next input once, with nothing
+ // sent; the input after it is held to the tabs the window shows now.
f, err := os.OpenFile(marker, os.O_APPEND|os.O_WRONLY, 0o600)
if err != nil {
t.Fatal(err)
@@ -1097,12 +1098,15 @@ func TestLocalToolCuaMacAgentChromeStopsWhenSomeoneElseChangesTheTabs(t *testing
if _, err := c.call(t.Context(), "click", json.RawMessage(`{"pid":42,"window_id":9,"element_token":"s1:1"}`)); !errors.Is(err, errNotSent) || !strings.Contains(err.Error(), "COMPUTER_TAB_CHANGED") {
t.Fatalf("err=%v, want the tab change refused", err)
}
- if _, err := c.call(t.Context(), "press_key", json.RawMessage(`{"pid":42,"window_id":9,"key":"escape"}`)); !strings.Contains(fmt.Sprint(err), "COMPUTER_SITE_BLOCKED") {
- t.Fatalf("err=%v, want the task held", err)
- }
if calls := fixtureCalls(t, marker); len(calls) != sent {
t.Fatalf("calls after the change=%v, want none", calls[sent:])
}
+ if c.op.chromeHeld[9].count != 3 {
+ t.Fatalf("tabs held after the refusal=%d, want 3", c.op.chromeHeld[9].count)
+ }
+ if _, err := c.call(t.Context(), "click", json.RawMessage(`{"pid":42,"window_id":9,"element_token":"s1:1"}`)); err != nil {
+ t.Fatalf("input after the refusal: %v", err)
+ }
if err := c.drain(); err != nil {
t.Fatal(err)
}
@@ -1296,8 +1300,8 @@ func TestLocalToolCuaMacAgentChromeKeepsTabsItsScriptsChange(t *testing.T) {
t.Fatalf("input after the script that sent %s: %v", step.keys, err)
}
}
- // A tab someone else opens between inputs stops the next script before
- // it runs.
+ // A tab someone else opens between inputs refuses the next script
+ // before it runs.
change(`["cmd","t"]`, true)
before, _ := os.ReadFile(marker)
if _, err := c.call(t.Context(), "run_script", json.RawMessage(`{"script":"return 1"}`)); !errors.Is(err, errNotSent) || !strings.Contains(err.Error(), "COMPUTER_TAB_CHANGED") {
diff --git a/skills/builtin/catalog.yaml b/skills/builtin/catalog.yaml
index 13d5b872..852b45d6 100644
--- a/skills/builtin/catalog.yaml
+++ b/skills/builtin/catalog.yaml
@@ -219,14 +219,14 @@ skills:
version: 1.0.0
package_path: builtin/personal-profile/1.0.0
- skill_id: simplexai_humanlike_browse
- bootstrap_manifest_id: skill_manifest_simplexai_humanlike_browse_1_0_7
+ bootstrap_manifest_id: skill_manifest_simplexai_humanlike_browse_1_0_8
default_agent_types:
- anotherme
- general
manifests:
- - manifest_id: skill_manifest_simplexai_humanlike_browse_1_0_7
- version: 1.0.7
- package_path: builtin/humanlike-browse/1.0.7
+ - manifest_id: skill_manifest_simplexai_humanlike_browse_1_0_8
+ version: 1.0.8
+ package_path: builtin/humanlike-browse/1.0.8
- manifest_id: skill_manifest_simplexai_humanlike_browse_1_0_4
version: 1.0.4
package_path: builtin/humanlike-browse/1.0.4
diff --git a/skills/builtin/humanlike-browse/1.0.7/SKILL.md b/skills/builtin/humanlike-browse/1.0.8/SKILL.md
similarity index 96%
rename from skills/builtin/humanlike-browse/1.0.7/SKILL.md
rename to skills/builtin/humanlike-browse/1.0.8/SKILL.md
index 9d2e0515..9c5bfc64 100644
--- a/skills/builtin/humanlike-browse/1.0.7/SKILL.md
+++ b/skills/builtin/humanlike-browse/1.0.8/SKILL.md
@@ -76,4 +76,5 @@ If the user takes over the window, read the page and the account again before th
- When a page shows a captcha, a code or QR check, a sign-in wall or a too-many-requests message, call `report_blocker` with that kind and the page's URL at once. Then tell the user in the Room what the page asks for and that they can deal with it in that browser window, report what was done, and end the task.
- When only one item cannot be viewed, call `report_blocker` with `content_unavailable` and its URL, and skip it.
- Never pass a check yourself, switch accounts or retry around a limit.
-- When the Computer refuses input with `COMPUTER_INPUT_BUDGET`, `COMPUTER_SITE_COOLDOWN`, `COMPUTER_SITE_BLOCKED` or `COMPUTER_TAB_CHANGED`, report what was done and end the task.
+- When the Computer refuses input with `COMPUTER_INPUT_BUDGET`, `COMPUTER_SITE_COOLDOWN` or `COMPUTER_SITE_BLOCKED`, report what was done and end the task.
+- When it refuses input with `COMPUTER_TAB_CHANGED`, read the window. Go on only if the tab in front is the page this task was working on; otherwise report what was done and end the task.