Skip to content

fix(download): report a filename suggestion dropped by another extension - #381

Open
Yi-111-a wants to merge 1 commit into
Tencent:mainfrom
Yi-111-a:fix/download-suggestion-dropped-note
Open

Yi-111-a wants to merge 1 commit into
Tencent:mainfrom
Yi-111-a:fix/download-suggestion-dropped-note

Conversation

@Yi-111-a

Copy link
Copy Markdown

Problem

Chromium lets only one extension answer chrome.downloads.onDeterminingFilename, and the API never tells the losers they lost. With a coexisting download-manager extension installed (Chrono and friends), BrowserSkill's trace-scoped suggest() at apps/extension/src/tools/download-capture.ts:236 is silently discarded:

This extension failed to name the download "BrowserSkill\tr_…\report.csv" because another extension (Chrono) has already named it "report.csv".

The download itself succeeds, and browser_path still reports the real final path, so the result looks healthy — but it implies the BrowserSkill/<trace>/ folder layout that is no longer there. Files pile up flat, repeat names get Chromium's " (1)" suffixes, and nothing anywhere tells the caller the suggestion was dropped.

Fix

Detect the drop after completion and report it as a result note, reusing the existing note convention (tool.emulate, request-help):

  • download-capture.ts — suggestionWasDropped() compares the completed path against browserRelativeDir and returns suggestionDropped on DownloadCaptureResult.
  • download.ts — handleDownload turns that into DOWNLOAD_SUGGESTION_DROPPED_NOTE on DownloadResult.
  • crates/bsk-protocol/.../file_transfer.rs — mirrors the optional field, omitted from the wire when absent.
  • Both skill bundles — a help-and-recovery.md row telling the agent to trust the reported path and ask the user to disable the other extension's renaming.

Two details worth calling out:

  • Only the directory is compared. Chromium appends " (1)" to a repeated basename, which must not read as a dropped folder — there is a test pinning that case.
  • A note, not an error. The file downloaded fine; only the per-call grouping was lost, and the issue explicitly says the agent still gets a usable path.

This is requested item (2) of #361, plus the troubleshooting note from item (1). Item (3) (a setting to skip the suggestion entirely) is deliberately left out — it is a separate feature surface, not a fix.

Validation

  • pnpm --filter @browser-skill/extension test — 2422 passed. file-transfer.test.ts 31/31, including 3 new cases.
  • cargo test --locked -p bsk-protocol — 166 passed, incl. 2 new serde tests.
  • cargo clippy --locked -p bsk-protocol --all-targets and cargo fmt --check — clean.
  • pnpm exec biome check . — 578 files clean.
  • node scripts/check-skill-bundles.mjs — both skill directories valid.

Two pre-existing failures under full-suite parallel load (long-screenshot/exports.test.ts, human-loop.test.ts child-process timeout) were confirmed unrelated: the unmodified base fails 3 tests the same way, and both pass in isolation both with and without this branch.

Closes #361

Chromium lets only one extension answer `chrome.downloads.onDeterminingFilename`
and never tells the losers they lost. With a coexisting download-manager
extension (Chrono, …) installed, BrowserSkill's trace-scoped
`suggest()` is silently discarded, so the file lands flat in the download dir
while the result still implies the `BrowserSkill/<trace>/` layout. Nothing in
the API reports the loss, so callers could not tell a dropped suggestion from a
mis-grouped one.

Detect it after completion and surface it as a result `note`. The comparison
uses the directory portion only, so Chromium's `" (1)"` uniquify suffix on a
repeated basename does not read as a dropped folder, and both `/` and `\` paths
are handled.

The download itself still succeeds; only the per-call grouping is lost, so this
stays a note rather than an error. Adds the troubleshooting row to both skill
bundles, and mirrors the field on the bsk-protocol `DownloadResult`.

Closes Tencent#361

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.

[extension] Filename suggestion silently loses to other download-manager extensions (e.g. Chrono); per-trace folder is dropped

1 participant