[Bug] Exactly-once violation in browser tooling: 100+ duplicate browser_eval executions, duplicate transcript events, and repeated assistant responses
Summary
During browser automation, a single logical browser_eval operation can appear to execute dozens to hundreds of times in a rapid parallel burst.
The transcript becomes flooded with identical tool_calls blocks and matching Used eval · Browser entries. In some incidents, the assistant's textual response is duplicated as well, indicating that the problem may not be limited to the CDP/browser layer.
The currently available evidence suggests a multi-layer exactly-once violation involving one or more of:
- Provider/model output containing duplicate tool calls.
- Agent/session doom-loop behavior across assistant turns.
- Tool dispatcher retrying or replaying the same logical call.
- CDP discovery/connection timeouts amplifying retries.
- OpenWork creating a new browser tab for every replayed
browser.open_url. - Session events being replayed or rendered more than once by the transcript UI.
Parallel query execution may amplify the incident, but it has not yet been proven to be the sole initiating cause.
Environment
- Platform: Windows (
win32) - Shell: PowerShell 5.1
- App: OpenWork desktop
- Browser integration: built-in OpenWork browser panel
- Browser automation: Chrome DevTools Protocol
- CDP endpoint:
http://127.0.0.1:9223 - Tools involved:
browser.open_urlbrowser_evalbrowser_snapshotbrowser_screenshot
- Reproduced:
- In multiple chat sessions
- Multiple times per session
- With persistent/duplicate browser tabs
- Alongside intermittent browser bridge/CDP failures
Observed Symptoms
A single logical browser read results in 100+ identical or near-identical
browser_evaloperations.The calls occur in a rapid burst, often with each entry reporting a duration of approximately
0.1s.The transcript is flooded with:
- Repeated
tool_callsblocks - Repeated
Used eval · Browserentries - Repeated assistant messages or near-identical assistant messages
- Repeated
The duplication is rendered directly in the chat transcript. It is not hidden in an internal log.
browser.open_urlintermittently fails with:UI bridge unreachable: The operation timed out.In another failure mode,
browser_evalcan remain stuck in a running state when port9223is listening but the CDP discovery endpoints do not respond.The OpenWork browser panel accumulates duplicate tabs of the same URL.
Examples observed:
- Same syllabus page open three times
- Same website open two or more times
- Approximately ten browser tabs remaining in the panel
Stop/cancel may not immediately terminate a pending browser operation.
The same behavior has reproduced across separate conversations, suggesting that it is not limited to one damaged chat message.
Expected Behavior
- One unique tool-call ID should be executed at most once.
- One logical browser read should produce one browser execution and one result.
- Parallel browser reads should not cause automatic multiplication of identical calls.
- Replayed events should not create duplicate transcript rows.
- The same assistant message or message part should be rendered only once.
browser.open_urlretries should not create duplicate tabs.- CDP discovery and WebSocket connection attempts should fail within a bounded timeout.
- Stop/cancel should terminate all pending browser discovery, connection, and command operations.
- Browser timeouts should not cause an unbounded retry storm.
Actual Behavior
browser_evalappears dozens to hundreds of times for one logical operation.- Identical calls run in rapid parallel bursts.
- Tool-call entries are rendered repeatedly in the transcript.
- Assistant text may also appear multiple times.
browser.open_urlintermittently reports a UI bridge timeout.- CDP can be listening on port
9223while/json/versionor/json/listremains unresponsive. - Repeated or replayed
browser.open_urloperations create duplicate tabs. - Browser/session state remains present across subsequent calls.
- The transcript becomes difficult to read and the agent may become unstable.
Impact
- Massive transcript and log flooding
- Duplicate assistant responses
- Unnecessary token usage
- Unnecessary model and tool invocations
- Higher latency
- Potential provider/API cost amplification
- Browser panel pollution from duplicate tabs
- Difficult incident diagnosis because UI duplicates may be mixed with real executions
- Browser automation becomes unreliable
- Users may need to restart OpenWork or Windows to restore the CDP endpoint
Key Architectural Evidence
OpenWork context reports the following execution policy:
"execution": {
"queries": "parallel",
"commands": "serialized"
}This means multiple submitted query/read operations may execute concurrently, while command/write operations are serialized.
browser_eval is treated as a read/query operation and may therefore use the parallel execution path.
However, parallel execution alone should only run the distinct operations that were submitted. It should not convert one submitted call into 100 executions.
The parallel policy should therefore be treated as a likely amplification factor, not yet as the fully confirmed initiating root cause.
Refined Failure Model
The observed behavior may involve multiple independent duplication layers. These layers should be diagnosed separately because they require different fixes.
Type A: Provider or model emits duplicate tool calls
A single assistant response may contain dozens or hundreds of tool-call objects with different call IDs but identical tool names and arguments.
Signature:
- One assistant message contains many tool calls.
- Tool-call IDs are different.
- Tool names and normalized arguments are identical.
- The tool executor may be correctly executing everything the provider/model submitted.
Possible causes:
- Model-specific tool-calling regression
- Provider adapter parsing issue
- Stream delta aggregation bug
- Repeated tool-call fragments being interpreted as complete calls
- Missing per-message fan-out limit
Likely fixes:
- Add a per-assistant-message duplicate-signature guard.
- Limit the maximum number of browser calls in one assistant step.
- Reject abnormal fan-out before execution.
- Log the raw provider tool-call array before dispatch.
Type B: Tool executor re-executes one logical call
The session contains one tool-call ID, but the browser tool gateway or executor runs that call multiple times.
Signature:
- The same tool-call ID appears in execution logs multiple times.
- Multiple execution-start events exist for one call ID.
- CDP receives multiple
Runtime.evaluateoperations for one logical call. - More than one result may be associated with the same call ID.
Possible causes:
- Missing exactly-once dispatch protection
- Event replay
- Multiple active tool clients
- Retry handler resubmitting a call after an uncertain result
- Race between parallel consumers
Likely fixes:
- Key execution by
session_id + message_id + tool_call_id. - Coalesce duplicate in-flight calls.
- Cache and return the original completed result.
- Prevent a second worker from acquiring the same execution key.
Type C: Agent doom loop
The model creates a new assistant turn and repeats the same logical tool operation after receiving each tool result.
Signature:
- Different assistant message IDs
- Different tool-call IDs
- Same normalized
tool + argumentssignature - Repetition occurs across multiple assistant turns
- Similar or identical reasoning is repeated between calls
Possible causes:
- Doom-loop detection only checks the current message
- Detection ignores repetitions separated by text/reasoning parts
- Tool result does not provide a strong terminal signal
- Agent re-enters the same plan after every result
- No progress detection is missing
Likely fixes:
- Detect repetition across assistant-message boundaries.
- Track normalized tool signatures since the last user message.
- Add a no-progress detector.
- Apply per-run and per-tool budgets.
- Stop after a configurable number of identical logical operations.
Type D: Event replay or UI duplication
The backend may execute and store an operation once while the desktop UI displays it multiple times.
Signature:
- Repeated transcript rows have the same message ID, part ID, or tool-call ID.
- Reloading or reopening the session removes some duplicates.
- Backend/session storage contains one record but the UI shows multiple copies.
- Assistant text and tool rows duplicate together.
- Duplication happens during the transition from streaming to completed state.
Possible causes:
- Replayed SSE or WebSocket events
- Reconnect without event-sequence deduplication
- Streaming state and persisted state rendered simultaneously
- Non-idempotent event reducers
- Multiple subscriptions to the same session stream
Likely fixes:
- Deduplicate events by stable event, message, part, and tool-call IDs.
- Add monotonic event sequence numbers.
- Reconcile stream state with persisted state idempotently.
- Ensure streaming and completed views cannot render the same part simultaneously.
Type E: Retry amplification after timeout
A browser or UI bridge request times out, is marked retryable, and causes the same model or tool operation to be attempted repeatedly.
Signature:
- Repetitions begin after a timeout.
- Calls have different IDs but occur with a predictable retry pattern.
- The same logical action is retried without progress.
- Duplicate tabs appear if
browser.open_urlis retried.
Possible causes:
- Timeout classified as indefinitely retryable
- No maximum retry count
- Retry starts a new assistant/tool operation instead of resuming safely
- Original result is unknown, so the runtime replays the operation
Likely fixes:
- Add a hard retry limit.
- Use idempotency keys for retryable operations.
- Distinguish safe reads from state-changing browser commands.
- Return a clear terminal error after the retry budget is exhausted.
Why Duplicate Assistant Text Is Important
The browser/CDP plugin does not generate or render assistant messages.
Therefore, stale CDP state alone cannot explain repeated assistant text.
If assistant text and tool-call rows are both duplicated, the incident likely includes an additional problem in one of the following layers:
- Provider stream parsing
- OpenCode session processing
- Overlapping prompt loops
- Session event delivery
- OpenWork transcript rendering
- Streaming-to-completed state reconciliation
This symptom should be investigated separately from the browser execution itself.
Confirmed Source-Level Weaknesses
1. CDP target discovery has no explicit timeout
In the public different-ai/opencode-browser implementation, CDP target discovery performs a fetch similar to:
const res = await fetch(`${url}/json/list`);The current main-branch implementation does not provide an explicit timeout or caller cancellation signal for this request.
A process can therefore listen on port 9223, accept the TCP connection, and still never return an HTTP response.
This matches the failure mode documented in OpenWork issue #3443.
2. WebSocket connection has no explicit handshake deadline
The CDP client waits for the WebSocket open or error event.
The current implementation does not impose a short explicit deadline on the WebSocket handshake.
The existing CDP command timeout applies only after:
/json/listreturns.- A target is selected.
- A WebSocket endpoint is obtained.
- The WebSocket connection is established.
- A CDP command is sent.
It does not protect the earlier discovery or connection stages.
3. Pending CDP commands may not fail immediately on socket close
The current socket-close path clears the socket reference, but pending commands are not necessarily rejected immediately when the socket closes.
A pending command may remain unresolved until its individual timeout fires.
This can delay cleanup and increase the number of overlapping operations.
4. OpenWork creates a new tab for every browser.open_url
The OpenWork browser panel's automation path creates a new tab for each open operation.
The relevant behavior is equivalent to:
async function openBrowserUrlForAutomation(rawUrl, provider = "auto") {
const url = normalizeBrowserUrl(rawUrl);
const tab = createBrowserTab("about:blank", { select: true });
await tab.view.webContents.loadURL(url);
}There is no same-URL coalescing or idempotency key in this path.
Therefore, any replay or retry of browser.open_url directly creates another browser tab.
Duplicate tabs are strong evidence that browser.open_url was dispatched more than once.
However, duplicate tabs alone do not prove that stale CDP state initiated the replay.
5. browser_eval uses a fresh CDP client
The public browser plugin resolves a target, creates a CDP client, performs the evaluation, and closes the client in a finally block.
The public source does not show a page.requests queue responsible for automatically replaying old eval operations.
Therefore, the specific claim that leftover page.requests re-trigger old reads is not yet confirmed.
The more accurate statement is:
Stale CDP/browser state is suspected based on persistent tabs and unhealthy endpoint behavior, but the specific internal queue responsible for replay has not yet been identified.
6. Process-level browser state still exists
Although each eval uses a fresh CDP client, the plugin does maintain process-level state such as snapshot caching.
The browser panel also uses a persistent Electron session partition:
persist:openwork-browserPersistent browser data and tabs may survive longer than a single tool call.
This can affect browser state and target discovery, but it does not by itself explain 100 identical tool-call dispatches.
Steps to Reproduce
Start OpenWork desktop on Windows.
Confirm CDP is exposed at:
http://127.0.0.1:9223Open a URL with
browser.open_url.Record the returned:
browser_urltarget_id- Session ID
- Assistant message ID
- Tool-call ID
Run one
browser_evaloperation to read page content.Run additional browser reads, especially multiple reads in one assistant step.
Observe whether:
- One assistant message contains many identical tool calls.
- The same tool-call ID executes multiple times.
- Different assistant messages repeat the same operation.
- The transcript renders the same part multiple times.
Trigger or wait for a browser/UI bridge timeout.
Observe whether the number of repeated operations increases after the timeout.
Repeat
browser.open_urland check whether duplicate tabs are created.Repeat the test in a new chat session.
Compare behavior between:
- OpenWork desktop
- OpenCode CLI, if possible
- Different model/provider combinations
- One browser call per assistant step
- Multiple browser calls per assistant step
Duplication Identity Matrix
The following data is needed to identify the exact duplication layer:
| Field | First occurrence | Duplicate occurrence | Same or different? |
|---|---|---|---|
| Session ID | |||
| User message ID | |||
| Assistant message ID | |||
| Assistant parent ID | |||
| Tool part ID | |||
| Tool-call ID | |||
| Tool name | browser_eval |
browser_eval |
Same |
| Normalized arguments | |||
| Normalized arguments hash | |||
| Browser target ID | |||
| Browser tab ID | |||
| CDP request ID | |||
| Event/SSE ID | |||
| Event sequence number | |||
| Execution-start timestamp | |||
| Execution-end timestamp | |||
| Retry attempt number |
Interpretation:
Same tool-call ID with multiple execution starts:
- Tool dispatcher or gateway exactly-once violation.
Different tool-call IDs in one assistant message:
- Provider/model output or stream parsing fan-out.
Different assistant IDs and different tool-call IDs:
- Agent doom loop or overlapping prompt loops.
Same message/part ID displayed repeatedly:
- UI rendering or event replay duplication.
One backend record but multiple visible transcript rows:
- Frontend-only duplication.
Multiple backend assistant records with the same parent ID:
- Session loop or concurrent prompt execution.
Required Diagnostic Data
Please capture the following during an incident:
- OpenWork version.
- OpenWork build channel and commit, if available.
- Bundled OpenCode binary version.
- Bundled OpenCode SDK version.
opencode-browserplugin version or commit.- Model name.
- Provider name.
- Gateway/proxy configuration, if used.
- Reasoning mode and context-window settings.
- Session ID.
- User message ID.
- Assistant message ID.
- Assistant parent ID.
- Tool part ID.
- Tool-call ID.
- Normalized tool arguments.
- Whether repeated calls use the same ID or only the same arguments.
- Number of duplicates in:
- Raw provider response
- Persisted session/backend
- Tool executor logs
- CDP command logs
- Visible transcript
/json/versionresponse status./json/listresponse status.- Number of CDP page targets.
- Duplicate target URLs.
- Whether reloading the session removes duplicates.
- Whether the same issue occurs with another model.
- Whether the same issue occurs with another provider.
- Whether it reproduces when only one browser read is allowed per assistant step.
- Whether it reproduces in OpenCode CLI without the OpenWork desktop UI.
- Whether the repetition begins before or after a timeout.
- Whether the repetition continues after pressing Stop.
- Whether restarting only OpenWork fixes the CDP endpoint.
- Whether a complete Windows restart is required.
PowerShell CDP Diagnostics
The following commands can be run while the incident is active:
$cdp = "http://127.0.0.1:9223"
Get-Date -Format o
Get-NetTCPConnection `
-LocalPort 9223 `
-ErrorAction SilentlyContinue |
Select-Object LocalAddress, LocalPort, State, OwningProcess
Invoke-RestMethod `
-Uri "$cdp/json/version" `
-TimeoutSec 5 |
ConvertTo-Json -Depth 10
Invoke-RestMethod `
-Uri "$cdp/json/list" `
-TimeoutSec 5 |
ConvertTo-Json -Depth 10To inspect the process that owns port 9223:
$connection = Get-NetTCPConnection `
-LocalPort 9223 `
-State Listen `
-ErrorAction SilentlyContinue |
Select-Object -First 1
if ($connection) {
Get-Process `
-Id $connection.OwningProcess `
-ErrorAction SilentlyContinue |
Select-Object Id, ProcessName, Path, StartTime
}To group duplicate browser target URLs:
$targets = Invoke-RestMethod `
-Uri "http://127.0.0.1:9223/json/list" `
-TimeoutSec 5
$targets |
Where-Object { $_.type -eq "page" } |
Group-Object url |
Sort-Object Count -Descending |
Select-Object Count, NameTo save a timestamped target snapshot:
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
Invoke-RestMethod `
-Uri "http://127.0.0.1:9223/json/list" `
-TimeoutSec 5 |
ConvertTo-Json -Depth 10 |
Set-Content ".\cdp-targets-$timestamp.json"Suggested Logging
Add structured logs at each layer.
Provider layer
Log:
- Provider request ID
- Assistant message ID
- Number of tool calls in the raw response
- Tool-call IDs
- Tool names
- Normalized argument hashes
- Stream chunk sequence
Session layer
Log:
- Sess
Source: different-ai/openwork