Repository navigation
toolshed: a reconnecting player's context never runs as the console - #8
Merged
ImogenOC merged 2 commits intoNov 30, 2026
Conversation
* Fix stale Toolshed context after reconnect * This bothers me for some reason :3
The console context is shared by the host and every sudo caller, and it kept the shell of whoever created it, so command output and errors went to that caller. Bind it to the calling shell on every call, as upstream's reconnect fix now does for player contexts. Tests: a reconnected player is checked as themselves before InGame, and console output reaches the shell that ran the command.
3 tasks done
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.
What
Two commits on
wolfgate/v295:839c7f67e, "Fix stale Toolshed context afterreconnect"), unchanged. It drops out as already applied at the next engine bump.
toolshed: bind the invocation context to the calling shell:InvokeCommand(IConsoleShell, ...)andGetCompletions(ConsoleShell, ...)now bind the cached context to the calling shell on every call, not only whenthe player differs.
Why
A player's cached Toolshed context lost its shell on disconnect and only got a new one at
InGame, while the consoleaccepts commands from the moment a session exists. In between, the context had no session, and a null session reads as
the server console to Toolshed and to content's
AdminManager, so every permission check passed. A player who had runany Toolshed command before could reconnect and run anything until they reached
InGame; on Wolfgate that windowcovers the whole join queue wait. Upstream's commit re-attaches the live session on use and refuses a player context
that has no session.
Upstream's re-attach skips the console context (no player), which the host and every
sudocaller share. That contextkept the shell of its first caller, so command output and error details went to that caller rather than whoever ran
the command, and a caller who came first went on receiving other people's console output. The second commit binds it
to the calling shell too.
Admin rights still load at
InGame(AdminManager.LoginAdminMaybe), so admin commands are refused between connectingand
InGame. Before this they passed in that window only because they ran as the console.Client safety
Robust.Shared, but Toolshed runs on the server only (the client throws without
CLIENT_SCRIPTING). No wire format,serialised type or prediction change.
Tests
Robust.Shared.IntegrationTests/Toolshed/ToolshedSessionTest.cs, on a non-pooled server with a permission controllerthat allows only the console:
ReconnectedPlayerIsNotConsole: a player runs a command in game, leaves and reconnects; whileConnectedandbefore
InGame, a command is refused, the context's session is the new one, and completions return theinsufficient-permissions hint.
ConsoleContextWritesToCallingShell: two console-side shells run a command that writes through the context; eachreceives its own line.
Engine CI on the fork's push (run 46517610099): Ubuntu and Windows pass,
Robust.Shared.IntegrationTests1231 of 1231(1229 on the base branch).