Conversation
lymerin
force-pushed
the
codex/242-background-input-hardening
branch
from
September 21, 2026 16:08
b1254da to
32cbfe1
Compare
This branch has not been deployed
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.
Problem
This is follow-up hardening related to #242, not a claim that the original 0.2.1 bug remains unfixed.
BrowserSkill 0.3.0 added
withInputReadyin1740a1d. For an unprepared hidden target, it temporarily enables focus emulation, waits for renderer readiness, dispatches the input, and disables the temporary override during cleanup.Current
mainalso has the persistent background-execution policy introduced later by #249. The dispatcher acquires that lease before invoking controlled page-tool handlers.The two mechanisms did not have an explicit ownership boundary.
withInputReadycould not determine whether the current session already owned the persistent policy. If it still observed the page as hidden, it could independently enable and later disable focus emulation. Those direct toggles do not updateBackgroundExecution'sappliedcache, leaving this inconsistent state:BackgroundExecutionstill records the persistent policy as enabled;synchronizecan treat the cached state as current and skip reapplying it.The existing click browser coverage also invokes the handler directly for its readiness assertions, bypassing the dispatcher's
prepareBackgroundExecutionstep. It therefore covers the compatibility fallback but does not pin the production lease-before-handler ordering.Change
CdpRunner.ownsBackgroundExecution(sessionId, tabId)predicate.ChromiumCdpusingBackgroundExecution.has, so it reports desired session ownership rather than transient attachment state.target_closed.An ordinary debugger detach invalidates only the applied attachment state and retains desired ownership. The next
sendperformsensureAttached → synchronizebefore the requested CDP command, so the persistent override is restored before input dispatch. A terminaltarget_closedintentionally forgets the owner.This does not add page-event delivery verification, change click result semantics, or activate the browser window.
Validation
--noEmitcheck passed.git diff --checkpassed.Related to #242.