Repository navigation
fix(extension): queue concurrent downloads within their timeout - #573
Open
columbia11 wants to merge 7 commits into
Open
columbia11 wants to merge 7 commits into
columbia11 wants to merge 7 commits into
Conversation
handleDownload guarded the browser-global chrome.downloads transaction with a module flag, so a `bsk download` from another session failed at once with invalid_params "another bsk download is active" and the CLI's "check your command arguments" hint, even though its arguments were valid. Replace the flag with a FIFO gate. A later call waits for its turn within its own timeout_ms and then captures with the remaining time. If the deadline passes or the operation is cancelled while waiting, it returns `timeout` / `cancelled` with effect_state "none" and phase "queue". Each gate also waits for its predecessor, so a waiter that gives up early never lets the next call overlap a capture that is still running. Fixes Tencent#519 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
columbia11
force-pushed
the
fix/download-wait-for-gate
branch
from
November 4, 2026 06:42
518a761 to
3af0e35
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #519
Problem
handleDownloadguards the browser-globalchrome.downloadstransaction with a module-leveldownloadActiveflag. When session A is downloading, absk downloadfrom session B fails immediately withinvalid_params"another bsk download is active". The CLI then shows "check your command arguments", even though B's arguments are valid. Every other command runs concurrently across sessions.Fix
This implements the reporter's second option: replace the flag with a FIFO gate.
timeout_ms, then captures with the time that remains, so the overall deadline is unchanged.timeout. If the operation signal aborts (cancellation or human intervention), it returnscancelled. Both carryeffect_state: "none"andphase: "queue", because nothing was clicked.Captures still don't run in parallel. The reporter's first option would need attribution changes in
download-capture.ts, which I didn't attempt.Tests
download-gate.test.ts, with a first download holding the gate:timeout_ms: 20returnstimeout(effect_state: none,phase: queue);cancelled;invalid_params.src/tools/__tests__/download*: 27 passed. Full extensionvitest run: 3604 passed, 1 failed (thehuman-loopchild-process timeout, which fails under full parallel load and passes alone).tsc --noEmit: exit 0.biome checkon the changed files: clean.I used Claude Code to write the fix and tests and run the checks above.
🤖 Generated with Claude Code