Repository navigation
fix(cooperation): name the top-level observation_id in strict-observation recovery - #547
Open
LilMGenius wants to merge 1 commit into
Open
LilMGenius wants to merge 1 commit into
LilMGenius wants to merge 1 commit into
Conversation
…tion recovery A target-policy sync reply carries two ids: the top-level observation_id (the strict receipt) and observation.observation_id (the rendered ref map). Passing the nested one to a script, untargeted key or visual action was refused with a hint that only said "pass its observation_id". The recovery, the sync guidance, the CLI fallback hint and both skill references now name the top-level field.
LilMGenius
force-pushed
the
fix/cooperate-observation-id-hint
branch
from
November 2, 2026 12:34
d681bc1 to
aa64ed4
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.
Summary
Under target policy,
bsk cooperate sync --jsonreturns two observation ids that differ:{ "context_id": "4d8a3ca5-…", "control_policy": "target", "observation": { "observation_id": "6c181ea9-…", "ref_count": 1, "text": "@vom 1 …" }, "observation_id": "6b8da7fc-…" }Scripts, untargeted keys, visual clicks and displacement-only drags need the top-level one. An agent that passes the nested
observation.observation_idgets this back, with nothing that tells it which id to use:If the agent follows that hint and syncs again, it gets a new pair of ids and can pick the wrong one again. The same command with the top-level
6b8da7fc-…succeeds. Both runs used CLI, daemon and extension 0.4.1 (protocol 1.8), on Chrome 156 on Windows 11, in a session-owned tab on example.com.Cause
apps/extension/src/cooperation/controller.ts: sync returnsobservation_id: context.observationIdat the top level (line 753), and the nestedobservationis the snapshot reply, whoseobservation_idis the ref store's token (RefStore.observationId). The strict check at line 1440 compares only againstcontext.observationId. The sync guidance (line 795), theobservation_requiredrecovery (line 1446), the CLI fallback hint incrates/bsk-cli/src/cli/render_error.rsand bothskill/references/cooperation.mdcopies all say "this sync's observation_id" without saying which of the two fields that means.Change
observation_idand say the nestedobservation.observation_idis a different id.observation_required/observation_changedsays "top-level observation_id".observation.observation_idnames the rendered ref map and is not the receipt.[Unreleased]changelog entry.Behavior is unchanged: the same ids are accepted and refused, and the error code and reason stay the same.
Verification
New test in
target-policy.test.ts: it passes the ref-map token totool.evaluateand expectsobservation_required,effect_state: "none", no CDP call, and a recovery that names the top-levelobservation_id. The top-level id then succeeds.b8f2d4f(main), fix revertedtarget-policy.test.ts+controller.test.tspnpm --filter @browser-skill/extension testpnpm --filter @browser-skill/extension compile(tsc)biome checkon the changed TS filesnode scripts/check-skill-bundles.mjs,node scripts/check-crate-skill.mjscargo fmt --all -- --checkcargo test -p bsk --lib render_errorLimits
cargo clippy -p bsk --lib -D warningson Windows reports three errors indaemon/file_transfer.rsandskill_install/harness.rs. This PR does not touch either file. The Linux CI job is the gate for that check.