Skip to content

Conversation

@daveey
Copy link
Contributor

@daveey daveey commented Jan 3, 2026

Replace Agent Damage System with Health System

TL;DR

Replaces the previous damage system with a more flexible health-based system that triggers mutations when health reaches zero.

What changed?

  • Replaced DamageConfig with HealthConfig that uses a dedicated health resource
  • Changed check_and_apply_damage to check_and_apply_health_damage which triggers when health reaches 0
  • Added support for configurable mutations that trigger on health depletion
  • Updated Python bindings and configuration classes to support the new health system
  • Renamed related tests and updated them to test the new functionality
  • Updated the cogsguard recipe to use the new health system

How to test?

  1. Run the updated tests in test_damage.py (renamed from damage to health tests)
  2. Create a configuration with a health resource and on_damage mutations
  3. Verify that mutations trigger when health reaches 0
  4. Test with the cogsguard recipe to ensure agents lose gear when health depletes

Why make this change?

The previous damage system was limited to randomly destroying resources when thresholds were met. The new health system is more intuitive and flexible, allowing for any type of mutation to be triggered when health reaches zero. This enables more complex game mechanics like dropping items, applying status effects, or respawning with different properties.

Copy link
Contributor Author

daveey commented Jan 3, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 74aef1a484

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +162 to 166
// Check if health resource has reached 0
InventoryQuantity health = this->inventory.amount(health_config.health_resource);
if (health > 0) {
return false; // Still has health
}

Choose a reason for hiding this comment

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

P2 Badge Guard against repeated on_damage triggers at 0 HP

Because check_and_apply_health_damage only tests the current health value and doesn’t track a transition to zero, any agent that stays at 0 HP will re-run every on_damage mutation on every tick. That means configs that don’t explicitly restore health (e.g., only clear inventory or transfer resources) will keep applying those effects indefinitely, which is likely unintended for a “trigger when health reaches 0” event. Consider tracking a previous-HP state or marking that the death-trigger has fired until health rises above 0 again.

Useful? React with 👍 / 👎.

@datadog-official

This comment has been minimized.

@openhands-ai
Copy link

openhands-ai bot commented Jan 3, 2026

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • Test and Benchmark

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #4593 at branch `daveey-hp`

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

@daveey daveey force-pushed the daveey-activation-cleanup branch 2 times, most recently from 0f0c196 to 4f8ee02 Compare January 4, 2026 22:48
@daveey daveey force-pushed the daveey-activation-cleanup branch from 4f8ee02 to c7fc591 Compare January 4, 2026 23:05
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