Skip to content

[BUG]: Collector rejects valid answers when per-step ATIF tokens lack aggregate metrics #198

Closed

Description

@YMuskrat

What happened?

On main f32c884 (0.5.0), _trajectory_agent_runtime_failure_reason treats a trajectory as tokenless whenever optional final aggregate token totals are absent or zero. It ignores positive per-step token metrics. An ordinary generated answer such as 401 is then reported as an agent runtime failure and a valid reward can be discarded.

Proposed fix

Use recorded step token usage as well as final totals to decide whether the trajectory is tokenless. Preserve explicit runtime exceptions and structured provider error events. The prepared tests cover missing/empty/zero aggregates, prompt-only and completion-only usage, tokenless failures and explicit failures after token usage.

Reproduction steps

With the Tier 3 dependencies installed, this runs offline:

from harbor.models.trajectories.trajectory import Trajectory
from skillevaluator.tier3.harbor.collector import _trajectory_agent_runtime_failure_reason

trajectory = Trajectory.model_validate({
    "schema_version": "ATIF-v1.7",
    "agent": {"name": "test-agent", "version": "test"},
    "steps": [{
        "step_id": 1, "source": "agent", "message": "401",
        "metrics": {"prompt_tokens": 50, "completion_tokens": 12},
    }],
}).to_json_dict()
print(repr(_trajectory_agent_runtime_failure_reason(trajectory)))
# Actual: '401'; expected: ''

A collector-level regression also reproduces a completed trial with a valid reward becoming failed/unscored. Unlike #82, this needs neither a verifier exception nor a plain-log scan; the trajectory heuristic is the remaining path.

SkillEvaluator version or commit

f32c884 (0.5.0)

Environment

Linux, Python 3.12, Harbor 0.24.0, repository locked dependencies. Offline reproduction; no model calls or credentials required.

Before submitting

Activity

  1. added
    bug
    on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions