You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
token capture: terminal attribution misses OpenCode answers split from a Gym reply's reasoning block #5609
With token_id_capture enabled, terminal attribution can no longer match the scored OpenCode response to its captured model call once #5548 splits a Gym Model Server reply's leading <think>...</think> block out of the answer.
Completion normalization keeps the Chat content as the gateway returned it, block included: <think>r</think>\n\n4 (nemo_gym/models/token_capture/completion.py). That is intentional; other harnesses rely on literal content.
opencode_agent now scores 4 and records r as a reasoning item, on both the host path (parse_opencode_session) and the session path (_session_output).
Terminal attribution compares the scored text with the captured text without undoing the split (nemo_gym/models/token_capture/terminal.py), so it reports no_content_match.
The consumer then falls back to the builder's chain policy (nemo_gym/models/token_capture/consumer.py). A single clean chain is still attributed. A rollout with several chains (OpenCode subagents or compaction) is masked instead of delivering the scored chain.
Capture is off by default, and the session path is documented as eval-only, so scoring is unaffected. The deprecated opencode_sandboxed_agent has the same gap. It was kept out of #5548 so that the scoring fix stays separate.
Proposed fix (either):
terminal attribution ignores a leading <think>...</think> block that the Gym Model Server added, when comparing a captured Chat completion with the scored response; or
opencode_agent declares its terminal model call, so attribution doesn't depend on content matching.
Regression
Two clean captured root chains with distinct outputs, one ending in <think>r</think>\n\n4. The split response (4) must attribute to that call; today it reports no_content_match and the rollout is masked. A single clean chain keeps its current fallback. Literal think tags in other harnesses' content stay as they are.
Raised by Giulio Lovisotto in the #5548 review. Part of #5552.
Activity