Skip to content

Overall risk rating: accept the rating line small models actually write (30 of 32 fresh evaluation runs failed on it) #153

Closed

Description

@vsn411

Problem: In the fresh adversarial evaluation (#152, docs/evaluations/2026-11-19), 30 of 32 runs ended failed even though most reports are complete SAST reports with a clear verdict. The cause is one formatting rule. The output contract asks for **Overall risk rating:** <severity> on its own line, and _RISK_RATING_RE in src/secfoo/report/severity.py accepts only that bold form. The model (Qwen3 4B) wrote the rating inside the summary paragraph (... The application contains a command injection ... Overall risk rating: High.) in 27 reports, and on its own line without bold in 3. The API agent's reformat retry did not fix it, so the run fails. The only 2 scorable runs are the fake-report attack, whose planted expected-report.md showed the model the exact bold line to copy.

So the evaluation mostly measures a formatting rule, and real users on small or local models hit the same failure.

Build:

  1. Accept the rating in the shapes models actually write, without letting quoted examples supply it: bold or plain Overall risk rating:, on its own line or as the last sentence of the Summary / Executive Summary section's first paragraph. Keep ignoring code fences, blockquote examples and JSON draft echoes (text_without_json_drafts, has_json_draft from Fail malformed reports safely and resolve adversarial evaluation review #147).
  2. Make the API agent's reformat request quote the exact line it needs (**Overall risk rating:** <Critical|High|Medium|Low>) and say where it goes.
  3. Regression tests: the 30 failed reports in docs/evaluations/2026-11-19/api.jsonl become parseable with their correct rating, and the counts/ratings parity check against main on all stored reports still holds for everything that parsed before.
  4. Re-score: add a replay option that re-applies the current parser to each record's stored report text, so the 2026-11-19 evidence can be re-scored without new model runs, and publish the re-scored summary next to the original.

Where to look: src/secfoo/report/severity.py (_RISK_RATING_RE, extract_overall_risk_rating), src/secfoo/report/markdown.py (section, visible_text, text_without_json_drafts), src/secfoo/agents/api.py (reformat request), src/secfoo/skills/renderer.py (output contracts), scripts/adversarial_eval.py, tests/test_review_hardening.py, tests/test_property_parsers.py.

Done when: at least 25 of the 30 failed 2026-11-19 reports parse with the rating a human reads in them; no rating is ever taken from a fence, quote or JSON echo (property tests); the re-scored summary is published.

Activity

  1. added
    enhancement
    help wanted
    hackathon
    difficulty: medium
    on Nov 20, 2026
  2. aaas72 commented on Nov 20, 2026

    @aaas72
    Contributor

    Hi! I'd like to work on this one.

    Plan:

    1. Relax _RISK_RATING_RE / extract_overall_risk_rating to accept the plain and bold Overall risk rating: forms, on their own line or as the last sentence of the Summary's first paragraph, while still ignoring fences, blockquotes and JSON draft echoes.
    2. Make FIX_REQUEST quote the exact **Overall risk rating:** <Critical|High|Medium|Low> line and where it goes.
    3. Regression tests over the 30 failed records in docs/evaluations/2026-11-19/api.jsonl (checked against the ratings in the README's qualitative table), a parity check against main for all stored reports, and property tests that no rating comes from a fence, quote or JSON echo.
    4. Add a --rescore replay option to scripts/adversarial_eval.py and publish the re-scored summary next to the original.

    Could you assign it to me? I'll open a PR soon.

  3. added a commit that references this issue on Nov 20, 2026
    fc321d3
  4. added a commit that references this issue on Nov 20, 2026
    c7d31ee
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

    difficulty: mediumenhancementhackathonhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions