Repository navigation
Fix non-blocking jobs losing running operations on insert failure - #254
Open
rubensworks wants to merge 1 commit into
Open
rubensworks wants to merge 1 commit into
rubensworks wants to merge 1 commit into
Conversation
When a target accepted recipe inputs in simulation but not for real, all running operations of the job were forgotten, and the refused inputs were moved to the storage network. In non-blocking mode, this made crafting jobs get stuck forever. Equal inputs are now stacked when simulating, so simulation also fails when they only fit separately. If the real insertion still fails, only that operation is undone, and the refused inputs go back to the job. Related to #252 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D8EZpiK75euMoLjy5r6suM
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.
Related to the non-blocking problem described in #252 (comment) (crafting results stop being registered for big non-blocking crafts, until the interface is replaced).
Problem
When a target accepts the recipe inputs in simulation, but refuses part of them for real,
consumeAndInsertCraftingcalledunmarkCraftingJobProcessing. That dropped all pending output entries of the job, including operations that were already running in the machine in non-blocking mode. Their results were then no longer claimed. On top of that, the refused inputs were put into the storage network instead of back into the job, so the job's buffer was short and the job stayed pending forever.This mismatch between simulation and real insertion happens easily in non-blocking mode, as that fills machines up to capacity: inputs are simulated one by one, so two equal instances that each fit separately (for example 1 free spot left) are accepted in simulation, while only one fits for real. Blocking mode rarely fills a machine, which matches the report that blocking mode works.
Changes
CraftingHelpers.insertCraftingoverload takes a fallback storage getter. The existing signature still falls back to the network.)Known limitation: inputs that did get into the machine during a failed insertion can not be taken back, so the job can still end up short on inputs in that case. The added stacking avoids the most common cause of such failures.
Tests
New game tests in
GameTestsItemsCraftNonBlockingInsertFailure:testNonBlockingJobFinishesWhenTargetFillsUp: two equal inputs, machine with 3 free spots. Without the fix, the job gets stuck atamount=2with an empty buffer.testNonBlockingJobKeepsRunningOperationsWhenInsertionFails: two different unstackable inputs competing for the last free slot. Checks that the running operation is still counted and the refused input goes back to the job, not to storage.Both fail without the production changes and pass with them.
./gradlew buildand./gradlew runGameTestServer(84 tests) pass.Generated by Claude Code