Skip to content

fix(mutate): add dedicated semantic_rephrase and indirect_request templates - #144

Open
BasilZafar11 wants to merge 1 commit into
CodewithJha:mainfrom
BasilZafar11:fix/issue-24-template-operators
Open

BasilZafar11 wants to merge 1 commit into
CodewithJha:mainfrom
BasilZafar11:fix/issue-24-template-operators

Conversation

@BasilZafar11

Copy link
Copy Markdown
Contributor

Summary

Fixes #24

Replace the template aliases for semantic_rephrase and indirect_request with dedicated, seedable transforms. Semantic rephrasing varies the request framing, preserving the ask and adding the AttackFocus tool name when needed. Indirect requests ask to draft/prepare a tool call or its arguments, preserving the original request without adding approval codes or authority claims.

Both implementations are registered in TEMPLATE_OPERATORS. The engine records the dedicated operator in metadata.template_operator, while retaining logical strategy, mutation history, parent/generation links, and target rule IDs. The same dedicated transforms are used after an LLM failure. LLM prompts, Hosted, fitness, and policy evaluation are unchanged.

Tests cover both engine and direct-template paths, refund and email requests, quoted argument literals, parent isolation, deterministic sequences with wording variation, empty parents, message limits, lineage, and failed-LLM fallback.

Type of change

  • Bug fix
  • Tests
  • Core engine (mutation)

Checklist

  • Read CONTRIBUTING.md and repository policies
  • Linked related issue
  • Core stays free of framework SDK imports
  • Added meaningful regression coverage
  • One mutation concern per PR
  • Authorized offline testing only

Test plan

  • uv run --locked pytest tests/unit/test_mutate.py tests/unit/test_llm_mutator.py tests/unit/test_policy_general_seeds.py -q --tb=short: 68 passed.
  • MUTINY_SAMPLE_OFFLINE=1 uv run --locked pytest -q --tb=short: 780 passed, including unit, integration, reliability, and packaging checks.
  • uv run --locked ruff check: passed.
  • git diff --check: passed.

CLI shell smoke, production web build, and container execution are left to their existing CI jobs. The branch starts at latest upstream main 99ed9ad, matching fork main at the final fetch.

@vercel

vercel Bot commented Nov 9, 2026

Copy link
Copy Markdown

@BasilZafar11 is attempting to deploy a commit to the priyanshu's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

mutate: dedicated template operators for semantic_rephrase and indirect_request

1 participant