Repository navigation
feat: add stable evaluator error codes - #115
mohgupta-ship-it wants to merge 15 commits into
Conversation
Signed-off-by: Mohit Gupta <[email protected]>
Signed-off-by: Mohit Gupta <[email protected]>
Signed-off-by: Mohit Gupta <[email protected]>
chrisknvidia
left a comment
There was a problem hiding this comment.
Reviewed exact head 1a98dfce and a clean synthetic merge with current main (14a888e). The focused merged suite passes, but real CLI, Botocore credential-process, Bedrock classification, and result-resolution reproductions confirm four P1 blockers and three P2 contract defects below. No paid provider credentials were required for these reproductions.
| """Build the common serializable shape for an evaluator execution failure.""" | ||
| return { | ||
| "execution_status": "failed", | ||
| "error_code": validate_error_code(error_code), |
There was a problem hiding this comment.
[P1] Propagate terminal codes through every documented public output
This adds error_code to the engine return dictionary, but the public command boundary, terminal renderer, combined Tier 3 adapter, and canonical JSON/HTML payloads do not carry it. On exact head, an in-engine configuration failure exited 1 in standalone mode with no code and no result.json; advisory and blocking validate --tier3 JSON also contained no error_code. Please thread the typed code through those consumers and provide a machine-readable artifact/output for failures before run reservation.
| "agents": {}, | ||
| "run_config": run_config, | ||
| } | ||
| failed_result = _terminal_failure_result(errors, error_code=error_code) |
There was a problem hiding this comment.
[P1] Make persisted pre-execution failures valid current results
This failure payload still writes agents: {} and omits attempt_policy and report_status, while _current_result_identity_is_valid requires configured/result agent equality and both fields. The early return also bypasses publish_latest_results. In a direct runner reproduction, the failed run's completion key was None; symlinkless lookup and even a forced latest link to the failure resolved to an older successful run. Please define a valid failure schema, publish it as latest, and add a regression with an existing older success.
| and _bedrock_credential_process(session) is not None | ||
| ): | ||
| failure_kind = ModelCatalogFailureKind.UNAVAILABLE | ||
| failure_kind = ModelCatalogFailureKind.LOCAL_PROCESS |
There was a problem hiding this comment.
[P1] Supervise and classify the real AWS credential helper
Only an injected transient _popen OSError reaches this LOCAL_PROCESS branch. Real Botocore paths produced: missing helper -> CONFIG-001 (expected RUNTIME-005), nonzero helper -> DEPENDENCY-001 (expected RUNTIME-008), and hanging helper -> DEPENDENCY-005 (expected RUNTIME-007) while the helper and bedrock-model-catalog-probe worker remained alive. Please execute/supervise the helper in a killable process group, terminate and reap it on deadline, and preserve spawn/timeout/exit signals explicitly.
There was a problem hiding this comment.
i need to check on this one. thanks for bringing this point.
| if self.error_code is not None or timed_out: | ||
| raise ValueError("successful model probe cannot carry failure metadata") | ||
| return | ||
| expected = provider_failure_error_code( |
There was a problem hiding this comment.
[P1] Preserve Bedrock subtypes before deriving the stable code
The Bedrock ClientError path collapses AWS error subtypes before this mapping and never marks structured service timeouts as timed_out. Direct Botocore cases yielded ThrottlingException HTTP 400 -> DEPENDENCY-001, RequestTimeout -> UNKNOWN-001/DEPENDENCY-001, and an arbitrary HTTP 418 -> UNKNOWN-001; these should be DEPENDENCY-006, DEPENDENCY-005, and DEPENDENCY-009. Preserve the AWS timeout/rate-limit/other-HTTP subtype until the final code is derived.
| timed_out: InitVar[bool] = False | ||
|
|
||
| def __post_init__(self, timed_out: bool) -> None: | ||
| if self.ok: |
There was a problem hiding this comment.
[P2] Reject all failure metadata on successful probes
The success branch rejects only error_code and timed_out; ModelProbeResult(ok=True, failure_kind="authentication", http_status=401) is accepted and can subsequently be treated as verified. Please also require failure_kind is None and http_status is None when ok is true, with a regression covering contradictory success metadata.
There was a problem hiding this comment.
ack thanks. Good catch
|
|
||
| def primary_error_code(codes: Iterable[object]) -> str: | ||
| """Return a consensus code, or UNKNOWN when failures conflict or are absent.""" | ||
| registered = {str(code) for code in codes if is_registered_error_code(code)} |
There was a problem hiding this comment.
[P2] Treat absent or invalid classifications as failed consensus
Filtering invalid entries means both [AUTH-002, None] and [AUTH-002, "invalid"] return AUTH-002. That contradicts the documented contract that conflicting or absent classifications produce UNKNOWN-001. Materialize the supplied votes and return unknown if any supplied classification is absent or unregistered; otherwise require all codes to agree.
| ): | ||
| return False | ||
| attempt_policy = result.get("attempt_policy") | ||
| error_code = result.get("error_code") |
There was a problem hiding this comment.
[P2] Distinguish an omitted code from explicit JSON null
Using .get() makes a missing backward-compatible field indistinguishable from "error_code": null. A succeeded current result containing explicit null was accepted as authentic even though the public schema requires a string whenever the field is present. Check key presence separately, then require a registered string and failed execution status when present.
rng1995
left a comment
There was a problem hiding this comment.
Reviewed the current draft head. The seven existing review threads remain reproducible and blocking: four affect public failure-code propagation, persisted failure validity, AWS helper supervision, and Bedrock classification; three affect contradictory probe metadata, consensus handling, and explicit null codes. I did not add duplicate inline comments. Focused suites passed 635 tests, with the remaining failures limited to sandbox-denied localhost binds; Ruff and diff checks are clean. Please address the open threads before re-review.
|
@mohgupta-ship-it : I see this PR is still in draft, just to make sure if this PR ready for further reviews ? |
| model, | ||
| _redact_detail(detail, run_env), | ||
| job_name, | ||
| None if ok else EvaluatorErrorCode.JOB_RESULT_INVALID, |
There was a problem hiding this comment.
[P2] Distinguish recorded agent failures from invalid job output
validate_harbor_agent_only_job_result() returns False both for missing or malformed output and for a valid Harbor job recording n_errored_trials > 0. With a recorded NonZeroAgentExitCodeError, this line emits CONTRACT-007, the same code as a missing result.json; a process-backed replay at this head confirms both outcomes. Please return a structured validation reason and classify recorded agent exits or timeouts with an appropriate runtime code, reserving CONTRACT-007 for absent or invalid job artifacts.
Conflicted files:
- CHANGELOG.md: kept main's Unreleased Added/Changed/Fixed entries and
added this branch's error-code entry under the single Added heading.
- docs/README.md: took main's expanded page list and inserted
error-codes.mdx after reports.mdx, matching its fern/docs.yml position.
- src/skillevaluator/tier3/harbor/runner.py (five hunks):
- configuration checks: kept main's _validated_timeout_multiplier,
_validated_pass_threshold and pre_agent_setup checks, returned through
_terminal_failure_result with INVALID_CONFIGURATION like the branch's
other configuration failures;
- runtime-plan failure: branch's coded result with main's
agent_import_paths rename;
- _persist_pre_execution_failure: kept main's redacted, bounded
execution_errors sample, detail counts and compact `error` alias, and
added the branch's validated error_code;
- launch errors: kept main's _merge_launch_execution_errors, then the
branch's UNKNOWN error_code default for any failed result.
- tests/test_harbor_runtime_preflight.py: kept the branch's persisted
error_code assertion and main's result-size and compact `error` checks.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
The branch made error_code a required keyword of
_persist_pre_execution_failure and moved every early failure in
_run_harbor_eval_impl to _terminal_failure_result. Main added paths that
merged cleanly but still used the old forms:
- _persist_pre_execution_failure([str(exc)]) for a dataset snapshot over
the publication limit and for an invalid staged task timeout. Both raised
TypeError instead of returning a failed result. They now pass UNKNOWN
(like the branch's other post-reservation staging failures) and
INVALID_CONFIGURATION (a configuration-stage failure) respectively.
- An invalid --environment-kwarg still returned {"error": [...]}; it now
returns the coded INVALID_CONFIGURATION result.
Main's runner-environment tests that compared the old {"error": [...]}
shape now expect the coded shape, as the branch did for its own tests, and
a new test covers both post-staging paths end to end.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Conflicted files: - CHANGELOG.md: kept main's new Unreleased entries (including the --env-mode kata entry) and this branch's error-code entry under the single Added heading. Main's new runner failure paths all end in coded results without further changes: the publication-source-changed snapshot check raises inside the snapshot handler (UNKNOWN), the Kata sidecar rejection raises inside task staging (_persist_pre_execution_failure, UNKNOWN), and Kata kwarg/runtime errors come back from _check_prerequisites (UNKNOWN). The runtime-context publication binding records a publication_target_conflict on a completed run rather than failing it, so it carries no error_code. Main's _run_owned_publication_fields() sits beside error_code in the persisted pre-execution failure. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Main added two terminal failure paths to _run_harbor_eval_impl: the Kata staged-task environment rejection (#182) and the publication source changing while the evaluator snapshot is created (#77). Both already return coded results through the branch's existing handlers; these tests pin that they report SKILLEVALUATOR-UNKNOWN-001 and, for the post- reservation case, persist it in result.json. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Main's #77 test for a publication source that changes while the private evaluator snapshot is created still compared the legacy {"error": [...]} shape. That path returns through the branch's snapshot handler, so it now yields the coded UNKNOWN failure; update the expectation and drop the duplicate stub-based test added in the previous commit, since main's test exercises the real snapshot path. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Resolve the tier3/results_location.py conflict with #124 by keeping both sets of result checks: this branch's registered error-code checks and main's score-policy checks. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Conflicted files: - CHANGELOG.md: kept main's new --env-mode runta/mosaic entry and this branch's error-code entry under the single Added heading. - src/skillevaluator/tier3/harbor/runner.py: credential-probe loop keeps the branch's probe error-code derivation and passes main's (#140) env_mode to credential_probe_disposition. - src/skillevaluator/tier3/harbor/runtime_preflight.py: the catalog 404 ModelProbeResult keeps main's HTTPStatus.NOT_FOUND and the branch's MODEL_NOT_FOUND error code. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Main's Vertex AI and Vertex OpenAPI model probes (#140) report four timeouts (HTTP read, busy worker slot, expired deadline before start, deadline while waiting) as failure_kind=unavailable without a timeout signal, so they mapped to SKILLEVALUATOR-DEPENDENCY-001. The branch maps every equivalent Bedrock and catalog deadline to DEPENDENCY-005 via timed_out=True; pass the same signal and code for the Vertex timeouts. Tests pin the Vertex timeout and HTTP status codes (401, 403, 404, 429, 500) and, end to end, that main's new GKE Workload Identity and Mosaic config prerequisite failures return the branch's prerequisite code (UNKNOWN) while Vertex credential/configuration rejections from the runtime plan return CONFIG-001. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Brings in #179 (performance dashboard). No conflicts; uv.lock and pyproject.toml match main (this branch changes no dependencies). The dashboard reads per-agent execution_status only and applies no strict key schema to result.json, so the branch's error_code field needs no dashboard change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Merge main 3728e2f (#215 custom execution backends, #212 judge-aware lift, v0.6.0 release). Conflicts: - src/skillevaluator/tier3/harbor/runner.py: the unsupported env_mode failure keeps the PR's coded INVALID_CONFIGURATION result with main's _supported_env_modes() list (built-in plus installed custom backends). The runtime-plan failure keeps the PR's coded result, followed by main's new try/except around the agent_import_paths selection. - CHANGELOG.md (auto-merged): git placed the PR's error-code entry in the released 0.6.0 section; moved it to Unreleased under ### Added. Main's 0.6.0 section is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Merge main 2085a03 (#211 quality minimum-score gate failures). Conflicts: - CHANGELOG.md: both sides added the first entry under ## Unreleased. Kept the PR's error-code entry under ### Added, then main's minimum-score gate entry under ### Fixed. #211's gate failures are static-validation results, not Tier 3 evaluator execution failures, so they take no error code. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Main's #215 added a terminal failure to _run_harbor_eval_impl when an installed custom execution backend's agent wrapper cannot be selected (its wrapper does not subclass the provider's required wrapper, cannot be imported for that check, or the backend fails to load). It still returned the legacy {"error": [...]} shape, so it was the only terminal failure in the run entry point without execution_status or error_code. It now returns the PR's coded result with SKILLEVALUATOR-CONFIG-001, the same code as the runtime-plan rejection raised just before it in the credential-validation stage. The new test fails on the merge commit with the legacy shape. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
972dc0b to
5104437
Compare
rng1995
left a comment
There was a problem hiding this comment.
Reviewed draft head 51044377fb34 across the registry, catalog mapping, runtime preflight, runner failure paths, and result validation. Existing contract findings remain reproducible: primary_error_code(['SKILLEVALUATOR-AUTH-002', None]) returns AUTH-002, and an ok=True model probe accepts authentication/HTTP-401 failure metadata. These are already covered by open review threads, so no duplicate inline comments were added. The focused local suite recorded 458 passes and 3 failures; two failures also reproduce with the base source in the same environment. This is not a clean-suite or runtime-qualification claim.
|
Thanks, Mohit, for the work on the stable error-code registry, structured classification, documentation, and tests. Closing this draft without merging because the latest review of the current head still identifies unresolved contract issues: consensus can report a specific code when another failure is unclassified, and successful model probes can carry contradictory authentication/HTTP failure metadata. These gaps make the proposed public error-code contract unreliable. The existing review threads preserve the details for any future follow-up. |
Prepared by Codex.
Summary
Validation