Repository navigation
Conversation
…llision cannot take the whole suite down `registerBrowserTools` mapped over BROWSER_TOOL_SPECS and called ctx.tools.register for each entry. The host tool registry rejects a duplicate name by throwing, so the `.map()` aborted at the first rejection: on a profile that also mounts `dsh-builtin-browser` -- which already owns `browser_session`, spec 0 -- zero of the six tools registered, while the plugin still looked healthy. The only trace was a console.warn inside armLazyTools, which an Electron desktop host never shows (Tencent#444). A collision on a later spec was quieter still: the tools before it DID register, but their disposers were discarded along with the pending entries, so unloading the plugin could not release them. Register each spec on its own, keep the disposers of the ones that succeeded, and report every conflict by tool name. When nothing registered we still throw, preserving armLazyTools' retry-at-the-next-lifecycle-boundary path.
Collaborator
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
When another plugin already owns a
browser_*tool name,registerBrowserToolsfails all six registrations instead of the one that collided, and the failure is invisible on a desktop host.registerBrowserToolsdid:The host tool registry rejects a duplicate name by throwing.
Array.prototype.maptherefore aborts at the first rejection, so:browser_session) — the case in [dsh plugin 0.3.2] All six browser_* tools silently fail to register when dsh-builtin-browser is mounted: first spec "browser_session" collides in the global tool scope #444, on a profile that also mountsdsh-builtin-browser— means the other five specs are never even attempted. 0 of 6 tools register, while the plugin itself looks healthy (skill loads, CLI/daemon/extension chain fine).console.warninsidearmLazyTools, which an Electron desktop host does not surface — from the user's side the plugin "does nothing".Fixes #444.
Change
packages/dsh-plugin-browserskill/src/browser-tools.tsregisters the specs one at a time:ctx.effectteardown releases them;1 of 6 browser tools failed to register — another tool already owns the name in this scope: browser_session ("browser_session" is already registered).When nothing could register, it still throws, so
armLazyToolskeeps its existing "keep the invocation proof and retry at the next lifecycle boundary" behaviour. The eager (lazyTools: false) path still fails loudly.I deliberately did not rename any tool: that changes the public tool contract and is the maintainers' call. This PR only makes the failure survivable and diagnosable.
Test plan
Four cases added to
packages/dsh-plugin-browserskill/tests/tools.test.ts, driving the realregisterBrowserToolswith aregisterstub that throws for chosen names:browser_sessiondispose()still releases every tool that registeredMutation check — with the source change reverted, all four fail (
4 failed | 70 skipped), includingexpected [Function] to throw error matching /browser_session.*browser_assist/s but got 'duplicate'.The 2 remaining failures are in
tests/runner.test.ts(settles after the kill grace…,settles killAll and killFor…) and are pre-existing on Windows — they reproduce on a clean tree with this branch stashed (2 failed | 28 passed). The client suites need the repo'sbuild:cssstep first; with it run, they pass.CHANGELOG.md