Skip to content

Conversation

@daveey
Copy link
Contributor

@daveey daveey commented Dec 14, 2025

TL;DR

Refactored inventory management by introducing a dedicated InventoryConfig class and restructuring inventory-related properties across the codebase.

What changed?

  • Added a new InventoryConfig class to encapsulate inventory-related properties
  • Moved inventory properties from AgentConfig and ChestConfig into the new InventoryConfig:
    • initial_inventoryinventory.initial
    • resource_limitsinventory.limits
    • default_resource_limitinventory.default_limit
    • inventory_regen_amountsinventory.regen_amounts
  • Updated all references to these properties throughout the codebase
  • Removed unused inventory diversity tracking functionality
  • Removed soul-bound resources feature
  • Increased inventory quantity type from 8-bit to 16-bit to support larger inventory values

How to test?

  • Run existing tests to verify inventory functionality still works correctly
  • Verify that inventory limits, initial values, and regeneration still function as expected
  • Check that diagnostic missions and other game modes still operate correctly with the new inventory structure

Why make this change?

This refactoring improves code organization by grouping related inventory properties into a dedicated class, making the codebase more maintainable and easier to understand. The change also removes unused features like inventory diversity tracking and soul-bound resources, simplifying the codebase. The increased inventory quantity size allows for larger inventory values, providing more flexibility in game design.

Copy link
Contributor Author

daveey commented Dec 14, 2025

@daveey daveey changed the title cp Refactor inventory system into dedicated InventoryConfig class Dec 14, 2025
@daveey daveey marked this pull request as ready for review December 14, 2025 18:55
@daveey daveey requested a review from sasmith December 14, 2025 18:56
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.

ℹ️ 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".

@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 14, 2025

Merge activity

  • Dec 14, 8:25 PM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Dec 14, 8:25 PM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Dec 21, 12:10 AM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Dec 21, 12:10 AM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..

@datadog-official
Copy link

datadog-official bot commented Dec 15, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0fdcc0b | Docs | Was this helpful? Give us feedback!

@daveey daveey changed the base branch from main to graphite-base/4356 December 15, 2025 07:39
@daveey daveey force-pushed the daveey-inventory-config branch from 80c1cf6 to 7668fd5 Compare December 15, 2025 07:39
@daveey daveey changed the base branch from graphite-base/4356 to daveey-inventory-init December 15, 2025 07:39
@daveey daveey changed the base branch from daveey-inventory-init to graphite-base/4356 December 16, 2025 03:51
@daveey daveey force-pushed the daveey-inventory-config branch from 7668fd5 to c8b1cf2 Compare December 16, 2025 03:53
@daveey daveey force-pushed the graphite-base/4356 branch from 3e018fc to 490050d Compare December 16, 2025 03:53
Copy link
Contributor

@sasmith sasmith left a comment

Choose a reason for hiding this comment

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

Requesting changes again.

If you want to extract the increased inventory amounts, that would be fine. If you want to leave them in, the base-vs-max issue needs to get fixed (it will have a nice side effect of capping the number of tokens to 2).

@daveey daveey force-pushed the daveey-inventory-config branch from 38ea7cd to ef5f7f2 Compare December 23, 2025 04:18
@daveey daveey force-pushed the daveey-inventory-config branch from ef5f7f2 to 0fdcc0b Compare December 23, 2025 04:40
Copy link
Contributor Author

daveey commented Dec 23, 2025

I somehow merged the multi-token changes into this branch, instead of the one above. i folded them both into one, so it makes more sense now

@daveey daveey requested a review from sasmith December 23, 2025 04:42
@openhands-ai
Copy link

openhands-ai bot commented Dec 23, 2025

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 #4356 at branch `daveey-inventory-config`

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

You can manage your notification settings

}

// Encode inventory amount using multi-token encoding with configurable base.
// inv:{resource} = amount % token_value_base (always emitted)
Copy link
Contributor

Choose a reason for hiding this comment

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

Sort of interesting that we leave this off if the total resource value is zero, but we include it if the total value is non-zero, even if this particular component is zero. Seems fine -- just interesting.

@daveey daveey added this pull request to the merge queue Dec 24, 2025
Merged via the queue into main with commit 7f47d57 Dec 24, 2025
33 of 35 checks passed
@daveey daveey deleted the daveey-inventory-config branch December 24, 2025 03:09
github-merge-queue bot pushed a commit that referenced this pull request Dec 24, 2025
## Summary
- Default the agent obs shim to ignore inventory power tokens
(`inv:*:pN`) and remap feature IDs to legacy ordering
- Restore legacy inventory normalization (100.0) for those remapped
features
- Fix power-token detection regex so the shim is effective

## Why
Inventory power tokens introduced in #4356 shifted feature IDs and broke
older policies trained on the pre-split inventory encoding. We only care
about counts up to 255 for agents, so remapping to the legacy scheme
restores compatibility.

## Changes
- `ObsShimTokens` now defaults `ignore_inventory_power_tokens=True`
- Power-token names are detected correctly and remapped to UNKNOWN
- Legacy feature ID ordering + legacy normalization restored for
inventory features

## Testing
- `uv run cogames run -m machina_1.open_world -c 4 -v heart_chorus -p
s3://softmax-public/policies/relh.machina_bc_dinky_sup.hc.1221.10b.0.35/relh.machina_bc_dinky_sup.hc.1221.10b.0.35:v2700.mpt
-e 1 -s 1000 --format json`
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.

3 participants