You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scenario discovery requires OpenAI credentials and one unavailable scenario blocks the entire catalog #3703
Scenario metadata discovery constructs scenarios with defaults, and an unconfigured optional OpenAI-backed scorer prevents the complete catalog and even a single-scenario lookup from being returned.
Steps/Code to Reproduce
Start the offline backend with the recorded local config and no OPENAI_CHAT_* variables. Run pyrit_scan list-scenarios --config-file <local-config.yaml>. For SDK coverage, initialize with load_defaults=False and request all metadata, then metadata for technique.execute or garak.encoding.
Start pyrit_backend --auth-mode none --host 127.0.0.1 --port 18741 --config-file local-config.yaml, then run pyrit_scan list-scenarios --config-file local-config.yaml with OPENAI_CHAT_* unset. Recorded output: HTTP 400 ... Environment variable OPENAI_CHAT_MODEL is required; include_estimates=false also returned 400. This probes metadata only, not a live model call.
Expected Results
Catalog/help metadata should be available without model credentials. An unavailable scenario should be marked unavailable or skipped without blocking other names and parameters. Include an unmocked, credential-free catalog smoke test.
Actual Results
CLI exits 1 with HTTP 400: Environment variable OPENAI_CHAT_MODEL is required. include_estimates=false also returns 400. A single-scenario request fails while building the full metadata snapshot at adaptive.image_technique_adaptive -> default scorer -> OpenAIChatTarget.
Proposed fix/regression: make default scorer construction lazy and isolate per-scenario metadata failures; verify complete catalog and targeted lookup with OPENAI_* unset.
Screenshots
Not applicable; command/API output is the evidence.
Versions
Tested commit d3446e0, PyRIT 1.2.0.dev0, offline Linux scope; no credentials or external inference. Recovery evidence: files/evidence/round1/list-scenarios.txt, catalog-traceback.txt, catalog-no-estimates.json, sdk-smoke.txt; these local paths are not attachments.
Reproduced on main (f3a88daf) with OPENAI_* unset. pyrit_scan list-scenarios against the local config exits 1 with 400 ... Environment variable OPENAI_CHAT_MODEL is required. Through the SDK (load_defaults=False), get_all_registered_class_metadata() raises the same error. So do the targeted lookups of technique.execute and garak.encoding, even though garak.encoding itself needs no model.
Building metadata for each scenario separately shows that 15 of the 25 fail, all for the same reason: their constructors eagerly resolve a model-backed default.
14 call self._get_default_objective_scorer() in __init__: adaptive.*, airt.{cyber,jailbreak,leakage,multilingual,rapid_response,scam}, benchmark.adversarial, garak.{audio_achilles_heel,doctor,figstep}, technique.execute and foundry.red_team_agent.
airt.psychosocial resolves get_default_scorer_target() for its per-sub-harm scorers.
foundry.red_team_agent and airt.scam also resolve get_default_adversarial_target() eagerly.
Planned fix:
Lazy default scorer.Scenario.__init__ would accept objective_scorer=None. _objective_scorer and _objective_scorer_identifier would resolve the default (cached) the first time they're read. That happens in initialize_async / _build_atomic_attacks_async / the identifier, not at construction. The scenarios above would pass the caller's scorer through instead of building the default up front. Scorer-derived config (AttackScoringConfig, psychosocial's per-harm scorers) becomes lazy too. An explicit scorer is used exactly as today.
Lazy adversarial default.scam and red_team_agent would resolve get_default_adversarial_target() at build time, the way multilingual and psychosocial already do. That stays inside override_default_adversarial_target, which the backend already wraps around initialization and execution.
Per-scenario isolation. In ScenarioRegistry, a scenario whose construction raises would be logged and left out of the catalog instead of failing every listing and lookup. The no-arg TypeError contract check stays fail-fast.
Tests. A credential-free catalog test that builds metadata for every registered scenario with OPENAI_* unset and no mocked targets. Tests that a default is not resolved until it's needed, that explicit scorers are untouched, and that one broken scenario doesn't hide the others.
Missing credentials would then surface when a scenario actually runs (initialize_async) rather than when the catalog is listed.
Activity
adimalkar commentedon Nov 1, 2026
I would like to take this.
Reproduced on
main(f3a88daf) withOPENAI_*unset.pyrit_scan list-scenariosagainst the local config exits 1 with400 ... Environment variable OPENAI_CHAT_MODEL is required. Through the SDK (load_defaults=False),get_all_registered_class_metadata()raises the same error. So do the targeted lookups oftechnique.executeandgarak.encoding, even thoughgarak.encodingitself needs no model.Building metadata for each scenario separately shows that 15 of the 25 fail, all for the same reason: their constructors eagerly resolve a model-backed default.
self._get_default_objective_scorer()in__init__:adaptive.*,airt.{cyber,jailbreak,leakage,multilingual,rapid_response,scam},benchmark.adversarial,garak.{audio_achilles_heel,doctor,figstep},technique.executeandfoundry.red_team_agent.airt.psychosocialresolvesget_default_scorer_target()for its per-sub-harm scorers.foundry.red_team_agentandairt.scamalso resolveget_default_adversarial_target()eagerly.Planned fix:
Scenario.__init__would acceptobjective_scorer=None._objective_scorerand_objective_scorer_identifierwould resolve the default (cached) the first time they're read. That happens ininitialize_async/_build_atomic_attacks_async/ the identifier, not at construction. The scenarios above would pass the caller's scorer through instead of building the default up front. Scorer-derived config (AttackScoringConfig, psychosocial's per-harm scorers) becomes lazy too. An explicit scorer is used exactly as today.scamandred_team_agentwould resolveget_default_adversarial_target()at build time, the waymultilingualandpsychosocialalready do. That stays insideoverride_default_adversarial_target, which the backend already wraps around initialization and execution.ScenarioRegistry, a scenario whose construction raises would be logged and left out of the catalog instead of failing every listing and lookup. The no-argTypeErrorcontract check stays fail-fast.OPENAI_*unset and no mocked targets. Tests that a default is not resolved until it's needed, that explicit scorers are untouched, and that one broken scenario doesn't hide the others.Missing credentials would then surface when a scenario actually runs (
initialize_async) rather than when the catalog is listed.