Skip to content

fix(cooperation): fail fill immediately on readonly/disabled targets … - #784

Open
Bensonbenyi wants to merge 1 commit into
Tencent:mainfrom
Bensonbenyi:fix/fill-readonly-fast-fail
Open

Bensonbenyi wants to merge 1 commit into
Tencent:mainfrom
Bensonbenyi:fix/fill-readonly-fast-fail

Conversation

@Bensonbenyi

Copy link
Copy Markdown

fix(cooperation): fail fill immediately on readonly/disabled targets instead of polling to the readiness deadline

Summary

Filling a readonly or disabled target through cooperative control (--ref + --context) now fails on the first target check with its structured reason instead of polling until the readiness deadline and losing the diagnosis to a timeout:

// before: white-waits the full readiness window (5s cap since #783), then
{ "code": "timeout", "data": { "reason": "action_timeout", "operation": "tool.fill", "phase": "precondition", "effect_state": "none" } }

// after: first check, ~200ms
{ "code": "permission_denied", "data": { "reason": "target_readonly", "phase": "target", "effect_state": "none" } }

Root Causes & Fixes

  1. Readiness wait treats readonly/disabled fill targets as transient (apps/extension/src/cooperation/controller.ts):

    • Cause: The pre-execution readiness poll retried target_hidden / target_disabled / target_readonly checks until the readiness deadline. target_hidden can genuinely resolve (a later render), and target_disabled can resolve for controls the page enables asynchronously — but a fill target never becomes writable on its own: readonly and disabled fields are business facts, so the poll only burns the budget and misreports the reason as timeout (action_timeout when the daemon deadline wins the race). fix(cooperation): stop false human_intervention on scripted edits/clicks, cap readiness waits, and unblock failed-load tab management #783 already capped the poll at 5s; a readonly fill still waits the full 5s before failing.
    • Fix: The wait now retries only target_hidden (any method) or target_disabled (methods other than tool.fill). target_readonly is only ever produced by tool.fill checks (action-checks.ts), so removing it from the retry set changes nothing for other methods.
  2. Changelogs: Updated both CHANGELOG.md and CHANGELOG.zh-CN.md.

Verification

  • pnpm --filter @browser-skill/extension test: 4,106 passed (190 files), including new target-policy.test.ts cases: tool.fill returns target_readonly / target_disabled after exactly one checkActionTarget call with no input sent, and a hidden fill target is still awaited to visibility (regression guard for the retained wait).
  • Existing readiness behavior unchanged: click's wait-for-disabled-to-enable cases in target-policy.test.ts (waits only for initial target readiness, rechecks only the target while it is becoming ready) and the dynamic-read.mjs eval all pass untouched.
  • pnpm --filter @browser-skill/extension compile (tsc) & pnpm lint (biome + stylelint): 0 errors.
  • Real-Chrome E2E reproduction (daemon + built extension): against the released 0.5.0 extension, filling a readonly input with --timeout 1s blocked for 1.017s and returned timeout/action_timeout. Steps to rerun after rebuilding/reloading the extension: start demo-site, bsk cooperate sync, set document.querySelector('#name').readOnly = true via bsk evaluate, re-sync, then time bsk fill @e2 --value x --session <id> --context <CTX> --timeout 1s --json — expected: permission_denied/target_readonly on the first check (~200ms).

…instead of polling to the readiness deadline

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant