Skip to content

Fix two bugs causing intermittent crafting failures when merging jobs with shared recipe dependencies#185

Draft
Copilot wants to merge 3 commits intomaster-1.21-ltsfrom
copilot/investigate-game-test-failure
Draft

Fix two bugs causing intermittent crafting failures when merging jobs with shared recipe dependencies#185
Copilot wants to merge 3 commits intomaster-1.21-ltsfrom
copilot/investigate-game-test-failure

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

When two crafting plans share a sub-recipe (e.g. both fences and doors needing planks, where planks are also needed for sticks), merging the duplicate plank jobs left dependent jobs orphaned and deserialized the dependency graph incorrectly on world reload.

Fixes

  • Transfer dependents on job merge (CraftingJobDependencyGraph.mergeCraftingJobs): When mergeCraftingJobs(target, mergee, true) is called, the mergee's dependents (e.g. SticksJob which depended on the merged PlanksForSticks job) were never transferred to target. As a result, crafted output from target bypassed those jobs and flowed directly to network storage instead of their buffers, stalling the crafting chain. The fix transfers all graph-level and job-level dependent links from mergee to target before onCraftingJobFinished removes the mergee.

  • Fix deserialization tag key (CraftingJobDependencyGraph.deserialize): The dependents map was deserialized from the "dependencies" NBT tag instead of "dependents", causing dependencies == dependents after every world load and corrupting crafting job routing on restart.

// Before (bug)
CompoundTag dependentsTag = tag.getCompound("dependencies");

// After
CompoundTag dependentsTag = tag.getCompound("dependents");

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Investigate intermittent game test failure for crafting items Investigate flaky testItemsCraftFencesDoorsConcurrent game test Feb 28, 2026
Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
Copilot AI changed the title Investigate flaky testItemsCraftFencesDoorsConcurrent game test Fix intermittent concurrent crafting test failure caused by lost dependents during job merge Feb 28, 2026
Copilot AI changed the title Fix intermittent concurrent crafting test failure caused by lost dependents during job merge Fix orphaned dependency jobs leaking ingredients when merging crafting jobs Feb 28, 2026
…ndents

Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
Copilot AI changed the title Fix orphaned dependency jobs leaking ingredients when merging crafting jobs Fix CraftingJobDependencyGraph deserialize reading wrong tag for dependents Mar 1, 2026
Copilot AI changed the title Fix CraftingJobDependencyGraph deserialize reading wrong tag for dependents Fix two bugs causing intermittent crafting failures when merging jobs with shared recipe dependencies Mar 1, 2026
Copilot stopped work on behalf of rubensworks due to an error March 1, 2026 09:34
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