MoonshotAI / MoonshotAI/kimi-code

[Bug] WebBridge session tabs get reaped after ~30s idle (MV3 service worker suspension)

Open
#3,265 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

Product

Kimi WebBridge browser extension + local daemon

Environment

  • OS: Windows 11
  • Browser: Google Chrome (latest stable)
  • Extension version: v1.11.6
  • Daemon version: v1.11.6
  • Driving agent: Hermes Agent (drives the daemon at 127.0.0.1:10086 via the official kimi-webbridge skill)

Issue

When a task pauses for more than ~30 seconds between WebBridge commands (e.g. an agent doing short browser steps interspersed with longer reasoning/file work), the session tab context is lost. The next command fails with:

session "xxx" tab was closed — navigate first to recreate
find_tab: No tab with given id <id>

Root cause: Chrome terminates Manifest V3 extension service workers after ~30 seconds of idle (documented in Chrome's Service Worker Security FAQ). The WebBridge extension keeps session tab state in its service worker; when Chrome suspends the worker, the active tabs' handles are lost, and the daemon reports "tab was closed".

The daemon log shows the expected 30s connect/disconnect cycle:

[ws] hello from extension v1.11.6 (daemon v1.11.6)
[ws] extension connected
[ws] extension disconnected    # repeats every ~30s

Impact

  • Intermittent automation (any flow with >30s gaps between browser actions, e.g. agent reasoning between steps) repeatedly fails with "tab was closed".
  • find_tab(active:true) borrowing a user-viewed tab works, but session-owned tabs (navigate newTab) are lost and must be re-created, re-opening duplicate tabs each time.

Suggested fix

Keep the service worker alive while a task is active by periodically calling an extension API (e.g. chrome.runtime.getPlatformInfo() every 20–30s) or using chrome.alarms — the standard workaround for MV3 idle termination. Alternatively, persist or re-attach tab handles on worker wake-up.

Steps to reproduce

  1. Install WebBridge extension v1.11.6 + daemon v1.11.6 in Chrome on Windows.
  2. navigate newTab to any URL (returns a tabId).
  3. Wait >30 seconds without sending any command.
  4. Send snapshot / evaluate → error: session "..." tab was closed — navigate first to recreate.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the extension's Manifest V3 service-worker entry point and the session tab-handle state, then reproduce the issue with navigate newTab, a wait longer than 30 seconds, and snapshot or evaluate. Trace the connect/disconnect cycle and determine whether the chosen keepalive or re-attachment approach preserves session-owned tabs; done means those commands continue working after the idle gap without opening duplicate tabs.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.