Skip to content

feat(extension): add browser agent side panel#4164

Open
iscekic wants to merge 52 commits into
mainfrom
feat/add-extension-app
Open

feat(extension): add browser agent side panel#4164
iscekic wants to merge 52 commits into
mainfrom
feat/add-extension-app

Conversation

@iscekic

@iscekic iscekic commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the new browser extension app under apps/extension, including a native Chrome side panel, Kilo auth, model loading, tab selection, dangerous-mode eval tooling through Chrome debugger, and a gateway-backed streaming LLM harness. The side panel includes compact Kilo-styled controls, virtualized conversation history, fixed shell scrolling, and E2E coverage for the core extension flows.

Verification

Manual verification not run; no manual browser screenshots were captured for this extension scaffold.

Visual Changes

N/A

Reviewer Notes

Review focus areas: Chrome extension permissions, debugger/eval execution path, streaming chat-completions parsing, auth-token validation, and the new WXT/Playwright package setup.

iscekic added 27 commits June 22, 2026 14:55
@iscekic iscekic self-assigned this Jun 22, 2026
Comment thread apps/extension/entrypoints/sidepanel/app.tsx Outdated
Comment thread apps/extension/entrypoints/sidepanel/agent-llm-turn-runner.ts Outdated
Comment thread apps/extension/src/shared/tab-debugger.ts
@kilo-code-bot

kilo-code-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 5 Issues Found | Recommendation: Address before merge

Executive Summary

The new Firefox scripting fallback drops both eval timeouts and async-snippet support, so dangerous-mode executions can now hang indefinitely or fail on await-based snippets that already work in Chrome.

Overview

Severity Count
CRITICAL 0
WARNING 5
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx 33 Selected-tab context still serializes raw page title/URL into gateway requests (carried forward from the previous review)
apps/extension/tests/e2e/firefox-extension.test.ts 86 The temporary Firefox profile directory is still leaked if launchPersistentContext() fails
apps/extension/tests/e2e/firefox-extension.test.ts 102 Requiring backgroundScriptStatus === 'RUNNING' still makes the Firefox install check flaky
apps/extension/entrypoints/background.ts 79 The Firefox scripting fallback drops request.timeoutMs, so hanging evals can stall indefinitely
apps/extension/src/shared/tab-debugger.ts 152 The Firefox scripting fallback executes raw code in a plain function, so snippets that use await now fail only on Firefox
Files Reviewed (10 files)
  • apps/extension/entrypoints/background.ts - 1 issue
  • apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx - 1 carried-forward issue
  • apps/extension/package.json - 0 issues
  • apps/extension/src/shared/tab-debugger.test.ts - 0 issues
  • apps/extension/src/shared/tab-debugger.ts - 1 issue
  • apps/extension/tests/e2e/firefox-extension.test.ts - 2 issues
  • apps/extension/tests/e2e/firefox-selenium-e2e.ts - 0 issues
  • apps/extension/wxt.config.ts - 0 issues
  • pnpm-lock.yaml - 0 issues
  • pnpm-workspace.yaml - 0 issues
Previous Review Summaries (14 snapshots, latest commit 9eec7a8)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 9eec7a8)

Status: 3 Issues Found | Recommendation: Address before merge

Executive Summary

Selected-tab context is still forwarding raw page title/URL into gateway requests, and the new Firefox install coverage adds two test-path regressions around cleanup and MV3 background-state assertions.

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx 33 Selected-tab context still serializes raw page title/URL into gateway requests (carried forward from the previous review)
apps/extension/tests/e2e/firefox-extension.test.ts 78 The temporary Firefox profile directory is not cleaned up if launchPersistentContext() fails
apps/extension/tests/e2e/firefox-extension.test.ts 94 Requiring backgroundScriptStatus === 'RUNNING' makes the MV3 Firefox install check flaky
Files Reviewed (3 files)
  • apps/extension/package.json - 0 issues
  • apps/extension/tests/e2e/firefox-extension.test.ts - 2 issues
  • apps/extension/wxt.config.ts - 0 issues

Previous review (commit 3efee7c)

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

The new selected-tab context snapshot now forwards raw page-controlled URL/title data to the gateway, which can leak sensitive URL state and weaken the prompt boundary around trusted context.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx 33 Selected-tab context now serializes raw page title/URL into every gateway request, which can leak sensitive URL state and lets crafted titles break the pseudo-XML wrapper
Files Reviewed (7 files)
  • apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx - 1 issue
  • apps/extension/entrypoints/sidepanel/agent-footer-controls.tsx - 0 issues
  • apps/extension/src/shared/agent-conversation.ts - 0 issues
  • apps/extension/src/shared/agent-llm-harness.ts - 0 issues
  • apps/extension/src/shared/agent-llm-harness.test.ts - 0 issues
  • apps/extension/tests/e2e/kilo-api-fixture.ts - 0 issues
  • apps/extension/tests/e2e/sidebar.test.ts - 0 issues

Previous review (commit 3218fac)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • apps/extension/entrypoints/sidepanel/agent-conversation-events.tsx
  • apps/extension/tests/e2e/eval-overflow-fixture.ts
  • apps/extension/tests/e2e/sidebar.test.ts

Previous review (commit 5d7dced)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • apps/extension/entrypoints/sidepanel/agent-conversation-events.tsx
  • apps/extension/tests/e2e/sidebar.test.ts

Previous review (commit 04ce1fc)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • apps/extension/tests/e2e/conversation-rendering.test.ts

Previous review (commit 4ec7201)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
apps/extension/tests/e2e/conversation-rendering.test.ts 110 The virtualization assertion counts the spacer wrapper instead of the mounted rows, so the new coverage passes even if every message item is rendered
Files Reviewed (10 files)
  • apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx - 0 issues; previous model-catalog reload finding is resolved in the current head
  • apps/extension/entrypoints/sidepanel/agent-conversation-events.tsx - 0 issues
  • apps/extension/entrypoints/sidepanel/agent-footer-controls.tsx - 0 issues
  • apps/extension/entrypoints/sidepanel/auth-shell.tsx - 0 issues
  • apps/extension/entrypoints/sidepanel/conversation-list.tsx - 0 issues
  • apps/extension/entrypoints/sidepanel/style.css - 0 issues
  • apps/extension/package.json - 0 issues
  • apps/extension/tests/e2e/conversation-rendering.test.ts - 1 issue
  • apps/extension/tests/e2e/sidebar.test.ts - 0 issues
  • pnpm-lock.yaml - 0 issues

Previous review (commit a701fb4)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx 82 Switching organizations keeps the previous model active until the new catalog finishes loading
Files Reviewed (3 files)
  • apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx - 1 issue; previous stale retry overwrite issue resolved
  • apps/extension/tests/e2e/kilo-api-fixture.ts - 0 issues
  • apps/extension/tests/e2e/model-loading.test.ts - 0 issues

Previous review (commit 447c633)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx 82 Switching organizations keeps the previous model active until the new catalog finishes loading
Files Reviewed (3 files)
  • apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx - 1 issue; previous stale retry overwrite issue resolved
  • apps/extension/tests/e2e/kilo-api-fixture.ts - 0 issues
  • apps/extension/tests/e2e/model-loading.test.ts - 0 issues

Previous review (commit f1e2c9f)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx 281 Manual model retries are not tied to component lifetime, so stale organization-specific responses can overwrite the current catalog
Files Reviewed (4 files)
  • apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx - 1 issue; previous model-load retry/error-state finding resolved
  • apps/extension/entrypoints/sidepanel/agent-footer-controls.tsx - 0 issues
  • apps/extension/tests/e2e/kilo-api-fixture.ts - 0 issues
  • apps/extension/tests/e2e/model-loading.test.ts - 0 issues

Previous review (commit 017f3ff)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx 94 Model catalog failures still leave the panel stuck disabled with no retry or error state
Files Reviewed (3 files)
  • apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx - 1 carried-forward issue
  • apps/extension/tests/e2e/kilo-api-fixture.ts - 0 issues
  • apps/extension/tests/e2e/run-abort.test.ts - 0 issues (previous abort assertion issue fixed)

Previous review (commit f6a652f)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx 94 Model catalog failures now leave the panel stuck disabled with no retry or error state
apps/extension/tests/e2e/run-abort.test.ts 34 Abort regression can still pass on an unrelated fetch abort instead of the held chat request
Files Reviewed (10 files)
  • apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx - 1 issue
  • apps/extension/entrypoints/sidepanel/agent-footer-controls.tsx - 0 issues
  • apps/extension/src/shared/agent-chat-placeholder.ts - 0 issues
  • apps/extension/src/shared/kilo-gateway-chat-stream-client.ts - 0 issues (previous reasoning-effort issue fixed)
  • apps/extension/src/shared/kilo-gateway-chat-stream-client.test.ts - 0 issues
  • apps/extension/src/shared/organization-selection.ts - 0 issues (previous stale-selection issue fixed)
  • apps/extension/src/shared/organization-selection.test.ts - 0 issues
  • apps/extension/tests/e2e/kilo-api-fixture.ts - 0 issues
  • apps/extension/tests/e2e/model-loading.test.ts - 0 issues
  • apps/extension/tests/e2e/run-abort.test.ts - 1 carried-forward issue

Previous review (commit 946d4e7)

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
apps/extension/tests/e2e/run-abort.test.ts 34 Abort regression can pass on the models fetch cleanup instead of the held chat request
apps/extension/src/shared/kilo-gateway-chat-stream-client.ts 50 Unsupported thinking variants can still produce invalid reasoning.effort values
apps/extension/src/shared/organization-selection.ts 21 Stale current org selections can still fall back to an older stored org instead of Personal
Files Reviewed (5 files)
  • apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx - 0 issues
  • apps/extension/src/shared/agent-chat-placeholder.ts - 0 issues
  • apps/extension/tests/e2e/run-abort.test.ts - 1 issue
  • apps/extension/src/shared/kilo-gateway-chat-stream-client.ts - 1 carried-forward issue
  • apps/extension/src/shared/organization-selection.ts - 1 carried-forward issue

Previous review (commit b7354d1)

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 4
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx 182 Active runs still are not aborted when the panel unmounts, so streams and eval work can leak across sign-out or new-conversation remounts
apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx 228 The side panel still renders the full transcript, so long sessions keep growing DOM usage
apps/extension/src/shared/kilo-gateway-chat-stream-client.ts 50 Unsupported thinking variants like xhigh can still be forwarded as invalid reasoning.effort values
apps/extension/src/shared/organization-selection.ts 21 A stale current org selection can silently fall back to an older stored org instead of clearing to Personal
Files Reviewed (7 files)
  • apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx - 2 issues
  • apps/extension/entrypoints/sidepanel/agent-llm-turn-runner.ts - 0 issues
  • apps/extension/entrypoints/sidepanel/organization-credit-account.tsx - 0 issues (previous stale-selection handling improved here)
  • apps/extension/src/shared/kilo-gateway-chat-stream-client.ts - 1 issue
  • apps/extension/src/shared/kilo-gateway-chat-stream-client.test.ts - 0 issues
  • apps/extension/src/shared/organization-selection.ts - 1 issue
  • apps/extension/src/shared/organization-selection.test.ts - 0 issues

Previous review (commit 785e525)

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 4
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx 182 Starting a new conversation or signing out still does not abort the active stream/eval run, so the old panel can keep doing background work after it unmounts
apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx 228 Conversation rendering still mounts the full transcript, so long sessions keep growing side-panel DOM usage
apps/extension/entrypoints/sidepanel/organization-credit-account.tsx 42 Stale organization selections are still retained after the fetched org list changes, so later requests can keep sending an invalid x-kilocode-organizationid
apps/extension/src/shared/kilo-gateway-chat-stream-client.ts 50 Thinking variants like xhigh and instant are converted into unsupported reasoning.effort values, which can make gateway chat requests fail
Files Reviewed (5 files)
  • apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx - 2 carried-forward issues
  • apps/extension/entrypoints/sidepanel/agent-llm-turn-runner.ts - 0 issues
  • apps/extension/src/shared/kilo-gateway-chat-stream-client.ts - 1 issue
  • apps/extension/src/shared/kilo-gateway-chat-stream-client.test.ts - 0 issues
  • apps/extension/entrypoints/sidepanel/organization-credit-account.tsx - 1 carried-forward issue

Reviewed by gpt-5.4-20260305 · Input: 115K · Output: 14.7K · Cached: 534.5K

Review guidance: REVIEW.md from base branch main

Comment thread apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx
Comment thread apps/extension/src/shared/kilo-gateway-chat-stream-client.ts Outdated
Comment thread apps/extension/src/shared/organization-selection.ts
Comment thread apps/extension/tests/e2e/run-abort.test.ts Outdated
Comment thread apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx
Comment thread apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx
Comment thread apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx
Comment thread apps/extension/tests/e2e/conversation-rendering.test.ts Outdated
readonly title: string;
readonly url: string;
}): string =>
`<system_environment>\nSelected tab title: ${title}\nSelected tab URL: ${url}\nCurrent time: ${new Date().toISOString()}\nTimezone: ${new Intl.DateTimeFormat().resolvedOptions().timeZone}\n</system_environment>`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Raw tab context is forwarded upstream without sanitization

This helper serializes the page-controlled tab title and full url into every gateway request. That can leak query-string tokens, magic-link parameters, email addresses, or other sensitive URL state to app.kilo.ai, and a crafted title like </system_environment> can also break the pseudo-XML wrapper you are using for trusted context. Please redact/sanitize these fields before attaching them to the prompt.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

const { connectWithMaxRetries, findFreeTcpPort } = await loadWebExtFirefoxRemote();
const port = await findFreeTcpPort();
const userDataDir = await mkdtemp(join(tmpdir(), 'kilo-extension-firefox-e2e-'));
const context = await firefox.launchPersistentContext(userDataDir, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Temp Firefox profile directory is leaked when launch fails

userDataDir is created before launchPersistentContext(), but the try/finally only starts after this call succeeds. If Firefox fails to start, the profile directory is never removed and repeated failures can accumulate stale temp directories on CI or local machines.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

await remote.installTemporaryAddon(firefoxExtensionPath, false);
const addon = await remote.getInstalledAddon(extensionId);

expect(addon.backgroundScriptStatus).toBe('RUNNING');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: backgroundScriptStatus is too strict for an MV3 Firefox install check

This assertion assumes the add-on's background context is always running immediately after install, but MV3 background workers can be idle even when the manifest is valid and the temporary add-on installed successfully. That makes this test flaky against correct Firefox builds.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

if (scriptingApi) {
return {
ok: true,
result: await evalInTabWithScripting({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Firefox eval requests drop the timeout contract

The Chrome debugger path still forwards request.timeoutMs, but the new Firefox scripting fallback ignores it entirely. That means the same dangerous-mode eval can time out cleanly in Chromium yet hang indefinitely in Firefox if the generated snippet loops or awaits something that never resolves. Keeping the existing timeout behavior in both backends avoids browser-specific stalls.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.


const runInjectedEval = (code: string): unknown =>
// eslint-disable-next-line eslint/no-new-func, typescript-eslint/no-implied-eval, typescript-eslint/no-unsafe-call
new Function(code)();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Firefox eval fallback no longer supports await inside snippets

evalInTab() wraps tool code in an async IIFE before evaluating it, so generated snippets can use await. This fallback executes the raw body with new Function(code)(), which turns any await ... snippet into a syntax error on Firefox even though the same code works in Chrome. The two execution paths need to preserve the same async semantics.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant