Skip to content

fix(tier3): score unrecovered failures and align recovery verdicts - #217

Merged
rng1995 merged 17 commits into
NVIDIA:mainfrom
mavericksea-ai:fix/error-recovery-149
Oct 22, 2026
Merged

rng1995 merged 17 commits into
NVIDIA:mainfrom
mavericksea-ai:fix/error-recovery-149

Conversation

@mavericksea-ai

@mavericksea-ai mavericksea-ai commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Unrecovered command failures could receive a clean score (#149). Both the host checker and the bundled verifier now count every detected failure: an unrecovered failure scores zero, sets passed=False, counts in the fault totals, and appears in report failure reasons. A failure followed by a successful retry keeps the existing correction scoring.

Detection changes, identical in both implementations:

  • Explicit exit status takes precedence over output text and is read only from complete status lines (Exit code N, exit_code=N, [exit_code] N, Process exited with code N, LF or CRLF). Inline mentions of exit codes in displayed source or prose are not treated as execution status.
  • Without a status line, error: and exception: diagnostics must start a line, optionally after tool prefixes such as gcc: or pytest:. Displayed handlers such as except Exception: and strings such as print("Error: ...") stay clean. Tracebacks and actual exception diagnostics remain failures; numeric timeout configuration stays clean.
  • Within the next five execution calls, a retry is matched with the existing similarity rule. Beyond five calls, only a successful repeat of the same command and arguments, compared as whitespace-split tokens, counts as recovery. This prevents an unrelated later success such as test -f report.json, ls, cat pytest.ini, or python3 -c "print(1)" from recovering a distant failed command.
  • Exit 1 with no other output from simple grep, rg, test, [, diff, and cmp commands is treated as a normal negative answer. This covers converter status=/exit_code= output, Codex unified-exec output with or without its optional header lines, and Harbor's exact Claude Code [error] tool reported failure marker line. The exemption does not apply to other output, exit codes above 1, compound commands, pipes, or substitutions. A quiet exit 1 never counts as a successful retry.

Preserves Priyadarshni's initial contribution by cherry-picking 50cadf4 with original authorship and sign-off, then adds the requested corrections and regression coverage.

Fixes #149
Supersedes #151

Verification

  • I am familiar with the Contributing Guidelines
  • Added or updated focused tests: 370 parametrized error-recovery tests total, covering both implementations with host/verifier result-parity assertions. The new Claude Code marker regressions use Harbor's own ClaudeCode._format_tool_result.
  • Updated documentation for user-visible changes
  • Ran make lint at 22d82c7: passed
  • Tier 3 at 22d82c7: all 4,789 tests passed
  • Ran the full suite on macOS at 22d82c7, with the workspace Docker CLI and four pytest workers: 14,183 passed, 28 skipped, 1 failed. The failure was tests/test_harbor_local_mode.py::test_streamed_exec_escalates_after_launcher_exits_with_term_ignoring_descendant[cancel], a pre-existing macOS cleanup timing issue tracked separately in [BUG]: macOS cancellation cleanup test races with process exit #221. Repeated runs produced 2 failures in 100 runs on each of 5349e9b and 22d82c7; the affected test and cleanup implementation are unchanged by this PR. An earlier full-suite run at 5349e9b passed: 14,100 passed, 28 skipped.
  • Ran make build during earlier PR validation: wheel and source distribution built. This check was not rerun for 22d82c7.
  • Did not add credentials, private datasets, or proprietary benchmark content

Release Impact

  • Updated CHANGELOG.md

@mavericksea-ai

Copy link
Copy Markdown
Contributor Author

@rng1995 The replacement PR is ready, following your handover guidance in #151 (comment).

This preserves Priyadarshni's initial contribution and addresses both open findings across the host checker and bundled verifier, with parametrized regression tests and report failure-reason coverage. Independent review is complete; local validation passed (13,747 tests across two runs, plus lint and build).

This supersedes #151 and fixes #149. Please take a look when you have a chance; #151 can now be closed as you suggested. Thanks!

@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.

Automated review: 4 findings (0 P1, 4 P2, 0 P3); 4 posted inline.

Both open findings from #151 are fixed in the host checker and in the bundled verifier. Unrecovered failures now set passed=False, count in the fault totals and appear in the report failure reasons, and Process exited with code 0 ... 0 errors stays clean. The two implementations gave identical results on every trajectory I fed them. dd4e517 keeps the original authorship and sign-off from 50cadf4.

The four findings below are all false positives that turn a clean or recovered run into 0.0 with passed=False, so I am holding the approval for now.

Merge note: the branch conflicts with main in CHANGELOG.md only. Main has released 0.6.0, so when you merge main, put this entry under a new ### Fixed heading in ## Unreleased, not in the 0.6.0 section.

rng1995 and others added 5 commits October 21, 2026 07:04
Conflicted file:
- CHANGELOG.md: main released 0.6.0. Kept main's 0.6.0 section unchanged
  and moved this branch's error-recovery entry under a new ### Fixed
  heading in ## Unreleased.

No code conflicts; tier3/harbor/templates/eval.py merged automatically.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Match execution status and generic error diagnostics as complete lines or
line-prefixed diagnostics, so displayed source code stays clean. Recognize
successful retries across the remaining trajectory, and exempt quiet exit-1
results from simple search and test commands without treating them as recovery.

Add parameterized regressions for both implementations and preserve actual
errors, compound commands, and report failure reasons.

Validation: 156 recovery tests and repository lint pass; wheel/sdist build
passes. Independent review: 576 relevant tests plus 25 additional probes pass.
Full suite: 13969 passed, 28 skipped, one unchanged subprocess-cleanup test
failed; its full module passed independently (268 passed, 1 skipped).

Signed-off-by: Maverick <[email protected]>
Retain the existing loose correction heuristic within five execution calls,
but require an exact command repeat beyond that window so unrelated later
successes cannot recover an earlier failure. Preserve long-distance recovery
for an identical command after inspections and an edit.

Recognize the real Codex unified-exec header for quiet exit-1 probes. Treat
all text after Output: as command output, including header-like diagnostics,
and replace Final output fixtures with the real envelope. Check host/verifier
result parity for every recovery test.

Validation: expanded tests on unchanged 62db4c1 production code reproduced
32 failures (176 passed). With this fix, 208 recovery tests and 4627 Tier 3
tests pass; make lint passes.

Signed-off-by: Maverick <[email protected]>
Compare nonempty whitespace-split command tokens for distant retries,
retaining strict argument and shell-structure matching. Accept optional Chunk
ID and Original token count lines in the Codex unified-exec envelope without
stripping any command output after Output:.

Parameterized tests preserve host/verifier result parity, cover unchanged
argument strictness, empty commands, optional header combinations, LF/CRLF,
and diagnostic output. The existing changelog description remains accurate.

Validation on unchanged b8c5de0: 16 failed, 270 passed. After the fix:
286 recovery tests and 4705 Tier 3 tests passed; make lint passed.

Signed-off-by: Maverick <[email protected]>
@mavericksea-ai

Copy link
Copy Markdown
Contributor Author

@rng1995 All four review findings are addressed in both the host checker and bundled verifier, and the branch is pushed through 5349e9b:

  • Execution status is matched on whole lines, so exit-code mentions in displayed source do not determine the verdict.
  • Generic error/exception diagnostics are anchored to line starts, preserving successful output containing handlers or error strings.
  • Recovery beyond five execution calls requires the same command and arguments, ignoring whitespace differences, so unrelated later successes cannot recover a failure.
  • Quiet exit-1 search/test probes stay clean, including Codex unified-exec observations with optional header fields. Diagnostic output remains a failure, and a quiet negative probe cannot count as a successful retry.

The changelog conflict is resolved under Unreleased. Independent review found no blockers. On the pushed commit, the full macOS suite passed: 14,100 passed, 28 skipped, with no flaky reruns needed. Lint and all 4,705 Tier 3 tests also passed, including host/verifier result-parity checks.

Ready for another look. Thanks!

@mavericksea-ai

Copy link
Copy Markdown
Contributor Author

@rng1995 Pushed 22d82c7 to handle Harbor’s Claude Code failure marker correctly for quiet negative probes. Regression tests use the real Harbor formatter and verify both implementations.

Lint, all 370 error-recovery tests, and all 4,789 Tier 3 tests pass. The full suite had one pre-existing macOS cleanup timing failure, independently reproduced on the parent commit and investigated separately.

@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.

Automated review: 3 findings (0 P1, 2 P2, 1 P3); 3 posted inline.

Follow-up at 22d82c7. Thanks for the quick turnaround.

  • Fixed: index 0 (exit-status text in displayed output) and index 2 (recoveries later than five calls). Those threads are resolved.
  • Partly fixed: index 1 and index 3. The replies on those threads list the inputs that still score 0.0.
  • Agreement: the host checker and the bundled verifier still agree on every case I ran.

Three new findings are inline. Two are P2:

  • OpenCode results carry no exit status, so its test and build failures are missed.
  • Successful Claude Code results are still judged by their output text, while Codex results with exit 0 are not.

Maintainer edits are on, so to get this merged I'll push fixes for the open items to the branch, and reply on each thread when they land.

rng1995 and others added 7 commits October 22, 2026 08:16
Harbor marks Claude Code tool results with tool_result_is_error and adds
an exit status line only to failures, so successful results were judged
by their output text while Codex results with exit 0 were not. Both tool
call extractors now pass an explicit false flag through as is_error, and
both error-recovery checkers treat it like exit status 0. Results without
an exit status are still judged by their text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Harbor's OpenCode trajectory keeps only the bash tool's output; the exit
code stays in metadata.exit and never reaches the observation. Those
results are judged by their text alone, and the diagnostic patterns
missed failing pytest, unittest, jest, go test, tsc and npm runs and
OpenCode's own timeout note, so an unrecovered failure scored 1.0. Both
checkers now also match those failure summaries for results without an
exit status. "0 failed" and assignments such as FAILED = ... stay clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Results without an exit status are judged by their text, and displayed
source still matched the diagnostic patterns: annotated fields and
parameters such as `timeout: int = 30`, `error: str | None = None` or a
TypeScript `error: string | null;`, and option descriptions such as
`--timeout: Request timeout in seconds.`. Both checkers now skip an
`error:`, `Error:` or `timeout:` match that is followed by a type
annotation, and a `timeout:` that is part of an option name. Real
diagnostics such as `error: unrecognized arguments` still fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
An exit-1 probe was clean only as a bare grep, rg, test, [, diff or cmp
command with no output. Common variants still scored 0.0: `grep -c`
printing a zero count, `2>/dev/null` and other /dev/null redirects, a
leading `cd dir &&`, `pwd &&` or `VAR=value`, a probe at the end of a
pipeline, a trailing `&& echo ...`, `[[ ... ]]`, `command -v`, `which`
and `git diff --quiet`. Both checkers now accept those forms when the
probe exits 1 with no other output. Other compound commands, output such
as diagnostics or a diff, and other exit codes still count as failures.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Inside the five-call window two commands counted as the same when either
first word appeared anywhere in the other command as a substring, and a
shared `cd <dir> &&` prefix made any two commands match. So `ls /tmp`
recovered a failed `python skills/...` command and `cd /app && git
status` recovered `cd /app && pytest -q`, which now hides an unrecovered
failure. Both checkers now skip leading `cd <dir> &&` or `cd <dir>;`
prefixes and compare whole words, treating a program as the same across
paths and version suffixes (python3 still retries python).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
The entry said printed source text is not treated as execution status,
which overstated the change for results without a status. Describe what
the checkers now do: use a Codex exit code, Harbor's Claude Code error
flag or a whole exit status line when present, judge only status-less
results by their text, and accept the listed quiet probe forms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Conflicts:
- CHANGELOG.md: kept the error recovery entry and main's catalog validation
  entry under Unreleased / Fixed, with main's other Unreleased sections and
  released sections unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>

@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.

Approving at 7a05761.

  • The open items from the last two rounds are fixed in 75cf9d9, 11b9137, 9264a20, 69df00b and 11a6e72, on top of the author's design. Each has tests over both the host checker and the bundled verifier that fail without the fix. The thread replies give the details.
  • Host and verifier still agree on every synthetic case and on 502 local trajectory files. On those trials, no Claude Code run scores 0.0 only because of text in a successful result any more (18 before).
  • Merged main. The only conflict was CHANGELOG.md, and both entries are kept. Tier 3 tests, the reporting and Harbor metric tests, and ruff pass locally. DCO passes, and the other CI runs are approved and running.
  • Not blocking: in results without a status, a timed out string literal or a Google-style Raises: line still counts as a failure, and so does a ; chain that prints other output before an exit-1 probe.

@rng1995
rng1995 merged commit c9d170e into NVIDIA:main Oct 22, 2026
28 checks passed
@rng1995 rng1995 mentioned this pull request Oct 30, 2026
15 of 20 tasks
chrisknvidia pushed a commit that referenced this pull request Oct 30, 2026
)

* fix(tier3): score unrecovered command failures instead of first-attempt clean

Signed-off-by: Narendran Raghavan <[email protected]>
Signed-off-by: Maverick <[email protected]>
chrisknvidia pushed a commit that referenced this pull request Oct 30, 2026
)

* fix(tier3): align recovery verdicts and execution failure detection
* fix(tier3): retain structured timeout and shell failure diagnostics
* fix(tier3): fail unrecovered verdicts and ignore displayed source diagnostics
* fix(tier3): avoid false failures in recovery scoring
* fix(tier3): bound loose retry matching and parse Codex probe output
* fix(tier3): normalize retry whitespace and optional Codex headers
* fix(tier3): ignore Harbor failure marker for quiet probes

Signed-off-by: Maverick <[email protected]>
chrisknvidia pushed a commit that referenced this pull request Oct 30, 2026
)

* fix(tier3): use Claude Code result flags in error recovery
* fix(tier3): detect OpenCode test and build failures
* fix(tier3): ignore displayed annotations in status-less results
* fix(tier3): accept common forms of quiet negative probes
* fix(tier3): match recovery commands by whole words
* docs: describe error recovery status and text rules in CHANGELOG

Signed-off-by: Narendran Raghavan <[email protected]>
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]: Unrecovered command failures are scored as first-attempt clean

3 participants