fix(plantheal): retry hug after EV recast instead of exiting#2
Closed
fix(plantheal): retry hug after EV recast instead of exiting#2
Conversation
When the hug returns "appreciates the sentiment" (plant has no wounds) or "no empathic bond" (bond broken), the script correctly releases and recasts EV, but then immediately exits with "Stopped before hugging" instead of retrying with the fresh plant. This fix changes the behavior to retry the hug (up to 3 times) after recasting EV, which allows the script to continue training empathy with the fresh plant that now has wounds to transfer. Changes: - Add MAX_HUG_RETRIES constant (default 3) for recursion guard - Add retries parameter to hug_plant_once() method - After "appreciates the sentiment" → recast EV → retry hug - After "no empathic bond" → recast EV → retry hug - Add max retries check to prevent infinite loops Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add spec for MAX_HUG_RETRIES constant (value 3) - Add spec for retry exhaustion returning stopped_early - Add spec for retry after HUG_APPRECIATES response - Add spec for retry after "no empathic bond" response - Add spec verifying retry counter decrements on each retry Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
Fixes a bug where plantheal would exit immediately after recasting EV instead of retrying the hug with the fresh plant.
Problem
When hugging a Vela'Tohr plant, if the game returns:
"appreciates the sentiment"- plant has no wounds to transfer"no empathic bond"- bond is broken...the script correctly releases and recasts EV to create a fresh plant. However, it then immediately exits with:
This happens because after
release_and_recast_ev, the code returnedHugResult.new(0, :stopped_early)which triggers the exit path inrun_loop.Solution
After recasting EV, the script now retries the hug with the fresh plant instead of exiting:
A retry counter (
MAX_HUG_RETRIES = 3) prevents infinite loops if EV keeps failing.Changes
MAX_HUG_RETRIESconstant (default 3)retriesparameter tohug_plant_once()methodHUG_APPRECIATEScase: recast EV → retry hug (decrement counter)"no empathic bond"case: recast EV → retry hug (decrement counter)Testing
Verified in-game that the script now:
🤖 Generated with Claude Code