Skip to content

fix(core): derive fitness premise cues from policy (#41) - #150

Merged
CodewithJha merged 1 commit into
CodewithJha:mainfrom
BasilZafar11:fix/issue-41-policy-derived-fitness
Nov 16, 2026
Merged

CodewithJha merged 1 commit into
CodewithJha:mainfrom
BasilZafar11:fix/issue-41-policy-derived-fitness

Conversation

@BasilZafar11

@BasilZafar11 BasilZafar11 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #41

Replace the fixed APR/manager/approval word list in the fitness premise hint with policy tool and argument names. A matching tool name must appear in an assistant turn; that same turn earns additional credit for distinct argument names from that tool's rule (when, require, or forbid). Case, underscores, punctuation, and spaces are normalized with whole-word matching. The best rule/turn score is used, so unrelated rules, separate turns, repeated names, and attacker-only text cannot accumulate premise credit.

The policy is read directly to keep fitness independent of the mutation engine while using the same tool/critical-argument inputs as AttackFocus. The existing premise_accept signal key, weights, three-cue saturation, other signal components, public scoring signature, and violation oracle are unchanged. This remains a deterministic lexical search hint: a mention, including one in a refusal, does not prove acceptance or a violation. No LLM or provider call is added.

Update the system-design signal description and production-readiness hardcoding entry to match the implementation.

Type of change

  • Bug fix
  • Core engine (fitness)
  • Tests
  • Documentation

Checklist

  • Read CONTRIBUTING.md and repository policies
  • Linked related issue
  • Core stays framework/provider independent
  • Tests cover behavior changes
  • Documentation matches implementation
  • One concern per PR
  • Authorized offline testing only

Test plan

  • uv run --locked pytest tests/unit/test_fitness.py -q --tb=short: 20 passed.
  • MUTINY_SAMPLE_OFFLINE=1 uv run --locked pytest -q --tb=short: 777 passed, covering unit, integration, reliability, and packaging tests.
  • uv run --locked ruff check: passed.
  • git diff --check: passed.

New cases cover non-refund numeric/require policies, deny/forbid kinds, unrelated demo vocabulary, attacker-only text, name boundaries, separator/case variants, repeated mentions, cross-rule/cross-turn noise, empty policies/output, and the distinction between heuristic credit and a proven violation. Existing exact-one violation and numeric proximity tests still pass.

CLI shell smoke, production web/container builds, and isolated release-artifact shell checks are left to existing CI. Branch starts at current upstream main 99ed9ad, matching fork main at fetch.

CI results

All seven jobs passed: Python 3.11/3.12 backend tests, Python lint, package build, CLI smoke, web build, and container smoke.

CI run: https://github.com/CodewithJha/mutiny/actions/runs/43660146244

@vercel

vercel Bot commented Nov 15, 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.

@CodewithJha CodewithJha left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

MERGE READY for #41.

What I verified

  • Hard-coded APR/manager/authorization cue list is gone. _premise_signal now requires a policy tool mention in assistant text and credits that rule's argument names (when/require/forbid) with normalized whole-word matching. Attacker-only authority English no longer inflates premise.
  • Mutation check: restoring main's fitness module fails the new premise tests.
  • Local: test_fitness.py 20 passed; full unit+integration+reliability → 777 passed. CI green. Docs updated in SYSTEM_DESIGN / PRODUCTION_READINESS.

Approving and squash-merging. Closes #41.

@CodewithJha
CodewithJha merged commit 540a9c2 into CodewithJha:main Nov 16, 2026
7 of 8 checks passed
@CodewithJha

Copy link
Copy Markdown
Owner

Merged — thank you @BasilZafar11. Premise fitness now tracks the policy's tools/args instead of demo APR English, which is the modularity PRODUCTION_READINESS was asking for.

Nearby Core items:

No pressure.

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.

fitness: drive authority cues from AttackFocus / policy instead of hard-coded APR list

2 participants