Skip to content

Normalize Nemotron terminal prompts and empty turns - #292

Merged
neubig merged 7 commits into
mainfrom
fix-nemotron-terminal-normalization
Jul 5, 2026
Merged

neubig merged 7 commits into
mainfrom
fix-nemotron-terminal-normalization

Conversation

@neubig

@neubig neubig commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #281.
Refs #296.

Summary

  • keep raw_to_atif faithful to the source terminal transcript
  • move terminal prompt splitting, empty-turn cleanup, and completion JSON conversion into atif_to_std.py
  • convert terminal completion JSON with task_complete=true and no commands into structured finish tool calls only when a non-empty analysis/plan message is available
  • regenerate sample_std.json and all sample_sft outputs from the updated standardized samples

Design decisions

  • Split marker: use the exact "\n\nTask Description:\n" marker because the Nemotron terminal prompt stores reusable system instructions before that marker and the user task after it in the first user step.
  • Scope of splitting: inspect only the first step so later agent/user content that happens to mention "Task Description:" is preserved as transcript content.
  • Conversion stage: perform prompt splitting and empty-turn cleanup in atif_to_std.py so raw_to_atif remains a faithful representation of the source data.
  • Completion JSON: structure task_complete=true/no-command payloads as finish calls only when analysis or plan provides a non-empty message; otherwise leave the raw message unchanged for downstream handling.

Validation

  • regenerated sample_std.json from sample_atif.json and confirmed it matches the committed fixture
  • regenerated openhands_v0, openhands_sdk, and sweagent sample_sft outputs from sample_std.json
  • python -m py_compile datasets/nemotron_terminal_corpus/atif_to_std.py

Known limitations

  • The prompt split intentionally handles only the initial combined terminal prompt pattern. Later occurrences of the marker are treated as ordinary conversation text.
  • Empty completion JSON payloads with task_complete=true but no analysis/plan are not converted into finish calls because they do not contain a useful completion message.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Acceptable logic, but SFT samples are stale. The raw_to_atif.py changes are correct — splitting the combined user/system prompt and filtering empty turns is the right normalisation. One blocking issue prevents merge.

This review was generated by an AI agent (OpenHands) on behalf of the repository maintainers.


Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/neulab/agent-data-protocol/actions/runs/28747951247

Comment thread datasets/nemotron_terminal_corpus/raw_to_atif.py
Comment thread datasets/nemotron_terminal_corpus/raw_to_atif.py Outdated
Comment thread datasets/nemotron_terminal_corpus/raw_to_atif.py
@neubig neubig added the review-this Trigger the OpenHands PR review workflow label Jul 5, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Acceptable logic, SFT samples now regenerated. The prompt-splitting and empty-turn filtering in atif_to_std.py are correct, and the blocking issue from the previous review (stale SFT samples) is resolved. One new correctness edge case found; two previously flagged issues in unresolved threads remain open.

Still-open from prior threads:

  • step_id=2 placeholder on the newly inserted step is still present (misleading, flagged in unresolved thread).
  • PR description still omits the design-decision catalog and structured test results required by AGENTS.md for dataset format changes.

Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/neulab/agent-data-protocol/actions/runs/28751013082

Comment thread datasets/nemotron_terminal_corpus/atif_to_std.py Outdated
@neubig
neubig force-pushed the fix-nemotron-terminal-normalization branch from 2392dba to 44a8d1c Compare July 5, 2026 20:25
@neubig neubig added review-this Trigger the OpenHands PR review workflow and removed review-this Trigger the OpenHands PR review workflow labels Jul 5, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Acceptable — one minor edge case to consider. The prompt-splitting and empty-turn filtering logic is correct, and all previously blocking issues (stale SFT samples, step_id placeholder, PR description gaps) are resolved. CI passes (test (3.12), pre-commit, check_dataset_metadata, check-pr-artifacts). One remaining edge case in structure_terminal_completion is noted below.

This review was generated by an AI agent (OpenHands) on behalf of the repository maintainers.


Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/neulab/agent-data-protocol/actions/runs/28754029410

Comment thread datasets/nemotron_terminal_corpus/atif_to_std.py Outdated
@neubig neubig added review-this Trigger the OpenHands PR review workflow and removed review-this Trigger the OpenHands PR review workflow labels Jul 5, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Good taste. All previously blocking issues are resolved. The logic in normalize_nemotron is correct: structure_terminal_completion_step runs before the empty-turn filter (converted steps gain a ToolCall and are therefore not filtered), and renumber_steps runs last after the filter. The commands = payload.get("commands") or [] fix and the empty-message guard are both sound. Sample files are valid JSON with trailing newlines, 5 matching records, and correct function_call roles throughout.

One observation, not blocking: split_terminal_task_description_prompt calls renumber_steps internally, and normalize_nemotron calls it again at the end after filtering empty turns. The first numbering is immediately overwritten, but since the internal call is inside the shared helper (used by other datasets too), the double-renumber is unavoidable here and harmless.


Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/neulab/agent-data-protocol/actions/runs/28754282199

This review was generated by an AI agent (OpenHands) on behalf of the repository maintainers.

@neubig
neubig merged commit 21f5e6b into main Jul 5, 2026
9 checks passed
@neubig
neubig deleted the fix-nemotron-terminal-normalization branch July 5, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-this Trigger the OpenHands PR review workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Normalize Nemotron terminal prompts and empty turns

1 participant