refactor(observability): decouple trainers from WandB - #32
Draft
leviking98z-rgb wants to merge 1 commit into
Draft
refactor(observability): decouple trainers from WandB#32leviking98z-rgb wants to merge 1 commit into
leviking98z-rgb wants to merge 1 commit into
Conversation
2 tasks
leviking98z-rgb
force-pushed
the
refactor/observability-api
branch
from
August 2, 2026 17:28
fe46af1 to
926fabd
Compare
leviking98z-rgb
force-pushed
the
refactor/reward-ownership
branch
from
August 2, 2026 17:28
3cdf886 to
39165d1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Observerprotocol,NullObserver, factory, checkpoint-state helper, and phase instrumentation underunirl.observability.BaseTrainer, every loop program, and all trainer variants emit metrics, media, progress, and lifecycle events throughself.observer; trainers no longer import or name the WandB adapter.report_to_wandbrecipes while adding explicitlogging.provider: none|wandband genericlogging.enabledselection.wandb_logger, or backend-named lifecycle hooks.This is a boundary-stability PR, not a LOC-reduction PR: 630 insertions / 364 deletions (net +266), including the new contract, null implementation, static guard, and documentation. It removes the duplicated timing/progress policy from the concrete adapter and makes another telemetry backend possible without changing trainer programs.
This is stacked on
refactor/reward-ownership(#31 in this fork), not onmain.Related Issue
N/A
Test Plan
pre-commit run --all-files— passed, including all 120 recipe compositions, target resolution, Ruff, architecture boundaries, experimental boundaries, and framework contracts.python -m compileall -q unirl/observability unirl/trainer unirl/utils/wandb_logger.py unirl/utils/memory_monitor.py unirl/utils/media.py unirl/types/media_preview.py lint/check_framework_contracts.py— passed.python lint/check_framework_contracts.py— passed; reports one Observer contract and verifies no trainer-facing WandB dependency remains.python lint/check_architecture_boundaries.py— passed (476 files / 4,279 internal import edges).python lint/check_experimental_boundaries.py— passed.Observerconformance, old/new checkpoint run-id state, disabled factory selection, invalid-provider rejection, enabled-adapter argument forwarding, phase-time injection across consecutive steps, console progress, and memory-monitor step boundaries — passed.Compatibility / Risk
logging.report_to_wandb, project, tags, entity, directory, and media fields remain accepted with the same enabled behavior.provider: wandbplusenabled: true;provider: noneselects the dependency-light null observer. Unknown providers fail before training starts.observer_run_idand continue writingwandb_run_id; resume accepts either field, preferring the provider-neutral one. Older and newer checkouts can therefore exchange trainer state.BaseTrainer.wandb_logger,_init_wandb,_finish_wandb, and_loop_wandb_extraare replaced by provider-neutral names. Out-of-tree trainer subclasses using those internal seams must migrate toobserver,_init_observability,_finish_observability, and_loop_observability_metadata.Reviewer Notes
unirl/observability/api.py,factory.py,trainer/base.py,trainer/program.py, thencheck_observer_contract.BaseTrainer/AR/diffusion to extract a synchronous loop, but this stack already centralizes all loop families in refactor(trainer): separate lifecycle and loop programs #25 and this PR addresses a different boundary. Official fix(trainer): preserve async diffusion teardown cause Tencent-Hunyuan/UniRL#239 and feat(async-ar): full-async dual control for continuous rollout Tencent-Hunyuan/UniRL#213 touch async teardown/trainer files but do not abstract metrics or media providers; textual rebase conflicts are possible, semantic duplication is not.Checklist