Skip to content

FEAT: Replace openai_objective_target initializer with explicit --target CLI parameter#1536

Merged
rlundeen2 merged 13 commits intomicrosoft:mainfrom
rlundeen2:users/rlundeen/2026_03_21_cli_target_update
Mar 24, 2026
Merged

FEAT: Replace openai_objective_target initializer with explicit --target CLI parameter#1536
rlundeen2 merged 13 commits intomicrosoft:mainfrom
rlundeen2:users/rlundeen/2026_03_21_cli_target_update

Conversation

@rlundeen2
Copy link
Copy Markdown
Contributor

This PR changes how objective targets are specified when running scenarios. Instead of relying on the openai_objective_target initializer to set a default target, users now explicitly select a registered target by name via --target.

Changes:

  • New --target flag for both pyrit_scan and pyrit_shell run commands — resolves a named target from the TargetRegistry to use as the objective target
  • New --list-targets command to discover available targets after initializers have run (e.g., pyrit_scan --list-targets --initializers target)
  • list_targets_async / print_targets_list_async added to frontend_core.py for target discovery and formatted display
  • Removed openai_objective_target initializer — the ScenarioObjectiveTargetInitializer and its module are deleted; references removed from init.py, .pyrit_conf_example, and all CLI help/examples
  • Simplified pyrit_shell startup — removed --database and --env-files args from the shell launcher (these come from the config file)
  • Config loading logging — added logger.info + print when loading config files for visibility
  • Removed unrelated stale tests in test_common_net_utility.py, test_realtime_target.py, test_supports_multi_turn.py, and test_target_capabilities.py
  • Added tests for list_targets_async, run_scenario_async with --target, and updated existing CLI tests to reflect the new flag

rlundeen2 and others added 3 commits March 24, 2026 12:11
Co-authored-by: jsong468 <songjustin@microsoft.com>
Co-authored-by: jsong468 <songjustin@microsoft.com>
Co-authored-by: jsong468 <songjustin@microsoft.com>
Copy link
Copy Markdown
Contributor

@jsong468 jsong468 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! just wondering if we want get rid of some of the pyrit_scan params since they can be specified in the config file?

rlundeen2 and others added 8 commits March 24, 2026 14:36
Co-authored-by: jsong468 <songjustin@microsoft.com>
Co-authored-by: jsong468 <songjustin@microsoft.com>
Co-authored-by: jsong468 <songjustin@microsoft.com>
Co-authored-by: jsong468 <songjustin@microsoft.com>
Co-authored-by: jsong468 <songjustin@microsoft.com>
@rlundeen2 rlundeen2 merged commit ba944ee into microsoft:main Mar 24, 2026
35 checks passed
rlundeen2 added a commit to rlundeen2/PyRIT that referenced this pull request Mar 26, 2026
…target

The E2E tests were failing with exit code 2 because:
1. --database was removed from pyrit_scan CLI (PR microsoft#1536)
2. openai_objective_target initializer was deleted (PR microsoft#1536)

Changes:
- Add DEFAULT_OBJECTIVE_TARGET tag to TargetInitializerTags
- Add openai_chat target config using generic OPENAI_CHAT_* env vars
- Tag openai_chat as the default objective target in the registry
- Update E2E test to use --target openai_chat, --initializers targets,
  and --config-file for InMemory database
- Add unit tests for default objective target tagging

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants