Skip to content

feat(healbot): v1.4.0 add undisease/poison feature, improve timeout/hook for transfer#2333

Merged
mrhoribu merged 7 commits into
masterfrom
rfe/timout-and-unpoison-undisease
May 24, 2026
Merged

feat(healbot): v1.4.0 add undisease/poison feature, improve timeout/hook for transfer#2333
mrhoribu merged 7 commits into
masterfrom
rfe/timout-and-unpoison-undisease

Conversation

@athias
Copy link
Copy Markdown
Collaborator

@athias athias commented May 24, 2026

Adds a timeout to the transfer downstream hook to prevent odd circumstances when a transfer fails

Adds Unpoison request
Adds Undisease request

Version locks healbot_actions and healbot_core together

Summary by CodeRabbit

  • New Features

    • Added undisease, unpoison, and fixmuscles commands for expanded healing options.
    • Enhanced command trigger system to recognize disease and poison events automatically.
  • Bug Fixes

    • Improved transfer command reliability with timeout protection during appraisal operations.

Review Change Stack

@athias athias requested a review from mrhoribu May 24, 2026 14:48
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 24, 2026

Warning

Review limit reached

@athias, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 1 review/hour. Refill in 25 minutes and 24 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c5571935-5337-4664-82f7-df44c156165f

📥 Commits

Reviewing files that changed from the base of the PR and between da51cca and ad3ab15.

📒 Files selected for processing (2)
  • scripts/healbot_actions.lic
  • scripts/healbot_core.lic
📝 Walkthrough

Walkthrough

This PR extends healbot with two new healing spell commands (undisease and unpoison), wires them into the trigger system, and fixes concurrency issues by adding timeouts and disabling the problematic room monitoring thread.

Changes

Healbot Disease and Poison Healing with Concurrency Improvements

Layer / File(s) Summary
New disease and poison healing spell commands
scripts/healbot_actions.lic, scripts/healbot_core.lic
Implements undisease(character) and unpoison(character) command methods (spells 113 and 114), registers them in the command allowlist, updates documentation and default messaging variables for both commands, extends the trigger regex system to recognize disease and poison event messages and route them to the new commands, and bumps versions to 1.4.0.
Appraise timeout and concurrency robustness
scripts/healbot_actions.lic, scripts/healbot_core.lic
Wraps the transfer command's appraise sequence in Timeout::timeout(3) to prevent unbounded waits, actively resets target_character and target_command to nil after action processing for clean state, disables the monitor_room thread entirely to avoid room monitoring concurrency issues, and updates the threads join list to exclude the disabled thread.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately reflects the main changes: adding undisease/unpoison features and improving timeout/hook for the transfer command.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rfe/timout-and-unpoison-undisease

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mrhoribu mrhoribu changed the title Added timeout/hook for transfer, and undiease/unpoison feat(healbot): v1.4.0 add undisease/poison feature, improve timeout/hook for transfer May 24, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
scripts/healbot_core.lic (1)

20-21: 💤 Low value

Unnecessary Array.new initialization.

Line 20 creates an empty array that is immediately overwritten on line 21. This line can be removed.

Proposed fix
-required_scripts = Array.new
 required_scripts = ["healbot_actions", "waggle"]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/healbot_core.lic` around lines 20 - 21, Remove the redundant empty
array initialization: delete the line that sets required_scripts = Array.new and
keep the subsequent assignment required_scripts = ["healbot_actions", "waggle"];
update any surrounding code/comments if they referenced the initial empty
initialization so only the explicit literal assignment remains (look for the
variable required_scripts in this file to confirm no other initialization is
needed).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/healbot_actions.lic`:
- Line 38: The array assignment for healbot_actions is missing spaces after
commas causing RuboCop failures; update the healbot_actions declaration so each
comma is followed by a space (e.g., "eatbread", "givebread", "healdown", ...) in
the healbot_actions variable to satisfy style rules and the pipeline.
- Around line 284-289: Wrap the Timeout::timeout block in a begin/rescue/ensure
so Timeout::Error is rescued and handled (e.g. log or set a failure flag)
instead of propagating, and always remove the downstream hook in an ensure block
to avoid leaving hooks registered (reference Timeout::timeout,
DownstreamHook.add("hb_appraise", action), DownstreamHook.remove("hb_appraise"),
appraisal_done, and the fput "appraise #{character}" call); also fix spacing by
adding a space before the `{` in the Timeout::timeout call (use
Timeout::timeout(3) { ...) and before any `{` that the pipeline flagged.

In `@scripts/healbot_core.lic`:
- Line 14: Update the version lock comment string so it references the correct
file: replace the text "Version locked with healbot_core.lic" in this file's
header with "Version locked with healbot_actions.lic" (i.e., update the literal
comment line in scripts/healbot_core.lic from healbot_core.lic to
healbot_actions.lic).

---

Nitpick comments:
In `@scripts/healbot_core.lic`:
- Around line 20-21: Remove the redundant empty array initialization: delete the
line that sets required_scripts = Array.new and keep the subsequent assignment
required_scripts = ["healbot_actions", "waggle"]; update any surrounding
code/comments if they referenced the initial empty initialization so only the
explicit literal assignment remains (look for the variable required_scripts in
this file to confirm no other initialization is needed).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0cd8187f-3cf8-41ac-b33c-09c8c0075cd2

📥 Commits

Reviewing files that changed from the base of the PR and between 11b2900 and da51cca.

📒 Files selected for processing (2)
  • scripts/healbot_actions.lic
  • scripts/healbot_core.lic

Comment thread scripts/healbot_actions.lic Outdated
Comment thread scripts/healbot_actions.lic Outdated
Comment on lines 284 to 289
Timeout::timeout(3){
DownstreamHook.add("hb_appraise", action)
fput "appraise #{character}"
wait_until { appraisal_done }
}
DownstreamHook.remove("hb_appraise")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Unhandled Timeout::Error will crash the script on timeout.

If the appraise workflow exceeds 3 seconds, Timeout::timeout raises Timeout::Error which propagates uncaught, terminating the script. This defeats the purpose of adding a timeout to "prevent issues when a transfer fails."

Wrap the timeout block in a rescue to handle the timeout gracefully.

Proposed fix
-    Timeout::timeout(3){
+    begin
+      Timeout::timeout(3) {
-      DownstreamHook.add("hb_appraise", action)
-      fput "appraise #{character}"
-      wait_until { appraisal_done }
-    }
+        DownstreamHook.add("hb_appraise", action)
+        fput "appraise #{character}"
+        wait_until { appraisal_done }
+      }
+    rescue Timeout::Error
+      echo "hb_actions:transfer: Appraise timed out"
+      DownstreamHook.remove("hb_appraise")
+      exit
+    end
     DownstreamHook.remove("hb_appraise")

Additionally, fix the missing space before { per the pipeline failure:

-    Timeout::timeout(3){
+    Timeout::timeout(3) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Timeout::timeout(3){
DownstreamHook.add("hb_appraise", action)
fput "appraise #{character}"
wait_until { appraisal_done }
}
DownstreamHook.remove("hb_appraise")
begin
Timeout::timeout(3) {
DownstreamHook.add("hb_appraise", action)
fput "appraise #{character}"
wait_until { appraisal_done }
}
rescue Timeout::Error
echo "hb_actions:transfer: Appraise timed out"
DownstreamHook.remove("hb_appraise")
exit
end
DownstreamHook.remove("hb_appraise")
🧰 Tools
🪛 GitHub Actions: Rubocop / 0_Run Rubocop on Ruby.txt

[error] 284-284: Rubocop: Layout/SpaceBeforeBlockBraces: Space missing to the left of '{'. (Timeout::timeout(3){ ... })

🪛 GitHub Actions: Rubocop / Run Rubocop on Ruby

[error] 284-284: Rubocop: Layout/SpaceBeforeBlockBraces: Space missing to the left of '{'.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/healbot_actions.lic` around lines 284 - 289, Wrap the
Timeout::timeout block in a begin/rescue/ensure so Timeout::Error is rescued and
handled (e.g. log or set a failure flag) instead of propagating, and always
remove the downstream hook in an ensure block to avoid leaving hooks registered
(reference Timeout::timeout, DownstreamHook.add("hb_appraise", action),
DownstreamHook.remove("hb_appraise"), appraisal_done, and the fput "appraise
#{character}" call); also fix spacing by adding a space before the `{` in the
Timeout::timeout call (use Timeout::timeout(3) { ...) and before any `{` that
the pipeline flagged.

Comment thread scripts/healbot_core.lic Outdated
@mrhoribu mrhoribu merged commit bb46d5b into master May 24, 2026
4 checks passed
@mrhoribu mrhoribu deleted the rfe/timout-and-unpoison-undisease branch May 24, 2026 15:30
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