feat: opencode logging for perfetto trace - #3
Open
youngeunkwon0405 wants to merge 10 commits into
Open
Conversation
Signed-off-by: Youngeun Kwon <youngeunk@nvidia.com>
Signed-off-by: Youngeun Kwon <youngeunk@nvidia.com>
Signed-off-by: Youngeun Kwon <youngeunk@nvidia.com>
Signed-off-by: Youngeun Kwon <youngeunk@nvidia.com>
Signed-off-by: Youngeun Kwon <youngeunk@nvidia.com>
Signed-off-by: Youngeun Kwon <youngeunk@nvidia.com>
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
What does this PR do?
This PR adds precise observability for OpenCode SWE rollouts executed through NeMo Gym.
It records:
These records are aggregated into NeMo Gym’s per-turn metrics format, allowing swe_trace_converter.py to reconstruct the complete rollout timeline in Perfetto.
Implementation summary
bench/cli.ts: Collects completed tool-call events while OpenCode runs, then combines them with LLM completion metrics in the benchmark output. It also separates OpenCode initialization time from the actual agent runtime and recordsinitialize_runtime_timein NeMo Gym metrics.bench/metrics.ts: Adds a conversion layer for LLM completion dumps and tool events. It validates timestamps and token fields, preserves session/subagent relationships, orders overlapping requests by start time, and safely updatesnemo_gym_metrics.json.cli/cmd/run.ts: ~2 line changes here. This was required for capturing subagent tool call events.provider/sdk/nemo-gym/language-model.ts: Measures each LLM request from submission through response completion and records latency, request kind, turn number, session hierarchy, and token usage. It handles both generate (doGenerate) and stream (doStream) paths while leaving model request and response behavior unchanged.Issue for this PR
N/A
Type of change
What does this PR do?
Adds precise OpenCode metrics used to build the final Perfetto rollout trace:
Metrics that are not consumed by the final trace converter have been removed.
How did you verify your code works?
tsgo --noEmitpassed.4ae44814d24701cb46845576ec40abc95d937d9841bdb800e59a85092bdd9888).Screenshots / recordings
N/A
Checklist