Skip to content

fix: remove console browser tool - #1131

Merged
Nikhil (shadowfax92) merged 2 commits into
mainfrom
fix/0608-1253-lion
Jun 8, 2026
Merged

Nikhil (shadowfax92) merged 2 commits into
mainfrom
fix/0608-1253-lion

Conversation

@shadowfax92

Copy link
Copy Markdown
Contributor

Summary

  • remove the BrowserOS console log collector and get_console_logs MCP tool
  • de-wire the tool from Browser, the registry, labels, prompts, and stale shared limits
  • keep evaluate_script, ToolResponse, CDP generated types, and logger console truncation intact

Design

This is a full removal rather than a hidden compatibility path: Browser no longer creates a console collector or session hooks, the MCP registry no longer exposes get_console_logs, and prompt/label/test fixtures no longer advertise the removed tool.

Test plan

  • bun --env-file=apps/server/.env.development test apps/server/tests/tools/browser-boundary.test.ts apps/server/tests/agent/prompt.test.ts apps/server/tests/agent/message-validation.test.ts
  • bun run typecheck
  • bun run lint (exit 0; existing repo warnings remain)
  • bun run test:core (apps/server)
  • bun run test:tools (apps/server)
  • bun run test (apps/agent)
  • bun run test:all
  • rg active-reference search for removed console tool identifiers

@shadowfax92

Copy link
Copy Markdown
Contributor Author

Greptile (@greptileai) review

@shadowfax92

Copy link
Copy Markdown
Contributor Author

Claude (@claude) review

@claude

claude Bot commented Jun 8, 2026 •

Copy link
Copy Markdown

Claude finished Nikhil (@shadowfax92)'s task in 2m 8s —— View job


Code Review

  • Gather context and understand request
  • Read changed files
  • Check for lingering references to removed tool
  • Review code correctness and completeness
  • Post final review

Overall: clean, complete removal. No blocking issues.

The PR fully de-wires get_console_logs and ConsoleCollector across all layers (runtime, registry, labels, prompts, limits, tests). A rg search for get_console_logs, ConsoleCollector, console-collector, and getConsoleLogs finds only the test tombstones — nothing left dangling.


Correctness

BrowserSession constructor call (browser.ts:57)
BrowserSession(cdp) now omits the hooks argument. Confirmed core/session.ts:18 has hooks: BrowserSessionHooks = {} as a default — this is valid. ✅

Log.enable() removal (browser.ts)
Log.enable() was called per-session solely to enable the CDP Log.entryAdded event for the console collector. With the collector gone, no other code listens to that event, so dropping the call is correct. No silent regressions. ✅

CONSOLE_META_CHAR correctly kept (limits.ts:78)
This constant is used by logger.ts:194 to truncate the dev-mode logger's own console output — entirely unrelated to the browser tool. The PR description calls this out explicitly, and it's right to keep it. ✅


Test changes

browser-boundary.test.ts:40-43
The explicit !existsSync(...'browser/console.ts') assertion acts as a permanent regression guard — if someone accidentally recreates the file, the test will catch it. Slightly unusual to tombstone a deleted file this way, but it's a defensible pattern for "this tool was intentionally removed, don't re-add it silently."

message-validation.test.ts:56,63
Swapping get_console_logs → evaluate_script in the tool sets is a sensible substitution — both are observation-category tools. ✅

prompt.test.ts:857
The new expect(prompt).not.toContain('get_console_logs') negative assertion is a good safeguard to prevent the tool from accidentally re-appearing in the system prompt. ✅


Minor observations (non-blocking)

  1. Agent debugging guidance (prompt.ts:413-414)
    The old guidance was:

    If evaluate_script fails → check get_console_logs for error details

    The new guidance is:

    If evaluate_script fails → report the error and inspect the page state when useful

    This is intentionally less directive now that the tool is gone. evaluate_script can still be used for JS debugging, but the agent will need to infer the approach. Acceptable tradeoff for a removal PR.

  2. Observation count comment (registry.ts:84)
    // Observation (7) correctly reflects the new count. Good housekeeping that often gets missed.


Summary

Full removal executed cleanly — runtime hooks, registry, label maps, system prompt, limits, and tests all updated consistently. The CONSOLE_META_CHAR constant correctly survives for the logger, and evaluate_script remains for any JS introspection the agent needs. Ready to merge.

@github-actions github-actions Bot added the fix label Jun 8, 2026
@shadowfax92
Nikhil (shadowfax92) merged commit 9f2ed03 into main Jun 8, 2026
16 of 17 checks passed
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

✅ Tests passed — 1004/1010

Suite Passed Failed Skipped
✅ agent 96/96 0 0
✅ build 17/17 0 0
✅ eval 95/95 0 0
✅ server-agent 246/246 0 0
✅ server-api 95/95 0 0
✅ server-browser 4/4 0 0
✅ server-integration 10/10 0 0
✅ server-lib 185/186 0 1
✅ server-root 45/48 0 3
✅ server-tools 211/213 0 2

View workflow run

@greptile-apps

greptile-apps Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR performs a clean, full removal of the get_console_logs MCP tool and its supporting infrastructure (ConsoleCollector, session hooks, CDP Log.enable calls). All consumers — the tool registry, prompt text, label registries, and test fixtures — are de-wired in the same change.

  • console-collector.ts and tools/browser/console.ts deleted: all CDP log buffering, filtering, and formatting logic is gone; evaluate_script and ToolResponse remain untouched.
  • browser.ts simplified: ConsoleCollector field and onSessionAttached/onPageDetached hooks removed; BrowserSession is now constructed without hooks, which is valid since the parameter defaults to {}.
  • limits.ts trimmed: the three console-buffer constants removed; CONSOLE_META_CHAR is correctly retained as it is still consumed by logger.ts for dev-mode metadata truncation.

Confidence Score: 5/5

The removal is complete and consistent across all layers — no dangling imports, no orphaned constants, and no active code paths reference the deleted tool.

Every reference to get_console_logs in active code has been removed. BrowserSession accepts an optional hooks parameter that correctly defaults to {}, so the simplified constructor call is safe. CONSOLE_META_CHAR is retained because logger.ts still uses it for unrelated log truncation. Tests are updated with negative assertions to guard against accidental re-introduction. The change is well-scoped and has no side effects on remaining browser tooling.

No files require special attention.

Important Files Changed

Filename Overview
packages/browseros-agent/apps/server/src/browser/browser.ts Removes ConsoleCollector field, session hooks for Log.enable/attach/detach, and the getConsoleLogs public method; BrowserSession constructor called without hooks (valid, defaults to {}).
packages/browseros-agent/apps/server/src/browser/console-collector.ts Entire file deleted; no remaining references in active code paths.
packages/browseros-agent/apps/server/src/tools/browser/console.ts Entire get_console_logs tool definition deleted cleanly.
packages/browseros-agent/packages/shared/src/constants/limits.ts CONSOLE_BUFFER_MAX_ENTRIES, CONSOLE_DEFAULT_LIMIT, CONSOLE_MAX_LIMIT removed; CONSOLE_META_CHAR correctly retained as it is still used by logger.ts for dev-mode log truncation.
packages/browseros-agent/apps/server/src/tools/registry.ts get_console_logs import and registration removed; observation tool count updated from 8 to 7.
packages/browseros-agent/apps/server/src/agent/prompt.ts All three prompt locations referencing get_console_logs removed: untrusted sources list, tool category docs, tool-selection guide, and error-recovery section updated cleanly.
packages/browseros-agent/apps/server/tests/tools/browser-boundary.test.ts console.ts removed from browserToolFiles, new negative assertion confirms browser/console.ts is absent, registry check updated to expect undefined for get_console_logs.
packages/browseros-agent/apps/server/tests/agent/prompt.test.ts Observation-tools list and error-recovery tests updated to not expect get_console_logs; negative assertions added to guard against regression.
packages/browseros-agent/apps/server/tests/agent/message-validation.test.ts Tool-set fixtures updated to replace get_console_logs with evaluate_script as a representative browser tool.
packages/browseros-agent/apps/agent/lib/tool-labels.ts get_console_logs verb override removed, section comment updated from "Console / scripts" to "Scripts".
packages/browseros-agent/apps/server/src/tools/tool-label-registry.ts Mirrors the tool-labels.ts change; get_console_logs entry removed from VERB_OVERRIDES.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Before
        B1[Browser] -->|creates| CC[ConsoleCollector]
        B1 -->|onSessionAttached| LE[Log.enable + attach]
        B1 -->|onPageDetached| DT[detach]
        CC -->|buffers| CE[ConsoleEntry buffer]
        T1[get_console_logs tool] -->|calls| B1
        R1[registry] -->|registers| T1
        P1[prompt.ts] -->|documents| T1
    end

    subgraph After
        B2[Browser] -->|no hooks| BS[BrowserSession]
        R2[registry] -->|no get_console_logs| R2
        P2[prompt.ts] -->|evaluate_script only| P2
    end

    CC -.->|deleted| X1((removed))
    T1 -.->|deleted| X2((removed))
Loading

Reviews (1): Last reviewed commit: "fix: remove console tool prompt referenc..." | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR removes the get_console_logs MCP tool and all its supporting infrastructure: the ConsoleCollector class, the CDP Log.enable() session hook, the tool definition in console.ts, its registry entry, prompt documentation, and test fixtures. The removal is complete — no stale references survive.

  • console-collector.ts and tools/browser/console.ts are deleted entirely; Browser no longer holds a ConsoleCollector instance or passes session-lifecycle hooks to BrowserSession.
  • CONSOLE_BUFFER_MAX_ENTRIES, CONSOLE_DEFAULT_LIMIT, and CONSOLE_MAX_LIMIT are removed from limits.ts; CONSOLE_META_CHAR is intentionally kept because it is still used by logger.ts for dev-mode output truncation.
  • All tests are updated with negative assertions (not.toContain, registry.get(...) === undefined, !existsSync(...)) to guard against reintroduction.

Confidence Score: 5/5

This is a clean, complete removal with no stale references remaining and thorough test coverage confirming the tool's absence.

Every call site — session hooks, registry entry, prompt text, limit constants, labels, and test fixtures — has been updated. The retained CONSOLE_META_CHAR constant continues to serve the unrelated logger truncation path. No dead code is left behind and the negative-assertion tests guard against accidental re-introduction.

No files require special attention.

Important Files Changed

Filename Overview
packages/browseros-agent/apps/server/src/browser/browser.ts Removes ConsoleCollector field, session-lifecycle hooks (Log.enable, attach, detach), and getConsoleLogs method; BrowserSession is now constructed with no hooks, which is valid (hooks default to {}).
packages/browseros-agent/apps/server/src/browser/console-collector.ts File deleted; complete removal of the ConsoleCollector class and its CDP event listeners.
packages/browseros-agent/apps/server/src/tools/browser/console.ts File deleted; complete removal of the get_console_logs tool definition.
packages/browseros-agent/packages/shared/src/constants/limits.ts CONSOLE_BUFFER_MAX_ENTRIES, CONSOLE_DEFAULT_LIMIT, and CONSOLE_MAX_LIMIT removed; CONSOLE_META_CHAR correctly retained (still used by logger.ts for dev-mode truncation).
packages/browseros-agent/apps/server/src/tools/registry.ts get_console_logs import and registry entry removed; observation count comment updated from (8) to (7).
packages/browseros-agent/apps/server/src/agent/prompt.ts All references to get_console_logs removed from security context, capability overview, tool-selection table, and error-recovery guidance.
packages/browseros-agent/apps/server/tests/tools/browser-boundary.test.ts console.ts removed from the expected-files list; a separate existsSync assertion guards against the file being re-added; registry assertion updated to expect undefined for get_console_logs.
packages/browseros-agent/apps/server/tests/agent/prompt.test.ts Observation-tool list updated; negative assertions added to confirm get_console_logs is absent from the prompt and error-recovery section.
packages/browseros-agent/apps/server/tests/agent/message-validation.test.ts get_console_logs replaced with evaluate_script in the test tool-set fixtures; semantically equivalent stand-in for the tool-set membership tests.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Browser constructor] -->|before| B[new ConsoleCollector created]
    A -->|before| C[BrowserSession with session hooks]
    C -->|onSessionAttached| D[session.Log.enable + collector.attach]
    C -->|onPageDetached| E[collector.detach]
    B --> F[CDP events buffered]
    F --> G[getConsoleLogs on Browser]
    G --> H[get_console_logs MCP tool]

    A2[Browser constructor] -->|after| C2[BrowserSession no hooks]
    C2 -.->|removed| D2[Log.enable / collector.attach]
    B2[ConsoleCollector REMOVED] -.->|removed| F2[CDP event buffers REMOVED]
    F2 -.->|removed| G2[getConsoleLogs REMOVED]
    G2 -.->|removed| H2[get_console_logs tool REMOVED]

    style B fill:#ffcccc
    style D fill:#ffcccc
    style E fill:#ffcccc
    style F fill:#ffcccc
    style G fill:#ffcccc
    style H fill:#ffcccc
    style A2 fill:#ccffcc
    style C2 fill:#ccffcc
Loading

Reviews (2): Last reviewed commit: "fix: remove console tool prompt referenc..." | Re-trigger Greptile

Vasilev Dmitrii (gHashTag) added a commit to gHashTag/BrowserOS that referenced this pull request Aug 19, 2026
Third instance of one shape in a day. The autonomous tick chose a
candidate, `delegate` refused it because another live task already owns
those files - correct - and the tick ended there instead of trying the
next one. Same as "already delegated", same as the review sweep that only
ran on a finish.

Filtered with the very policy that would otherwise refuse it
(`QueenDelegationPolicy.conflictingTasks`), so the selection and the
refusal cannot disagree.

Driven in release: she skipped browseros-ai#1131 as already running, skipped browseros-ai#1133 and
browseros-ai#1169 as already done, chose browseros-ai#1132, approved it herself - and then met the
boundary conflict. That refusal is what this removes from the path.

Also visible in the same run and worth recording: all five parked tasks now
carry COMPLETE verdicts - 4/4, 4/4, 2/2, 3/3, 4/4, where two of them were
0/4 and 0/2 before the key guard landed. The reviewer was never broken; it
had nothing to answer with.
Vasilev Dmitrii (gHashTag) added a commit to gHashTag/BrowserOS that referenced this pull request Aug 19, 2026
The dev registry held nineteen tasks and fourteen failures. browseros-ai#1127 had been
attempted seven times, browseros-ai#1129 five, browseros-ai#1128 four - every one the same brief
against the same issue. Nothing counted the attempts and nothing told the next
worker that anyone had been there before it, so a retry was not a second
attempt; it was the first attempt run again by someone who did not know.

The reason it could not count is that the registry had one word for two
different endings. Ten of those fourteen had `streamOutcome: open` and no
completed turns - the signature of a process that went away under the worker,
which on this machine tonight was me rebuilding the app. The other four had
done real work. Both were spelled `failed`, and afterwards nothing could tell
them apart. Counting the first group would retire issues for the crime of
being open during a rebuild; not counting the second lets one run forever.

So the ending is now recorded rather than inferred later. `reconcileOrphaned-
Workers` already knew it was reconciling a dead process and threw that away;
it writes `interrupted`. The review path had the failure text in hand and
stored only the state; it classifies from what the runner measured. An
interruption never counts against an issue. Two real failures and the issue
stops being chosen - `queen.choose.exhausted` says so with the kinds named,
because a third identical attempt is evidence about the issue, not the bees.

And when a retry does happen, the brief opens with what the earlier attempts
ran into and says not to repeat the approach. That is the half that makes it a
second attempt.

Driven, not read. Live in the dev app: `Skipping browseros-ai#1131: 2 attempts have
already failed on their own merits (workedButFailed, workedButFailed)`, and
she took browseros-ai#1132 instead. Three tasks orphaned by my own restarts were recorded
`interrupted` and did not count.

805 e2e checks in 71 scenarios, up from 790. Both new guards proven red:
making interruptions count breaks four of them, dropping the briefing from the
worker's brief breaks two.
Vasilev Dmitrii (gHashTag) added a commit to gHashTag/BrowserOS that referenced this pull request Aug 21, 2026
…its default

The activation window arrived (the browseros-ai#1131 bee settled at its send-back
ceiling) and every pending fix was proven on the wire in one pass: the
heal sweep read 45 conversations on its own the moment the key answered;
keychain.read.served_late fired three times, serving settlements the old
shape would have refused for a minute; settle tails measured up to 215.6
seconds with OSStatus 0 - securityd here is slow, never broken.

Two probe defects blocked the last proof and are fixed here. ChatProbe
never read TRIOS_<PROVIDER>_API_KEY from the environment - only as a JSON
key inside config files - so `make chat-probe VARIANT=release` printed
"key: MISSING" about a key the running app held in its cache, on the very
machine whose config.json carries the documented zero-length values. Env
is now the probe's first source, mirroring the app's own chain. And the
probe now prints the usage frame it receives, so a probe run IS the wire
proof for the spend pipeline:

    PASS in 3701 ms
    usage: 18308 in / 45 out tokens (usage SSE frame received)

With that printed, usage emission flips to ON by default (opt-out
TRIOS_EMIT_USAGE=0). The env allowlist stays opt-in until a worker bash
call is observed under it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Vasilev Dmitrii (gHashTag) added a commit to gHashTag/BrowserOS that referenced this pull request Aug 21, 2026
…and the allowlist earns its default

Three wire proofs collected in one worker turn. queen.worker.expensive
fired for the first time in its existence: task browseros-ai#1131 recorded 10,650,930
input / 73,416 output tokens, priced at $6.55 by ModelPricing - the spend
pipeline is live end to end, and the $10/day SwarmBudget gate can finally
trip. queen.pr.gate_administrative fired at 17:38:56Z naming its check
("#74 is red only on administrative check(s) (cla); nothing a worker can
fix") - no wake, no illegal transition. And the turn's finishing commit
(queen.branch.committed 17:56:19Z) landed with the env allowlist active
on the live server: ten variables are enough for real work, so the scrub
flips to ON by default (TRIOS_BASH_ENV_ALLOWLIST=0 is the opt-out).

make spend's note stops claiming the server "does not emit usage yet" -
that cause died this evening; the 49 zero-token tasks are turns that
finished before emission went live, and the note now says so.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Vasilev Dmitrii (gHashTag) added a commit to gHashTag/BrowserOS that referenced this pull request Aug 21, 2026
The daily budget gate lived only on NEW dispatches, and the automatic
review sweep's send-back restarted workers straight past it - measured on
2026-08-21, the first day tokens were real: two automatic returns of
browseros-ai#1131 burned $7.60 of the $10 day through a path no gate watched, while
delegateIssueToWorker would already have refused fresh work.

The sweep's send-back now defers when the day is spent, with the same
shape as its existing slot deferral: the task keeps its place in the
review queue, queen.review.send_back_deferred names the measured spend,
and nothing is killed. The operator's own /review reject is deliberate
and stays ungated.

Not proven on the wire yet: the running binary predates this commit, the
third browseros-ai#1131 turn is in flight, and the gate only shows itself when a
sweep meets an exhausted day - queued for the next relaunch window.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Vasilev Dmitrii (gHashTag) added a commit to gHashTag/BrowserOS that referenced this pull request Aug 21, 2026
…a loss

The preservation pattern generated its own noise: browseros-ai#1131's branches
(r4 with the supervisor's preservation commit, r5 with the bee's three)
raised urgent unrecordedWork the pass after their record was cancelled
with a written reason - the checker saw commits HEAD does not hold on a
terminal record and concluded nobody was looking, unable to see that the
cancel reason and the archive stamp ARE the record of the looking.

unrecordedWork now also defers to recordArchived, joining branchMissing
and commitMissing: a stamped record's parked branches read as
archivedRecordDrift (stale bucket, no repair proposed). An UNarchived
record's parked commits still alarm - nobody has decided about those, and
that alarm is the reason failed is not archivable in the first place.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Vasilev Dmitrii (gHashTag) added a commit to gHashTag/BrowserOS that referenced this pull request Aug 28, 2026
…erprint now survives them

The seal computed the boundary fingerprint and kept it in a process-local
dictionary: 0 of 58 tasks in the live store carried treeStateFingerprint,
and this app relaunches constantly, so browseros-ai#1126/browseros-ai#1131 worked until the next
restart and then went blind, silently. The registry now records the
fingerprint on the task and persists; the e2e suite proves it on the wire -
a full /verify through the command path, then the store FILE decoded as a
fresh reader (ISO8601, no shared state), 971/971 checks green twice.

build.sh survived the day's Xcode update (6.0.3 -> 6.3.3) by naming three
breaks: XCTest moved out of the SDK (conditional -F at all three import
sites, derived from xcrun), a neighbour's foreign-toolchain swiftmodule,
and the module vanishing while SwiftPM still said Build complete - the
toolchain probe now repairs all three signatures and falls back to the
vendored halves on the neighbour-wipe signature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant