Skip to content

Fix Tier 3 grading for native Hermes and OpenCode tool calls - #867

Open
deepujain wants to merge 9 commits into
NVIDIA:mainfrom
deepujain:fix/866-verifier-tool-names
Open

deepujain wants to merge 9 commits into
NVIDIA:mainfrom
deepujain:fix/866-verifier-tool-names

Conversation

@deepujain

@deepujain deepujain commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Tier 3 could score the same run differently depending on which runner recorded it. The verifier now recognizes native Hermes skill reads and shell commands, and uses OpenCode's file paths and replacement text as grading evidence. Missing manifests and failed file changes do not count as proof.

A Hermes command that starts in the background earns execution credit, but it cannot clear an earlier failure until a retry finishes successfully. A quiet negative probe is not a failure. Security checks still inspect commands without proof of execution and apply an explicit working directory only to the call that specified it. For OpenCode, a failed write or edit no longer hides a missing final answer, whether the grader reads the exported trajectory or reconstructs it from the event log.

Fixes #866.

Verification

  • I am familiar with the Contributing Guidelines
  • Added or updated focused tests
  • Updated documentation for user-visible changes
  • Ran make lint
  • Ran make test
  • Ran make build
  • Did not add credentials, private datasets, or proprietary benchmark content

The staged Python 3.9.6 verifier kept recovery at 0.0 after an exit-7 failure and a pending retry, then recorded one correction when the retry exited zero. The source-archive test needed Git history and was checked in the committed checkout. Linux validation kept test state outside the source tree; the earlier macOS key-location failures did not recur there. The full suite and live model qualification were not run locally.

Release Impact

  • No user-visible release note needed
  • Updated CHANGELOG.md

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I reproduced the issue's cases on main and re-ran them here with small ATIF fixtures. A successful skill_view of the manifest now scores activation, routing and tool efficiency 1.0 (0 on main), a terminal run of the script gives script_execution 1.0 instead of the 0.75 observation fallback, and shell writes through terminal (redirect, cat >, tee, a heredoc, Python open(..., 'w')) appear in FILE CHANGES while ls, cat or grep of a path do not. OpenCode write, edit and read with filePath/newString now reach verified facts, file changes and activation, and a write to a different path still reads NOT OBSERVED.

Everything main rejected is still rejected: a failed lookup, error set alongside success, another skill's manifest, a result whose name does not match, a reference file, a missing result, a result without source_call_id, and a plain-text result all stay at 0, and a terminal whose result is only {"error": ...} no longer picks up the 0.75 script credit from its observation text.

On the runner side I diffed the Harbor export on main against this branch for 24 call shapes. The differences beyond the shared-code move are all stricter (reference-file views stay skill_view, whitespace-only content is an error, a mismatched or missing name is no longer a read) and activation outcomes are identical; I left two non-blocking notes inline about the exact-name compare and about result-less terminal calls being invisible to the security check.

The four test files pass here, the new tests fail against main's source, and the Tier 3 suites that import checks and atif_helpers give the same results on both branches (only the four new tests differ). Clean merge with main, DCO on the single commit, CI green.

@deepujain

Copy link
Copy Markdown
Contributor Author

I staged the Harbor verifier from each revision and fed both copies the same synthetic Hermes and OpenCode trajectories. I checked the scores and the evidence prepared for judges, then opened the same section of the grading guide in both local Fern previews. No live agent or judge was called.

Before (base of this PR): The verifier reported “Activation: 0.00” for both successful skill reads. The Hermes script scored 0.75 instead of 1.00, and its shell write did not appear in “FILE CHANGES”. The OpenCode write and edit were both marked “[NOT OBSERVED]”. The write had no path in the file-change evidence, and the edit was missing from it.

After (this PR): Both successful reads reported “Activation: 1.00”, the Hermes script scored 1.00, and its shell write appeared under “Agent called: bash”. The OpenCode write and edit were marked “[OBSERVED step 1]”. Both entries included the path, and the edit showed “mango” as the replacement. The failed Hermes lookup and the reference-file read still scored 0.00 for activation. The grading guide now explains which of these calls count.

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I re-ran my checks on 84bfe30. A categorized skill_view (tools/lookup-code answered with name lookup-code and path tools/lookup-code/SKILL.md) is now a manifest read and scores activation 1.0, while a missing or different path, a path not ending in SKILL.md, a decoy name and ../x, a//b, a\b/c, /x, x/, ./x all stay skill_view. A terminal running rm -rf / is now a destructive_command finding with no result, a plain-text result, an unscoped JSON result or an error result ("issued"), and still "executed" once the result proves it ran; empty, whitespace or non-string commands and ls, cat file, pwd stay clean, and the sensitive-path, upload and profile-write checks see these commands too. The unconfirmed-directory merge does what it says: bash cd /workspace/output, terminal cd /etc, bash rm -rf x is flagged here and was clean before.

Two non-blocking notes inline, one on a test that passes without the change. The security-related Tier 3 suites pass identically on both commits, the five fix-case tests fail on the previous source, CI is green, DCO on both commits, still a clean merge with main.

Comment thread tests/test_hermes_agent.py Resolved
Comment thread docs/tier3-grading.mdx Resolved

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I re-ran my checks on 6ff6314. A Hermes terminal result with an integer exit code now reaches the checks as Exit code: N ahead of the recorded JSON, so exit 7 fails command_succeeded and is recorded as an unrecovered failure where the previous commit left it unchecked and "all commands succeeded"; exit 0 still passes, and a missing, null, string, float or boolean exit code, a non-string output, an unscoped or plain-text result, a list command or no result at all stay terminal and score nothing. The four refusal statuses stay terminal and no longer earn script execution; the categorized, case-only and frontmatter manifest shapes, the file and path metadata and the external-home read_file failure grade as the new tests say, and the OpenCode runner marks failed reads as errors without disturbing truncated or doubled turns. Claude, Codex, OpenCode and Junie fixtures grade identically on both commits; the only non-Hermes change is that a read_file returning a JSON failure is now an error, which is the right direction. The empty newString shows up in file-change evidence and the entry count is unchanged for edits that carry a path.

One non-blocking note inline on two further Hermes envelopes that still read as an executed command. The new smoke block fails against the previous commit's staged verifier and passes here under Python 3.9; the named suites and the 44 Tier 3 suites importing the touched modules pass identically on both commits, the 23 fix tests fail on the previous source, CI is green, DCO on all three commits, clean merge with current main.

@deepujain
deepujain force-pushed the fix/866-verifier-tool-names branch from 6ff6314 to 6faa52f Compare November 23, 2026 23:07
The verifier missed skill reads and shell writes when a runner kept the original Hermes tool names. Share the conversion with the Harbor runner and use the recorded result to distinguish a successful read from a failed or unrelated call. Read OpenCode file paths and replacement text from its native arguments so those changes reach the judges.

Signed-off-by: Deepak Jain <deepujain@gmail.com>
Hermes can return lookup-code when asked for category/lookup-code. Credit that manifest read only when its recorded path and resolved name agree with the request.

Scan the command in a terminal request for security findings even when the result is missing or plain text. This records the attempt without counting it as a successful shell call.

Signed-off-by: Deepak Jain <deepujain@gmail.com>
Use the manifest path Hermes actually returned, including its category and directory spelling. Do not count linked files, failed reads, or a terminal request rejected before execution. Pass the recorded shell exit code to command-success and error-recovery checks.

Keep failed OpenCode reads attached to their own calls and show empty replacements as deletions in file-change evidence. Cover both possible working directories after an unconfirmed terminal request.

Signed-off-by: Deepak Jain <deepujain@gmail.com>
A degraded backend or an exhausted retry could earn full credit for a script that never started. Keep refused and unanswered requests visible to security checks without reporting them as executions or completed file operations.

A background launch confirms that the script started, not that it exited successfully. Grade a foreground process by its recorded exit code.

Signed-off-by: Deepak Jain <deepujain@gmail.com>
A quiet grep that found no match counted as a recovery failure. Keep the JSON output first and put the integer exit status on its own line so the grader can distinguish a quiet exit from a diagnostic.

Use the read result when Hermes expands a home path, and match an explicit relative lookup to the manifest it returned. A foreground command that yields a session counts as started without claiming a successful exit.

Signed-off-by: Deepak Jain <deepujain@gmail.com>
@deepujain
deepujain force-pushed the fix/866-verifier-tool-names branch from 6faa52f to c24db4b Compare November 24, 2026 05:54

@rng1995 rng1995 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for improving Tier 3 grading for native Hermes and OpenCode trajectories. The focused run passed 2,562 tests, and the staged verifier smoke passed. I left two new inline findings. Failed OpenCode edits can count as verified behavior, and a per-call Hermes working directory can affect security grading of later commands. The existing thread about unfinished Hermes retries remains open.

…vidence

A Hermes background receipt confirms that a command started, not that it recovered from a failure. Wait for a completed retry and keep a per-call working directory from changing how later commands are checked.

Preserve OpenCode write and edit errors in both trajectory converters so a failed mutation cannot stand in for missing evidence.

Signed-off-by: Deepak Jain <deepujain@gmail.com>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for addressing the earlier grading findings. I verified the failed-edit exclusion, transient Hermes working directories, and unfinished retries. The staged verifier smoke and 2,574 focused tests passed. I left one new inline finding from a read and failed edit of the same path.

@chrisknvidia

Copy link
Copy Markdown
Collaborator

GitHub now reports this branch as conflicting with main (a few Tier 3 verifier changes landed since the base). Once the open thread on atif_helpers.py is addressed, could you rebase or merge main so CI runs on a mergeable head? Happy to re-review right after.

Resolve the CHANGELOG conflict: main released 1.2.1, so the entry moves to Unreleased > Fixed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I ran a second pass over 04a0cbb. Reverting the production hunks one at a time, 39 of 50 make at least one of the PR's tests fail; the exceptions that change grading are the process_state == "running" guard in check_error_recovery, which only the CI verifier smoke (check_hermes_retry) catches, and the isascii and whitespace-only-content guards in the Hermes normalizer; notes inline, the rest are defensive branches with no effect on the fixtures. I diffed the Harbor Hermes export on main against this branch for 43 call shapes and the verifier path for 72 shapes across Claude Code, Codex, OpenCode, Gemini, Junie and Hermes tool names: the Hermes and OpenCode cases move as described, everything else is unchanged, and the only moves toward leniency are a first attempt that never started (blocked, degraded or exit -1 with an error) no longer counting as a failure to recover from, and an exit 0 result that also carries an error text passing command_succeeded while is_error stays True. Crafted results could not hide a destructive command: a result with another call's id, duplicated ids, an empty or non-object JSON body, a plain-text body, a missing result, a yielded or background receipt, a workdir of / or /workspace/output/../.., and 33 unconfirmed cd attempts all still produce the destructive_command finding. The staged verifier passes the smoke script under a real Python 3.9 task interpreter and fails it when I break either new assertion. The branch now conflicts with main in CHANGELOG.md only (both add bullets under Unreleased), so it needs a rebase before merge.

Comment thread tests/test_hermes_agent.py Resolved
@rng1995

rng1995 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks @deepujain for this contribution.

I merged the latest main into this branch to clear a CHANGELOG.md conflict (e3d4319e), and the branch has since been brought up to date with main again (9754f10b). main cut 1.2.1 in the meantime, so the entry for this change now sits under Unreleased > Fixed instead of the released section. My conflict resolution touched only CHANGELOG.md; the changes in this PR are otherwise unchanged.

Please pull before you push the fix for the open thread on atif_helpers.py, so your next commit builds on 9754f10b.

A read of the target file could hide a failed edit when the final answer was clipped. Tie file changes and quoted text to the successful call on that path, and keep explicit outcomes when converting runner logs.

A pending command or an error from the runner is not a successful retry. Keep those receipts distinct from a completed command and a quiet negative probe.

Signed-off-by: Deepak Jain <deepujain@gmail.com>
@deepujain

Copy link
Copy Markdown
Contributor Author

@rng1995, thanks for clearing the changelog conflict. I built 70509e7 directly on 9754f10 and left the Unreleased entry intact. A successful OpenCode read no longer counts as an edit when the edit of that same file fails. @chrisknvidia, a yielded Hermes command or an exit of zero with a runner error cannot clear an earlier failure, and neither a whitespace-only manifest nor a Kelvin-sign lookalike path earns read credit. The branch is mergeable now, and I’d welcome your second look.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Tier 3 verifier under-scores Hermes and OpenCode trajectories that keep the harness's own tool and argument names

3 participants