Skip to content

Conversation

@daveey
Copy link
Contributor

@daveey daveey commented Dec 22, 2025

TL;DR

Refactored vibe configuration to use explicit vibe lists instead of numeric counts.

What changed?

  • Changed change_vibe.number_of_vibes to change_vibe.vibes across the codebase
  • Updated all references to use the new explicit vibe list configuration
  • Modified documentation to reflect the new configuration approach
  • Updated test cases to use the new vibe configuration pattern
  • Ensured backward compatibility with existing code by maintaining the same behavior

How to test?

  1. Run existing tests to verify they pass with the new configuration
  2. Create a configuration with specific vibes and verify they're properly applied:
    from mettagrid.config.vibes import VIBE_BY_NAME
    cfg.game.actions.change_vibe.vibes = [VIBE_BY_NAME["happy"], VIBE_BY_NAME["sad"]]
  3. Verify that the vibe names in the game configuration match the vibes specified
  4. Test that the action space correctly reflects only the specified vibes

Why make this change?

The previous approach of using a numeric count (number_of_vibes) to limit available vibes was inflexible, as it only allowed using the first N vibes from the predefined list. This change enables explicit selection of which vibes should be available, allowing for more customized configurations without being constrained to the order of vibes in the default list. This is particularly useful for specialized environments that need specific vibes without including all preceding ones.

@daveey daveey changed the title cp Replace number_of_vibes with explicit vibes list in change_vibe action config Dec 22, 2025
@daveey daveey marked this pull request as ready for review December 22, 2025 18:24
@daveey daveey requested a review from relh December 22, 2025 18:25
@daveey daveey assigned relh and unassigned daveey Dec 22, 2025
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".

Comment on lines 36 to 40
config_dict["obs"] = config_dict["obs"].copy()
config_dict["obs"].pop("features", None)
# Keep vibe_names in sync with number_of_vibes; favor the explicit count.
# Keep vibe_names in sync with vibes; favor the vibes list.
config_dict.pop("vibe_names", None)
change_vibe_cfg = config_dict.setdefault("actions", {}).setdefault("change_vibe", {})
change_vibe_cfg["number_of_vibes"] = change_vibe_cfg.get("number_of_vibes") or len(VIBES)
game_config = GameConfig(**config_dict)

Choose a reason for hiding this comment

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

P1 Badge Legacy configs with number_of_vibes now fail validation

convert_to_cpp_game_config now instantiates GameConfig directly from the supplied dict without translating the old actions.change_vibe.number_of_vibes field into the new vibes list. GameConfig inherits extra="forbid", so any previously serialized configs or checkpoints that still include number_of_vibes will raise a validation error when Simulation passes them through this path, breaking the backward compatibility the refactor was meant to preserve. Consider mapping the legacy key to vibes (or dropping it) before calling GameConfig(**config_dict) to keep older configs working.

Useful? React with 👍 / 👎.

Copy link
Contributor

Choose a reason for hiding this comment

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

this seems fine? I dont know if we need older configs, maybe just older policies (maybe)

@daveey daveey changed the base branch from daveey-resource-limit to graphite-base/4489 December 23, 2025 04:18
@daveey daveey force-pushed the graphite-base/4489 branch from f4f2626 to ef5f7f2 Compare December 23, 2025 04:18
@daveey daveey changed the base branch from graphite-base/4489 to daveey-inventory-config 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

@relh relh left a comment

Choose a reason for hiding this comment

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

Socratic reviewing is great and I like this change also.

observations/actions/vibes could become a singular "language" that we have an interface to both encoding for the policy with a tokenizer and decoding from the policy

change_vibe.number_of_vibes = 8
has_gear = any(v.name == "gear" for v in change_vibe.vibes)
if not has_gear:
from mettagrid.config.vibes import VIBE_BY_NAME
Copy link
Contributor

Choose a reason for hiding this comment

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

this is kind of ugly can this import be at the top?

change_vibe.number_of_vibes = 8
has_gear = any(v.name == "gear" for v in change_vibe.vibes)
if not has_gear:
from mettagrid.config.vibes import VIBE_BY_NAME
Copy link
Contributor

Choose a reason for hiding this comment

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

this is kind of ugly can this import be at the top?

- `change_vibe_neutral`

> **Note**: The number of available vibes is configurable via `change_vibe.number_of_vibes`.
> **Note**: The available vibes are configurable via `change_vibe.vibes`.
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this change_vibe.vibes, maybe just vibes?

- `change_vibe_neutral`

> **Note**: The number of available vibes is configurable via `change_vibe.number_of_vibes`.
> **Note**: The available vibes are configurable via `change_vibe.vibes`.
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this change_vibe.vibes, maybe just vibes?

Comment on lines 36 to 40
config_dict["obs"] = config_dict["obs"].copy()
config_dict["obs"].pop("features", None)
# Keep vibe_names in sync with number_of_vibes; favor the explicit count.
# Keep vibe_names in sync with vibes; favor the vibes list.
config_dict.pop("vibe_names", None)
change_vibe_cfg = config_dict.setdefault("actions", {}).setdefault("change_vibe", {})
change_vibe_cfg["number_of_vibes"] = change_vibe_cfg.get("number_of_vibes") or len(VIBES)
game_config = GameConfig(**config_dict)
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems fine? I dont know if we need older configs, maybe just older policies (maybe)

# Enable change_vibe for GUI control, but create a policy config without it for random actions
cfg.game.actions.change_vibe.enabled = True
cfg.game.actions.change_vibe.number_of_vibes = 10
from mettagrid.config.vibes import VIBES as ALL_VIBES
Copy link
Contributor

Choose a reason for hiding this comment

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

this is kind of ugly can this import be at the top?

Base automatically changed from daveey-inventory-config to main December 24, 2025 03:09
@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 24, 2025

Merge activity

  • Dec 24, 3:12 AM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.

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