Repository navigation
fix(browser): run a command only after the Gateway confirms its ack - #34
Merged
Merged
Conversation
The Gateway treats a command without a confirmed ack as not run: it fails it with device_unresponsive after the ack timeout or device_offline on a disconnect, and answers a late ack with NOT_FOUND. The runner sent the ack fire-and-forget and executed at once, so an interact command could still run after the agent was told it did not, and repeat its side effect on retry. The runner now awaits the ack answer before any work. A rejected ack (NOT_FOUND, closed socket, request timeout) means the command never runs and no result is sent. A cancel, Pause/Stop, revocation or deadline that lands while the ack is pending stops the command before it runs and reports that code. The seen-id dedupe, deadline timer and cancellation semantics are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ovQWBCoHd61Rwg92GdXdP
A rejected ack other than NOT_FOUND (a local request timeout, a closed socket) may still have been recorded by the Gateway, which would then wait for the deadline and report outcome_unknown for a command that never ran. The runner now sends a best-effort cancelled result in that case; after NOT_FOUND it still sends none. Also covers a NOT_FOUND ack at the session level and a cancel that lands in the same tick the ack resolves, and documents that commands stopped before they ran are not shown on the timeline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ovQWBCoHd61Rwg92GdXdP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #32
Problem
The command runner sent
browser.command.ackwithout waiting for the response and started the action straight away. When an ack arrives after the Gateway's 5 s ack timeout, the Gateway has already told the agentdevice_unresponsive("not run"). If the agent then retried, the action ran twice. For irreversible actions (merge, submit) that is a duplicate side effect.Change
NOT_FOUND: the Gateway already finished the command. Nothing runs and no result is sent.device_offline): nothing runs. A best-effortcancelledresult is still sent, so a Gateway that did record the ack does not wait until the deadline and reportoutcome_unknown.connected-browser-relay-contract.md,api-contract.md,architecture.mdand the CHANGELOG.Verification
pnpm lint: pass.pnpm typecheck: pass.pnpm test: 814/814 pass.pnpm build: pass.NOT_FOUNDit sends no result. Ontimeout,device_offlineor a plain error it sends exactly onecancelledresult.🤖 Generated with Claude Code
https://claude.ai/code/session_015ovQWBCoHd61Rwg92GdXdP
Generated by Claude Code