Bug: overall score is capped using the LLM-returned max instead of role.json weights (e.g. 105/165 instead of 60/100)

Author: rajarshidattapyCreated Sep 12, 2026Updated Sep 12, 2026

Description

print_evaluation_results computes the overall score and its cap from the max value returned by the LLM, not from the category weights defined in role.json:

https://github.com/interviewstreet/hiring-agent/blob/70fd3ea/score.py#L66-L70

python
for category_name, category_data in evaluation.scores.model_dump().items():
    category_score = min(category_data["score"], category_data["max"])   # LLM-supplied max
    total_score += category_score
    max_score += category_data["max"]                                    # LLM-supplied max

CategoryScore.max is only validated as gt=0 (models.py), so the LLM can return any value. The per-category display a few lines later does cap with the role's max (min(cat_score.score, category.max), L104), so the detailed lines and the overall score disagree.

The CSV export has the same issue and doesn't cap at all: transform.py L685-L688 sums raw cat.score / cat.max.

Steps to reproduce

python
role = load_role("software_engineering_intern")
M = build_evaluation_model(role)
ev = M(scores={
  "open_source":      {"score": 80, "max": 100, "evidence": "x"},
  "self_projects":    {"score": 10, "max": 30,  "evidence": "x"},
  "production":       {"score": 10, "max": 25,  "evidence": "x"},
  "technical_skills": {"score": 5,  "max": 10,  "evidence": "x"}},
  bonus_points={"total": 0, "breakdown": "-"}, deductions={"total": 0, "reasons": "-"},
  key_strengths=["a"], areas_for_improvement=["b"])
print_evaluation_results(ev, role, "T")

Actual

 OVERALL SCORE: 105.0/165
 Open Source: 35/100

CSV total_score = 105.0, open_source_max = 100.

Expected

 OVERALL SCORE: 60.0/100
 Open Source: 35/35

Use role.categories[*].max as the source of truth for capping, the denominator, and the CSV columns (and ideally ignore / overwrite the LLM's max).

Source: interviewstreet/hiring-agent