Skip to content

refactor(redteam): remove unmaintained v2 engine (#216) - #243

Open
nikhilpatidar wants to merge 3 commits into
NuGuardAI:mainfrom
nikhilpatidar:bug/remove-v2-engine
Open

refactor(redteam): remove unmaintained v2 engine (#216)#243
nikhilpatidar wants to merge 3 commits into
NuGuardAI:mainfrom
nikhilpatidar:bug/remove-v2-engine

Conversation

@nikhilpatidar

@nikhilpatidar nikhilpatidar commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

PR Type

  • Bug fix
  • Feature

Fixes #216.

The v2 engine was a large (~4,800 LOC) scaffold hidden behind --engine v2 with no verified correctness and no owner. It contradicted itself in its own documentation (orchestrator.py claimed 8 phases complete while the CLI wrapper said it was a scaffold), and a direct import from nuguard.redteam.v2.execution.runner leaked into tests/redteam/test_codegen_escalation.py. Nothing else in the codebase consumes it.

Changes

  • Remove nuguard/redteam/v2/ and tests/redteam/v2/ entirely (~7,300 LOC).
  • Remove the --engine CLI flag, the v2 dispatch, the v2 settings annotation, and _run_redteam_v2 from nuguard/cli/commands/redteam.py. The v1 redteam engine remains the sole path.
  • Remove RedteamV2Settings, redteam.v2.* config keys, resolved_redteam_v2_settings(), and the redteam.v2.* NuGuardConfig fields from nuguard/config.py.
  • Older nuguard.yaml files with these keys still load — the parsers drop them silently.
  • Refactor tests/redteam/test_codegen_escalation.py to test only the v1 surface (detect_codegen_success() and build_codegen_escalation_chains()).
  • Add tests/redteam/test_no_v2_engine.py as a regression net to catch any future reintroduction of v2 plumbing (5 tests covering module-path absence, import failure, Settings class absence, CLI flag absence, and silent config-key tolerance).

Tests

  • 36 tests pass after the change (including the new v2-removal regression tests).
  • nuguard redteam --help no longer exposes --engine; the default code path is unchanged.

Closes #216

The v2 engine was a large (~4,800 LOC) scaffold hidden behind
--engine v2 with no verified correctness and no owner. It contradicted
itself in its own documentation (orchestrator.py claimed 8 phases
complete while the CLI wrapper said it was a scaffold), and a direct
import from nuguard.redteam.v2.execution.runner leaked into
tests/redteam/test_codegen_escalation.py. Nothing else in the codebase
consumes it.

- Remove nuguard/redteam/v2 and tests/redteam/v2 entirely.
- Remove the --engine CLI flag and the v2 dispatch in
  nuguard/cli/commands/redteam.py.
- Remove RedteamV2Settings, the redteam.v2.* config keys, the
  resolved_redteam_v2_settings() method, and the redteam.v2.* NuGuardConfig
  fields from nuguard/config.py. Older nuguard.yaml files with these keys
  still load (the parsers drop them silently).
- Refactor tests/redteam/test_codegen_escalation.py to test the v1
  surface only (the module-level detect_codegen_success() helper plus
  the build_codegen_escalation_chains() builder). The v2-internal
  ObjectiveRunner._detect_codegen_success / _merge_outcomes / KillChainState
  tests are dropped because their subject no longer exists.
- Add tests/redteam/test_no_v2_engine.py as a regression net to catch any
  future reintroduction of v2 plumbing.

The v2 engine was a known-suspect area with no test coverage guaranteeing
that --engine v2 produced the same findings as v1, so removing it does
not change observable v1 behavior. Pre-fix: 1867 tests pass. Post-fix:
1887 tests pass.
KanishkThamman
KanishkThamman previously approved these changes Aug 11, 2026

@KanishkThamman KanishkThamman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@nikhilpatidar Verified via worktree checkout + repo-wide grep + pytest — no dangling references to the removed v2 engine, 36/36 relevant tests pass. Nit (not blocking): documentation/docs/cli-reference.md still documents the removed --engine flag — worth a fast follow-up doc fix.

The v2 engine was removed in NuGuardAI#243, but the cli-reference.md flag table
still listed a --engine row with a 'v2 in development' badge. Remove
the row so the doc reflects the current Typer surface.

Refs NuGuardAI#243.
@nikhilpatidar

nikhilpatidar commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@KanishkThamman Addressed the docs nit in commit ec5b477 on the bug/remove-v2-engine branch — the stale --engine row has been removed from the redteam flag table in documentation/docs/cli-reference.md.

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.

Remove nuguard/redteam/v2 — unmaintained, unverified engine reachable via --engine v2

2 participants