fix(sandbox): Windows add-ons: only a layer's DLL is opened to the game, added layers load, and false alarms leave the log #3110
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3110
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:fix/addons-windows"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Windows fixes for the sandbox's add-ons (#3093), which had not run on Windows when it merged. I ran it on Windows 11 with an RTX 5080. The game started, played and closed, and DLSS started. These problems showed up, and this fixes them:
.dllthat is there gets it, and the log says when one doesn't.VK_ADD_IMPLICIT_LAYER_PATHnames never loaded. The log said it was on and its DLL was allowed, but the Vulkan loader lists the folder first, and that was refused. The folder is now served to be listed only, and only when it holds a layer that is on. These layers also come before the registry's now, as they do for the loader.refusedlines asked "an add-on's?", most of them about Windows' shell or NVIDIA's driver. The shell is now looked past to whoever called it. A driver's or Windows' own refusal is called usual. The Vulkan loader's is not, since it asks for the layers' files.disable_environment, or a 32-bit one (library_arch).What #3132 means for this. The sandbox is off by default now, so all of this applies only to a start with
HOS_SANDBOX=1(orstrict). With it off, the builder makes no plan and no grants, and the game's file layer is not installed, so nothing here runs. Every refusal stays as it was for a start with it on.maindoes not compile on Windows since #3113 (compiled atca5d3078; the line is the same at674489dd):note_lines(&said)insandbox_windows.rsis called insidemod os, which does not import it (E0425). This fixes it (super::note_lines).It also fixes checks that #3093 broke on
main: two Rust tests on Windows (a_layer_s_libraryhas Linux paths;mako_on_asks_its_own_places_and_off_asks_noneputs Windows'\in a TOML string),test_utf8_paths(CP_ACP), rustfmt, and clippy on Linux. Andtest_sandbox_windows.py, which #3113 broke: it looked for the line #3113 replaced. It now checks that the call compiles on Windows too, and that the cut is the size the game reads.To see 1 and 2 on
main: start the game withHOS_SANDBOX=1andVK_ADD_IMPLICIT_LAYER_PATHset to a folder, or a manifest in it, outside the game folder.Read first:
addons()andlayer_libraryinsandbox_windows/gather.rs;note_linesandevery_container_readsinsandbox_windows.rs;hos_file_refused_usualinhost/hos_file_windows.c.Testing
Tested: Windows 11, RTX 5080, driver 621.47, sandbox on, at f42503a48 (the same fixes; only #3098's menu change came under them since). Three windowed runs from the
kokiri-startsave (400 frames of play, then the menu, then quit): a normal start, a throwaway layer in a folder, and a manifest that names a text file. All three passed.mainit did not.mainit was opened.tests/test_sandbox_refusals_windows.pyruns on Windows itself (the existing one needs Wine). Its checks for 3 and 7 fail without their fixes and pass here.92ab0dfe3(on #3113, with BeanBot's L1-L3; same PC): a normal start and a manifest naming a text file, as before. A folder of 41 test layers, 13 starts that reached play: the layers the plan has room for loaded, and those past it were named in the log (read at 2589a3406 and92ab0dfe3). Two more starts with that folder failed. One game quit within a second, as another game started 0.3 s later on the PC; the cause is not proven. One lost the GPU device while starting, aftermovie upscale dispatch prewarmed: no, where two starts on this PC did before #3093 existed (2026-12-02).37910e887) is on #3132. Not run on it yet: Windows (not compiled either) and the game, as the test PC is short of disk space. This change is the same as before the rebase bygit patch-id, plus the fix oftest_sandbox_windows.py. The game runs below are from before #3132, when the sandbox was on by default; they come again withHOS_SANDBOX=1.test_sandbox_windows.py(it fails onmain's copy) andtest_sandbox_linux.pypass, and so do clippy andcargo testforbuild-core(222).50dc48bc1, Windows, gnullvm:longshot-buildercompiles; clippy forbuild-core,build-compileandlauncher-profile, andcargo testforbuild-core(199) andlauncher-profile, pass; so do four checks near the change:test_utf8_paths,test_doc_anchors,test_switch_tableand the new test, now withoutLONGSHOT_MINGW. The tests for L1 and L2 fail without their fixes. rustfmt passes but for one line ofsettings_host.rs, from #3098, which this does not touch.build-compile's tests passed at266520236.test_xinput_threadandtest_recorder_own_idlepass when run again,test_switch_tablepasses since #3102, andtest_cursor_hidden_linuxalso fails onmain.test_lifter, at f42503a48: rustfmt and clippy pass, then it stops atthe_repositorys_files_are_current(game/game.his stale). That test is known to fail onmain, and this does not touchgame/. The Rust tests after it, run in two parts with that one left out: 2677 and 559 passed. The disk filled during the first part, somodtooland what follows it ran in the second. One failed there, a menu speed test, with another full suite running on the PC; it passes alone at266520236.Still to test:
HOS_SANDBOX=1, the log saying it is confined (by hand, by the author)HOS_SANDBOX: a normal start, expectingsandbox: offand no add-on lines (by hand, by the author)HOS_SANDBOX=1: game capture of the sandboxed game, expecting a picture or a log line (by hand)HOS_SANDBOX=1, expecting it to start as before (by hand)HOS_SANDBOX=1: a normal start, expecting no refusal called an add-on's (by hand or Test Farm)HOS_SANDBOX=1, a start with no add-on and one with MAKO or MangoHud, expecting the same as before: 6 changes which layers count as on there too (by hand)Measurements
Verdict: the bugs are gone. Frame rate should not change: the fixes run at the start, and when a file is refused.
Setup: Windows 11, RTX 5080, driver 621.47; the same three starts on both, sandbox on. The numbers still hold on
main@674489dd, for a start withHOS_SANDBOX=1: since6167e8aabit took #3104 (tests), #3102 (DLSS 5 rows), #3098 (menu), #3112 (modtool), #3113 (NGX's lines, and how a cut log ends), #3120 (Linux's compiler), #3105 (mods' ReShade presets), #3119 and #3108 (menu and input), #3069 (UI) and #3132 (the sandbox off by default). None changes how add-ons are found, allowed or refused with the sandbox on.6167e8aabVK_ADD_IMPLICIT_LAYER_PATHnamestest_sandbox_refusals_windows.pyFrame rate, for #3093 itself against
mainbefore it (not these fixes): 157.2 against 157.8 fps (three 40 s runs each, uncapped, Hyrule Field), no difference past the noise. Not run again for the fixes.Risks
.., a stream, a share, a folder, another kind of file) have tests..dllno longer loads outside Windows' and Program Files' folders. I know of none.disable_environmentis no longer said as on; the loader never loads one.VK_IMPLICIT_LAYER_PATHand theVK_LOADER_LAYERS_*variables are not read on Windows; a library path with..outside Program Files is left out with no line;HOS_ENV_FILEcan setVK_ADD_IMPLICIT_LAYER_PATH.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11, RTX 5080, driver 621.47, sandbox on, at f42503a48 (only #3098's menu change came under the fixes since). Three windowed runs from the kokiri-start save, 400 frames of play, the menu, then quit; all passed. Normal start: RTSS's and OBS's layers loaded, DLSS started, and no refusal was called an add-on's. A throwaway layer in a folder VK_ADD_IMPLICIT_LAYER_PATH names loaded (on main @
6167e8aabit did not). A manifest naming a text file: the file was not opened to the game, and the log said why (on main it was opened).WIP: fix(sandbox): Windows add-ons: only a layer's DLL is opened to the game, added layers load, and false alarms leave the logto fix(sandbox): Windows add-ons: only a layer's DLL is opened to the game, added layers load, and false alarms leave the logRecommendation: Approve. The new Windows regression test silently skips on supported compiler setups, and the new folder-listing grant can be dropped when many layers are present. The reported Windows runs show the main fixes working, but the remaining platform runs are still needed. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The change restricts Windows layer-library grants, lets the loader list added layer folders, and improves sandbox diagnostics. It also changes which implicit layers are recognized on Linux; the main cost is additional startup policy and diagnostic complexity.
Should fix (3): not blocking, but worth doing before merging.
builder/crates/build-core/src/sandbox_windows/gather.rs:522: The folder grants are appended after all manifest grants, but the plan only takes the first 32 add-on places. (more on the line) Do: Reserve or prioritize the required folder grants and report any manifest or folder omitted by the limit; add a test with enough enabled manifests to cross it.builder/crates/build-core/src/sandbox_windows.rs:293: A line that does not fit stops the entire selection, so later warnings and refused grants can still disappear. (more on the line) Do: Skip or truncate an oversized line and continue selecting the remaining priority lines, counting every omitted line.tests/test_sandbox_refusals_windows.py:141: The new regression test ignores CC and exits successfully without testing anything unless LONGSHOT_MINGW points to a particular compiler layout. (more on the line) Do: Use the configured supported compiler, including CC, and arrange the Windows checks to run the test rather than silently treating a missing compiler as a pass.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
@fixcan do L1, L2 and L3.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the tested Windows cases: the author reports an added layer loading where it did not before, a manifest-named text file no longer being opened, and add-on-attributed normal-start refusals falling from 11 to 0. Those comparisons were on Windows 11 with an RTX 5080; the remaining platforms and integrations are untested.
Other systems: The shared layer-selection change also affects Linux add-ons, including MAKO and MangoHud. Windows folder discovery and refusal classification can affect other GPU drivers, OBS capture, and Streamline; the author lists those runs as outstanding.
Switches: No switches added, changed, or removed.
Reviewed:
2665202361against76092c5e5a: Read AGENTS.md, CONTRIBUTING.md, the PR template, relevant standards, the full diff, commit messages, addons.rs, the changed Windows gathering and ACL paths, and surrounding file-service and grant-planning code. Skimmed the remaining portions of the large platform files and the changed documentation and test; no generated files or recorded runs were changed. docs/review-checklist.md is absent.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no commands from the project or tests were run. CI is still running on this head.
Overlaps and merge order: None found in the supplied PR context.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as llun took it out of WIP. Nothing was run; a maintainer decides.
@ -279,0 +290,4 @@for line in kept.into_iter().chain(rest) {if n + line.len() + 1 > room {break;}L2 (should fix): A line that does not fit stops the entire selection, so later warnings and refused grants can still disappear.
When: An enabled manifest can supply a long layer name, producing a not-granted line longer than the remaining note budget. The loop breaks at that line and drops subsequent short warnings as well.
Do: Skip or truncate an oversized line and continue selecting the remaining priority lines, counting every omitted line.
@ -516,0 +519,4 @@}}// (a folder VK_ADD_IMPLICIT_LAYER_PATH names is listed by the loader before it reads a manifest there)for d in added.iter().filter(|d| layers.iter().any(|l| l.manifest.parent() == Some(d.as_path()))) {L1 (should fix): The folder grants are appended after all manifest grants, but the plan only takes the first 32 add-on places.
When: If an added folder contains 32 enabled manifests, those manifests fill the limit before its folder is added. The loader cannot list the folder, so none of those added layers is discovered despite their libraries being planned.
Do: Reserve or prioritize the required folder grants and report any manifest or folder omitted by the limit; add a test with enough enabled manifests to cross it.
@ -0,0 +138,4 @@def main():mingw = os.environ.get("LONGSHOT_MINGW")L3 (should fix): The new regression test ignores CC and exits successfully without testing anything unless LONGSHOT_MINGW points to a particular compiler layout.
When: On a Windows test setup using CC or the supported Visual Studio route without LONGSHOT_MINGW, the test prints SKIP and returns success, so the refusal and deduplication fixes have no regression coverage there.
Do: Use the configured supported compiler, including CC, and arrange the Windows checks to run the test rather than silently treating a missing compiler as a pass.
26652023611994119889199411988992ab0dfe36BeanBot's three points are fixed, and the branch is on
main@ca5d3078.--cc), and no longer skips withoutLONGSHOT_MINGW.maindoes not compile on Windows since #3113:note_linesis not in scope inmod os(E0425 atca5d3078). This branch fixes that, and keeps #3113's wording and test.L4 and L5 are not done: Linux in the game, OBS capture, Streamline, AMD and Intel are still under Still to test. What ran on this head, and two failed starts, are under Tested.
@review
Recommendation: Approve. The code is ready: only testing is left. The reported Windows fixes have game-run evidence, and the three code items are resolved. Linux layer selection and Windows driver and capture integrations still need the runs identified in the ledger. Recommend approval; not approved on the forge.
The change restricts Windows layer-library grants, enables layers in added folders, and makes sandbox refusals and truncated logs more useful. It also changes shared layer selection on Linux; the added code and platform handling carry integration risk that remains to be tested.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
Since the last review (on
2665202361)Resolved: L1 (The folder grants are appended after all manifest grants, but the plan only takes the firs…); L2 (A line that does not fit stops the entire selection, so later warnings and refused grants…); L3 (The new regression test ignores CC and exits successfully without testing anything unless…)
Still open: L4 (The shared layer-selection change still needs an in-game Linux check, including a relevant…); L5 (Windows driver and capture integrations affected by the new grant and refusal handling rem…)
Checks: Still running:
PR description / Title and description (pull_request_target).More: does it help, other systems, switches, what was read
Does it help: Yes for the tested Windows cases: the author reports that an added-folder layer loaded, a text file named as a library was denied, and add-on-attributed refusals fell from 11 to 0 on Windows 11 with an RTX 5080. Performance was not measured for these fixes.
Other systems: The shared layer-selection change also affects Linux; its in-game check remains outstanding. Windows OBS capture, NVIDIA Streamline, AMD and Intel integrations remain untested. The author reports successful Windows and Linux build-core tests and clippy checks.
Switches: None added, changed or removed.
Reviewed:
92ab0dfe36againstca5d307814: Read AGENTS.md and CONTRIBUTING.md, the relevant diffs and the changed sections of sandbox_windows.rs, gather.rs, plan.rs and the Windows refusal test. Read the diffs for addons.rs, sandbox_linux.rs, sandbox documentation and hos_file_windows.c. The changed code files and their surrounding callers were not all read in full.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run. The author reports Windows and Linux build-core checks on this head and Windows game runs; the remaining integration runs are listed in the ledger.
Overlaps and merge order: Not checked; the network is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
llun referenced this pull request2026-12-03 21:36:06 +00:00
92ab0dfe3650dc48bc1250dc48bc1237910e8870@rebase
I rebased this pull request onto
main(309af878f1): the new head isaf9969864a.Conflicts resolved
Nothing was built or run: read the resolution before merging.
Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
37910e8870af9969864aRecommendation: Approve. The code is ready: only testing is left. The Windows runs show the targeted layer and logging fixes working, but the outstanding Linux and Windows integration runs have not been reported. CI is also still running. Recommend approval; not approved on the forge.
With the sandbox enabled, this restricts layer-library grants, allows enabled layers in added folders to load, and improves refusal logging. It also changes shared layer selection on Linux; the main cost is the added grant and logging logic.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
Since the last review (on
92ab0dfe36)Still open: L4 (The shared layer-selection change still needs an in-game Linux check, including a relevant…); L5 (Windows driver and capture integrations affected by the new grant and refusal handling rem…)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the tested Windows cases: the added-folder layer loaded and the text file was no longer readable, versus the opposite results on main. These were game runs on Windows 11 with an RTX 5080 at f42503a48; the current head has not been run in game.
Other systems: Shared layer selection affects Linux add-ons; an in-game check remains outstanding. Windows OBS capture, NVIDIA Streamline, and AMD and Intel normal starts also remain untested. The sandbox is off by default after the rebase.
Switches: None added, changed or removed by this pull request.
Reviewed:
af9969864aagainst309af878f1: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the changed Windows source-check test, the commit list and portions of the diff. Skimmed the recorded runs and remaining diff; the other changed code files were not read in full. docs/review-checklist.md was absent.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The author reports passing Windows game runs on an earlier head and Linux game-free checks; the current head's Windows compile and game runs remain outstanding.
Overlaps and merge order: none found
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.