Repository navigation
fix: unregister agent tools through an AbortSignal, reuse the anonymous action token - #105
Merged
Merged
Conversation
The WebMCP draft of 2026-04-23 removed modelContext.unregisterTool() in
favor of registerTool(tool, { signal }). The polyfill and BrowserMcpServer
warn on every page that unregisters a tool, @MCP-B 6.x no longer has the
method, and a native modelContext following the draft would throw in
onScopeDispose.
useAgentTool now registers each tool with its own AbortController and
aborts it when the scope is disposed. The registration also stays bound
to the context that received it, even after useFrameServer replaces
navigator.modelContext.
The live tools dev page gets a close_panel tool, so the e2e spec checks
a real unmount: the tool leaves the aggregate and no deprecation warning
is printed.
The chat asked simple-directory for a new anonymous action token every time it was created, so every full page load of a portal cost one call, even with the chat closed. That endpoint shares a rate limit of 5 calls per minute and per IP with the login routes: an anonymous visitor browsing a portal quickly got 429s. The token is valid a day and not single-use. It is now kept in localStorage and reused by later page loads and tabs until an hour before its expiry, with an in-memory fallback when storage is unavailable. A kept token the server refuses (a rotated key) is forgotten and the hello is retried once with a new one.
.type/ is gitignored, but 19 files generated by df-build-types had been force-added over time. They went stale against their schemas, so every build-types left a diff to sort out before a commit. CI builds them and shares them as an artifact, and the Dockerfile runs build-types, so nothing needs them in git.
Two flakes of the login fixture failed the e2e warm-up about one run in two, in the pre-push hook too: - Both fields of simple-directory's login form carry autofocus, and the email field's can land late: it took the focus back between the password fill's focus and its typing, "passwd" was appended to the email and the login waited out the timeout. The fixture now fills until both fields hold the expected values. - A login posted while the context still held another user's admin-mode session got an exchange token carrying adminMode: the first keepalive of the new, non-admin user answered 401 and the session was deleted (the warm-up visits as the superadmin in admin mode, then as another user). The fixture now clears the session cookies before a form login.
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.
Two issues seen in browser consoles on staging and production, plus generated files leaving git.
useAgentToolunregisters through an AbortSignal. Each tool is registered withregisterTool(tool, { signal })and its controller is aborted on scope dispose, instead of callingunregisterTool(), which the WebMCP draft of 2026-04-23 removed. The polyfill andBrowserMcpServerwarned on every page,@mcp-b6.x no longer has the method, and a nativemodelContextfollowing the draft would throw on unmount. The live tools e2e now checks a real unmount (newclose_paneldev tool) and that no deprecation warning is printed..type/files are no longer tracked..type/is gitignored, but 19 generated files had been force-added and went stale. CI and the Dockerfile build them.autofocuscould steal the password's typing. It also clears the session cookies before a form login: a login posted over another user's admin-mode session got an exchange token carryingadminMode, and the new user's first keepalive answered 401.Heads-up: the anonymous chat now keeps its token in the chat frame's
localStorage(df-agents-anonymous-action-token), shared by the visitor's tabs.