When I create a User Script Command in a user script, and then navigate away from the page that created it (but stay in that tab), the user script command persists in the page menu until the tab is closed or reloaded.
A demonstration script:
// ==UserScript==
// @name BugDemo__GM_registerMenuCommand
// @namespace bugdemos
// @description Demonstrates a bug with user script commands
// @include *
// @exclude http://www.yahoo.com*
// ==/UserScript==
const loc = window.location;
GM_registerMenuCommand(loc, function(){GM_log("callback defined for
"+loc)});
This adds a different user script command after every page visit (except when visiting yahoo pages) but the commands are all visible and available on every page (including yahoo pages) until the tab is either closed or reloaded.
I could see how this could be construed as useful, but to me it's counterintuitive. I expected the user script commands created for a page to be removed once I navigated away from the page.