Skip to content

feat: add configurable metrics toggle and guard node hooks - #15

Merged
leslieo2 merged 3 commits into
masterfrom
feat-add-configurable-metrics-toggle-and-guard-node-hooks
Nov 2, 2025
Merged

feat: add configurable metrics toggle and guard node hooks#15
leslieo2 merged 3 commits into
masterfrom
feat-add-configurable-metrics-toggle-and-guard-node-hooks

Conversation

@leslieo2

@leslieo2 leslieo2 commented Nov 2, 2025

Copy link
Copy Markdown
Owner

No description provided.

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

Copy link
Copy Markdown

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 thread src/game/metrics.py Outdated
Comment on lines +697 to +706
def _default_metrics_enabled() -> bool:
try:
from .config import get_config

return bool(get_config().metrics_enabled)
except Exception:
return False


metrics_collector = GameMetrics(enabled=_default_metrics_enabled())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid initializing configuration in metrics module import

The new _default_metrics_enabled() call at module import time eagerly invokes get_config() and caches the default configuration before application code has a chance to provide a custom path. Because get_config memoizes the first loaded instance, any subsequent call like get_config("/custom/path.yaml") will now silently return the already loaded default config, so runtime configuration overrides no longer work unless callers explicitly call reload_config first. This regression is triggered whenever src.game.metrics is imported (which happens from the nodes modules) and prevents consumers from loading non-default configs.

Useful? React with 👍 / 👎.

@leslieo2

leslieo2 commented Nov 2, 2025

Copy link
Copy Markdown
Owner Author

@codex review

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

Copy link
Copy Markdown

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 thread src/game/nodes/host.py Outdated
Comment on lines +14 to +17
def host_setup(state: GameState) -> Dict[str, Any]:
"""Initializes the game, assigning roles and words."""
config = get_config()
metrics_collector.set_enabled(config.metrics_enabled)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Host setup overrides runtime metrics toggle

The new metrics toggle is forcibly reset at the start of every game. host_setup immediately calls metrics_collector.set_enabled(config.metrics_enabled), so any code that turns metrics on programmatically (e.g. run_multilingual_metrics_batch now calls metrics_collector.set_enabled(True) before executing games) is undone as soon as the host node runs when the config file has metrics.enabled: false (the default). As a result the batch command never records metrics and prints empty aggregates unless the user edits the config file first. Consider respecting the current collector state or only setting it once at process start so temporary toggles can work.

Useful? React with 👍 / 👎.

@leslieo2

leslieo2 commented Nov 2, 2025

Copy link
Copy Markdown
Owner Author

@codex reivew

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

Copy link
Copy Markdown

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 thread src/game/nodes/host.py
Comment on lines 14 to +18
def host_setup(state: GameState) -> Dict[str, Any]:
"""Initializes the game, assigning roles and words."""
config = get_config()
metrics_collector.set_enabled(config.metrics_enabled)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid disabling metrics when batch runner enables them

The new metrics toggle forces every game start to call metrics_collector.set_enabled(config.metrics_enabled). During run_multilingual_metrics_batch the collector is explicitly enabled (and reset) to gather benchmark data, but config.metrics_enabled defaults to False, so the first host node immediately switches the collector off and clears its state. As a result the multilingual metrics CLI now yields empty metrics/quality scores unless the user edits config.yaml to enable metrics beforehand, which is a regression from the previous always-on behaviour and defeats the explicit enabling in the batch runner. Consider skipping this override when a batch run has already enabled metrics or when config.metrics_enabled is false by default.

Useful? React with 👍 / 👎.

@leslieo2

leslieo2 commented Nov 2, 2025

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

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

@leslieo2
leslieo2 merged commit d6e6ebe into master Nov 2, 2025
3 checks passed
@leslieo2
leslieo2 deleted the feat-add-configurable-metrics-toggle-and-guard-node-hooks branch November 2, 2025 03: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.

1 participant