Conversation
Author
|
Note on documentation: #152 (docs(skill): add preflight guidance for parallel tasks) already covers the SKILL.md side of this workflow, so this PR deliberately keeps the doc bundle untouched and sticks to the CLI implementation. |
dangzitou
force-pushed
the
feat/preflight-conflict-check
branch
from
September 27, 2026 18:09
f454f9b to
18b8a1b
Compare
Two automation tasks sharing one browser interfere invisibly: sessions share the profile's login state, so two tasks automating the same logged-in site can overwrite each other's page state with no error; and when the number of running Agent Windows no longer matches the number of parallel tasks, tasks share one session and tab refs bleed between them. `bsk preflight --url <url>… [--expected-parallel <n>]` lists sessions and their agent tabs through the existing `system.session_list` / `tool.tab_list` RPCs and grades what it sees: - P0 (exit 2): a target host is already automated by an active session. - P1 (exit 1): expected-parallel count exceeds the active sessions. - P2 (exit 0): no conflict. Read-only: no state is created or changed, so a wrong answer costs at most a redundant task. The tab-contention check from the issue is left out for now — an agent rarely knows the tab id it will borrow before running — and the "how to resolve a detected conflict" policy stays an open issue question.
dangzitou
force-pushed
the
feat/preflight-conflict-check
branch
from
September 27, 2026 18:13
18b8a1b to
c8a0569
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.
What problem this solves
Addresses #132.
When multiple automation tasks run in the same browser they interfere in
two invisible ways: sessions share one browser profile's cookies, so
two tasks automating the same logged-in site overwrite each other's
page state with no visible error; and when the number of running Agent
Windows no longer matches the number of parallel tasks, tasks share one
session and tab refs (
@eN) bleed between them. Nothing in the currentCLI detects either before the damage happens.
How this fixes it
bsk preflight --url <url>… [--expected-parallel <n>]lists sessionsand their agent-scope tabs through the existing
system.session_list/tool.tab_listRPCs and grades what it sees:session's agent tab (same-domain login-state conflict).
--expected-parallelexceeds the active sessioncount (possible session mixup).
The grade is also the exit code, so harnesses can branch on it without
parsing output, and
--jsonemits the full structured report. Thecheck is strictly read-only — it creates and mutates nothing, so a
wrong answer costs at most a redundant task. Domain comparison uses
URL-normalized hosts, so case differences do not cause false conflicts.
Two things from the issue are deliberately left out to keep this PR
reviewable: the borrowed-tab contention check (an agent rarely knows
the tab id it will borrow before running) and the conflict-resolution
policy, which the issue itself leaves open. Both are natural
follow-ups. Note the SKILL.md side of this workflow is covered by #152.
User impact
An agent harness can gate a parallel task on the grade before starting
it:
bsk preflight --url https://app.example.com --expected-parallel 3 # exit 0 → safe to start, 1 → warn, 2 → refuseValidation
cargo fmt --all -- --check,cargo clippy -p bsk --all-targets --locked -- -D warnings,cargo test --workspace --locked(green;no new tests included in this PR).
target graded P0/exit 2 against the live session (with Chrome for
Testing 154 + unpacked extension), unrelated target P2/exit 0,
--expected-parallelmismatch P1/exit 1, non-URL--urlrejectedas an input error;
--jsonreport matches the human output.