OUTPUT #1093 | 1328 karakter | 24 satır
    result.trace["stage2"] = _trace(second)

    if second["winner"] is None:
        result.reason = f"stage 2 picked {second['picked'] or 'nothing'}: no skill fits"
        return result

    # The Choice and the fits nouls are two judgments of the same question, and both were
    # paid for — use both. The winner is suggested when it is (or ties) the fits argmax.
    # When fits prefers another candidate, that candidate takes over only by clearing the
    # bar itself *and* leading the winner's own fits by fits_margin *and* facing a winner
    # that also clears the bar — an override resolves a disagreement between two signals
    # that each found a fitting skill, so a sub-threshold winner leaves nothing to resolve:
    # the leader is then the largest number in a set of weak scores, not a rival verdict.
    winner = second["winner"]
    winner_fits = second["fits"].get(winner, 0.0)
    ranked_fits = sorted(second["fits"].items(), key=lambda kv: (-kv[1], kv[0]))
    best_name, best_fits = ranked_fits[0] if ranked_fits else (winner, 0.0)

    if winner_fits >= best_fits:
        if winner_fits < fits_threshold:
            result.reason = (
                f"winner {winner} fits {winner_fits:.2f} < {fits_threshold:.2f}: nothing fits"
            )
root@213-238-170-219:/home/hermes#