Fix server-side abstraction bugs: carry check recursion, inventory aggregation, spy info, global leaks#2
Merged
Fonlogen merged 2 commits intocodex/refactor-ox_inventory-script-for-config-optionsfrom Mar 23, 2026
Conversation
Co-authored-by: Fonlogen <25137574+Fonlogen@users.noreply.github.com> Agent-Logs-Url: https://github.com/Fonlogen/KmF_Lab/sessions/a03303f0-90d9-48de-a98b-9c82d7b4d3b9
Copilot
AI
changed the title
[WIP] Add configurable framework and inventory support
Fix server-side abstraction bugs: carry check recursion, inventory aggregation, spy info, global leaks
Mar 23, 2026
ca2887e
into
codex/refactor-ox_inventory-script-for-config-options
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.
Eight review issues in
server/sv_main.luaintroduced by the framework/inventory abstraction layer, ranging from infinite recursion to global variable leaks and broken duplicate detection.Changes
CanCarryItem— infinite recursion on qs_inventory + QBCoreplayer.canCarryItemwas patched by QBCore'sDecoratePlayerto callCanCarryItemagain, causing a stack overflow wheneverConfig.Framework == 'qbcore'andConfig.Inventory == 'qs_inventory'. Now calls the export directly:GetInventoryItemList— ox_inventory items missing.nameox_inventory's
Items()export returns entries keyed by name but without a.namefield.Labs.AddDepositItemindexesItem.name, so it would error on every deposit. Normalization now injectsname = keywhere absent.GetPlayerInventory— quantity overwrite on duplicate item namesBoth the
ox_inventoryandqb_inventorybranches keyedformattedby item name and overwrote entries when multiple stacks existed. Now aggregatesqtyacross stacks for the same name.Labs.GetLabSpyExtraInfo— ESX-only DB query + dead spin loopConfig.Framework == 'qbcore'branch that falls back to the owner identifier instead of querying the ESX-specificuserstable.while not pInfo do Wait(100) end—MySQL.query.awaitalready blocks; the loop could spin forever on anilreturn.Labs.GetRandomSpiedLabs— implicit globals + wrong duplicate keylabandextraInfowere assigned withoutlocal, leaking into global state across calls. The duplicate-lab guard comparedspiedLabs[1]['LabInfo'].LabID(alwaysnil) instead of the correct top-levelspiedLabs[1].LabID.Autosave log —
#LabsDataalways 0LabsDatais a string-keyed map;#returns 0. Replaced withTableSize(LabsData).✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.