Repository navigation
Description
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
-
CaptureConfigaccessible as a module-level global - Anthropic SSE stream fully converted to
NeMoGymResponsefor capture - Background task composition in agent capture middleware handled correctly
-
SandboxObservationstoresavg_cores_used(derived from existing fields) -
SandboxObservationstorescpu_allocatedfromSandboxSpec.resources.cpu - Peak concurrent cores tracked via background sampler in sandbox providers (Docker + Apptainer initially; ECS Fargate tracked separately via CloudWatch)
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
linear-code commentedon Aug 3, 2026
from rita:
Glorf commentedon Aug 25, 2026
done!