Skip to content

toolshed: a reconnecting player's context never runs as the console - #8

Merged
ImogenOC merged 2 commits into
VanguardControl:wolfgate/v295from
ImogenOC:wolfgate/toolshed-detached-session
Nov 30, 2026
Merged

ImogenOC merged 2 commits into
VanguardControl:wolfgate/v295from
ImogenOC:wolfgate/toolshed-detached-session

Conversation

@ImogenOC

Copy link
Copy Markdown

What

Two commits on wolfgate/v295:

  1. Cherry-pick of upstream Fix stale Toolshed context after reconnect space-wizards/RobustToolbox#7257 (839c7f67e, "Fix stale Toolshed context after
    reconnect"), unchanged. It drops out as already applied at the next engine bump.
  2. toolshed: bind the invocation context to the calling shell: InvokeCommand(IConsoleShell, ...) and
    GetCompletions(ConsoleShell, ...) now bind the cached context to the calling shell on every call, not only when
    the player differs.

Why

A player's cached Toolshed context lost its shell on disconnect and only got a new one at InGame, while the console
accepts 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 run
any Toolshed command before could reconnect and run anything until they reached InGame; on Wolfgate that window
covers 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 sudo caller share. That context
kept 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 connecting
and 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 controller
that allows only the console:

  • ReconnectedPlayerIsNotConsole: a player runs a command in game, leaves and reconnects; while Connected and
    before InGame, a command is refused, the context's session is the new one, and completions return the
    insufficient-permissions hint.
  • ConsoleContextWritesToCallingShell: two console-side shells run a command that writes through the context; each
    receives its own line.

Engine CI on the fork's push (run 46517610099): Ubuntu and Windows pass, Robust.Shared.IntegrationTests 1231 of 1231
(1229 on the base branch).

Axionyxx and others added 2 commits November 30, 2026 22:28
* 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.
@ImogenOC
ImogenOC merged commit 9928af6 into VanguardControl:wolfgate/v295 Nov 30, 2026
2 of 3 checks passed
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.

2 participants