Skip to content

Conversation

@manveerxyz
Copy link
Member

@manveerxyz manveerxyz commented Nov 24, 2025

Note

Introduce a pluggable monitoring system with Prime Intellect API support, refactor W&B monitor to a shared base, and wire both into orchestrator and config.

  • Monitoring framework:
    • Abstract base: Add Monitor with shared helpers (select_sample_problems, should_log_*) and finalization APIs.
    • Prime monitor: Implement PrimeMonitor to POST metrics/samples/distributions/finalization to Prime Intellect API (env: PRIME_INTELLECT_API_KEY, RUN_ID).
    • Composition: Add MultiMonitor and NoOpMonitor; new setup_monitor/get_monitor in utils/monitor/__init__.py to assemble monitors.
    • W&B refactor: WandbMonitor now extends Monitor, shares selection/interval logic; removes old module-level singleton setup.
  • Orchestrator:
    • Initialize unified monitor with wandb and prime configs; use for all log, sample/distribution logging, and finalization.
  • Config:
    • Add PrimeMonitorConfig and OrchestratorConfig.prime; generalize LogExtrasConfig descriptions; disable prime.log_extras in bench mode.

Written by Cursor Bugbot for commit a80ba56. This will update automatically on new commits. Configure here.

@manveerxyz manveerxyz marked this pull request as draft November 24, 2025 01:52
if config.log_extras.distributions:
self.last_log_distributions_step = -1
self.distributions = []

Copy link

Choose a reason for hiding this comment

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

Bug: Uninitialized attributes accessed in PrimeMonitor methods

The PrimeMonitor.__init__ method has early returns at lines 37, 46, and 57, but attributes like last_log_samples_step, samples, last_log_distributions_step, and distributions are only initialized at lines 60-69 after these early returns. When the monitor is disabled (e.g., missing API key or RUN_ID), these attributes remain uninitialized. Later, methods like log_samples() and log_distributions() attempt to access these attributes, causing AttributeError crashes even when is_master is True.

Fix in Cursor Fix in Web

or step % self.config.log_extras.interval != 0
):
# Do not log samples if not enabled or not log interval step
if not Monitor.should_log_samples(self.config, step, self.last_log_samples_step):
Copy link

Choose a reason for hiding this comment

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

Bug: WandbMonitor accesses uninitialized attributes after refactoring

The refactoring changes log_samples() and log_distributions() to call Monitor.should_log_samples() and Monitor.should_log_distributions(), which access self.last_log_samples_step and self.last_log_distributions_step as parameters before checking the config. The old code checked the config first, then accessed these attributes. If the monitor is disabled during initialization (early return at line 36), these attributes are never initialized, causing AttributeError when the methods are called, even if the config would have prevented logging.

Additional Locations (1)

Fix in Cursor Fix in Web

@manveerxyz manveerxyz force-pushed the feature/prime-monitor branch from a80ba56 to d2b4d41 Compare December 2, 2025 23:54
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