Skip to content

"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/

Python

docs(browser): grep wrapper docstring claims multi-line call but implementation is split-and-check (Resolves #340) (#381)

Rāna(Bass Ver.)c3a76b964da0
diff --git a/browser/agent-harness/cli_anything/browser/utils/domshell_backend.py b/browser/agent-harness/cli_anything/browser/utils/domshell_backend.py
index 0b8c2a17f..d344a2b3f 100644
--- a/browser/agent-harness/cli_anything/browser/utils/domshell_backend.py
+++ b/browser/agent-harness/cli_anything/browser/utils/domshell_backend.py
@@ -831,15 +831,10 @@ def grep(
"""Search for pattern in the accessibility tree.
When ``path`` is provided and is not ``/``, the search is rooted at that
- path: ``cd`` into it, ``grep``, then ``cd`` back to ``prev`` — sent as one
- multi-line ``domshell_execute`` call so all three lines share an MCP
- session (and therefore a DOMShell lane / cwd). Each ``_call_execute`` in
- non-daemon mode opens a fresh stdio session that lands in its own
- DOMShell 2.x lane, so splitting cd/grep/restore across separate calls
- would lose the cwd between them. The trailing ``cd prev`` is delivered as
- the final line of the same command and runs even if ``grep`` errors —
- DOMShell's multi-line splitter continues past errors (see
- `apireno/DOMShell#46 <https://github.com/apireno/DOMShell/issues/46>`_).
+ path via a split-and-check sequence: an anchor ``cd``, then ``grep``,
+ and finally a restore ``cd``. Each step is a separate ``domshell_execute``
+ call but they all share the same MCP session (and therefore DOMShell lane/cwd).
+ This allows halting early if the anchor ``cd`` fails.
``path``, ``prev``, and ``use_daemon`` are keyword-only to prevent silent
breakage of callers written against the pre-migration positional