Skip to content

[observability] Fast-follows and gaps from model-call capture refactor and rollout observability stack #2192

Closed
5 of 5 issues completed

Description

@sephmard

Background

PR #2027 refactored model-call capture and extended it to agents. PRs #2114–#2120 defined the rollout observation contract and added agent-side observations. This issue tracks the known gaps and fast-follows from that work.

From #2027 — explicit fast-follow TODOs

1. Circular import chain
server_utils → openai_utils → capture_records → openai_utils creates a circular dependency currently worked around with nested imports. Needs a proper resolution — likely moving shared types to a separate module.

2. CaptureConfig should be a global
Currently consumers access capture config via self._capture_config. Should be module-level so callers don't have to thread it through every class that needs it.

3. Anthropic SSE → OpenAI Response conversion is incomplete
Anthropic Messages streaming capture is partially implemented — request conversion works but response stream → NeMoGymResponse conversion has an explicit TODO. Streaming Anthropic calls are not fully captured today.

4. Background task handling is incomplete
Two # Later on we can handle cases where there are existing background tasks comments in the agent capture middleware. If a response already has background tasks attached, capture may not compose correctly.

From the rollout observability stack (#2114–#2120) — sandbox metric gaps

5. Average core utilization is derivable but not computed
cpu_time_s / wall_time_s gives average cores in use. Both fields are captured at sandbox stop. This should be computed and stored as a field on SandboxObservation rather than left to consumers to derive.

6. Total CPU utilization (%) has a collection gap
(cpu_time_s / wall_time_s) / allocated_cpus * 100 requires allocated_cpus. The CPU allocation lives in SandboxSpec.resources.cpu at sandbox creation but is not stored in SandboxObservation. Add it so consumers can compute utilization % without needing the original spec.

7. Peak concurrent cores requires sampling infrastructure that doesn't exist
The current resource_usage hook is called once at sandbox stop and reads cumulative cgroup totals. Peak concurrent cores requires polling usage_usec from the cgroup at intervals during execution, tracking Δcpu_time / Δwall_time across windows, and storing the maximum. Needs: a background sampler started at sandbox creation, a new provider hook or callback, and thread-safe accumulation. ECS Fargate would require CloudWatch instead of cgroups.

Acceptance criteria

  • Circular import chain resolved without nested imports
  • CaptureConfig accessible as a module-level global
  • Anthropic SSE stream fully converted to NeMoGymResponse for capture
  • Background task composition in agent capture middleware handled correctly
  • SandboxObservation stores avg_cores_used (derived from existing fields)
  • SandboxObservation stores cpu_allocated from SandboxSpec.resources.cpu
  • Peak concurrent cores tracked via background sampler in sandbox providers (Docker + Apptainer initially; ECS Fargate tracked separately via CloudWatch)

Sub-issues

Sub-issues

5 of 5 Issues completed
Loading 5 sub-issues

Activity

  1. moved this from Dev Todo to Dev WIP in NeMo Gym 0.6.0 - Sept 2on Jul 30, 2026
  2. moved this from Dev WIP to Dev Todo in NeMo Gym 0.6.0 - Sept 2on Jul 30, 2026
  3. linear-code commented on Aug 3, 2026

    @linear-code

    from rita:

    @Glorf let's commit to closing 2124-2126 by mid-August if possible

  4. moved this from Dev Todo to Dev WIP in NeMo Gym 0.6.0 - Sept 2on Aug 11, 2026
  5. moved this from Dev WIP to Review WIP in NeMo Gym 0.6.0 - Sept 2on Aug 25, 2026
  6. Glorf commented on Aug 25, 2026

    @Glorf
    Contributor

    done!

  7. moved this from Done to QA Todo in NeMo Gym 0.6.0 - Sept 2on Aug 27, 2026
  8. moved this from QA Todo to QA WIP in NeMo Gym 0.6.0 - Sept 2on Aug 27, 2026
  9. moved this from QA WIP to Done in NeMo Gym 0.6.0 - Sept 2on Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions