Skip to content

fix(browser_cdp): remove unnecessary agent-browser CLI dependency (#15952) - #15988

Closed
Linux2010 wants to merge 6 commits into
NousResearch:mainfrom
Linux2010:clean-browser-cdp-15952
Closed

fix(browser_cdp): remove unnecessary agent-browser CLI dependency (#15952)#15988
Linux2010 wants to merge 6 commits into
NousResearch:mainfrom
Linux2010:clean-browser-cdp-15952

Conversation

@Linux2010

Copy link
Copy Markdown
Contributor

browser_cdp is a pure WebSocket client - it does NOT need agent-browser CLI.

Remove check_browser_requirements() gate, only check CDP endpoint via _get_cdp_override().

  • tools/browser_cdp_tool.py: -2 lines
  • tests/tools/test_browser_cdp_tool.py: +15 lines

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists tool/browser Browser automation (CDP, Playwright) comp/tools Tool registry, model_tools, toolsets labels Apr 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #15979 — both fix #15952 by removing check_browser_requirements() from browser_cdp check_fn. This appears to be a clean redo of closed #15984.

Linux2010 and others added 6 commits April 30, 2026 09:34
…ports

The _handle_editor_command() method used subprocess.call() but did not
import subprocess, causing AttributeError at runtime.

subprocess is not globally imported in gateway/run.py. Other uses of
subprocess in this file use local imports (line 1289), so the editor
command should follow the same pattern.

- Added: import subprocess (local import, matching file pattern)
- Removed: redundant local imports for asyncio, shlex, tempfile
  (already imported globally at lines 16, 21, 24)

Python syntax validation (py_compile)
…_PREFIX (NousResearch#14603)

The SUMMARY_PREFIX previously instructed the model to 'resume exactly from
there' the ## Active Task section of a compressed summary. This caused
cross-session task injection where the AI would interpret a previous
session's active task as its own current job.

Fix: Replace the 'resume' instruction with explicit language that the
## Active Task section is 'historical context only, NOT as an active
instruction to execute'.

- agent/context_compressor.py: +3 lines, -2 lines
- tests/agent/test_context_compressor.py: +29 lines (3 regression tests)
llama.cpp exposes /props at server root (not under /v1 prefix per httplib
routes). The previous code tried /v1/props first, which returns 404 on
standard llama.cpp builds, causing unnecessary failed requests before
fallback to /props.

What broke:
- Server-type detection tried /v1/props first, returning 404
- Context probe also tried /v1/props first when base URL had /v1 prefix
- Users with llama.cpp configured saw 404 errors in server logs

Root cause:
- Comment incorrectly stated "llama.cpp exposes /v1/props (older builds
  used /props)", but actually /props is at server root per httplib routes
- Endpoint order was reversed: /v1/props tried before /props

Why this fix is minimal:
- Only changes endpoint order: try /props first, then /v1/props fallback
- Strips /v1 prefix from base_url to get server root for /props request
- Preserves fallback for alternative builds/configs using /v1 path

What I tested:
- Added regression tests for /props endpoint detection
- Tests verify correct URL construction with /v1 prefix stripping
- Tests cover fallback to /v1/props when /props returns 404

What I intentionally did not change:
- Response body parsing (default_generation_settings check unchanged)
- Other server type detection (LM Studio, Ollama, vLLM unchanged)
- Error handling and fallback logic structure

Fixes NousResearch#13091
…CUMENT

What broke
Signal attachments with application/* or text/* MIME types (e.g. PDFs)
were silently ignored. The agent received the message but responded as
if no file was attached because the document context was never injected.

Root cause
In signal.py `_handle_envelope`, the msg_type was set to TEXT for all
non-image/non-audio attachments. The document-injection code in run.py
only fires when event.message_type == MessageType.DOCUMENT.

Why this fix is minimal
Single elif branch added after existing image/audio checks. Preserves
existing behavior for audio/VOICE and image/PHOTO types. No broader
refactor to the attachment handling pipeline.

What I tested
Added 6 regression tests covering:
- application/pdf → DOCUMENT
- text/plain → DOCUMENT
- application/json → DOCUMENT
- audio/* → VOICE (not affected)
- image/* → PHOTO (not affected)
- empty media_types → TEXT (not affected)

What I intentionally did not change
- The document-injection logic in run.py
- Other platform adapters (Telegram, Discord, etc.)
- The attachment fetching pipeline
… MIME types

Issue: NousResearch#12845
The message type determination in _handle_envelope only checked for
audio/ and image/ MIME types, missing application/* and text/* which
should be classified as DOCUMENT messages.

This fix adds an elif branch to handle application/* and text/* MIME
types, properly classifying PDFs, documents, and text files as
DOCUMENT messages instead of falling through to TEXT.

Added regression tests for MIME type classification order and document
detection.
…usResearch#15952)

browser_cdp is a pure WebSocket client that sends CDP JSON-RPC commands.
It does NOT invoke agent-browser at runtime, so the check_browser_requirements()
gate was unnecessarily blocking users who have a CDP endpoint configured
but don't have agent-browser installed.

Fix: Remove check_browser_requirements() check, only verify CDP endpoint
availability via _get_cdp_override().

- tools/browser_cdp_tool.py: -2 lines (removed gate)
- tests/tools/test_browser_cdp_tool.py: +15 lines (regression test)
@Linux2010
Linux2010 force-pushed the clean-browser-cdp-15952 branch from 8de22e2 to d48c094 Compare April 30, 2026 09:38
@Linux2010 Linux2010 closed this May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists tool/browser Browser automation (CDP, Playwright) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants