Bounded bidirectional advisor de-escalation (D-0049) #124

Merged
hannah-vernon merged 1 commit from feature/advisor-deescalation into dev 2026-09-21 16:42:36 -05:00
Owner

What does this PR do?

Final feature of the advisor control-refinements program (ADR D-0049). Turns the escalate-only clamp into a bounded bidirectional clamp that may lower severity and confidence below the deterministic base, but only under strict eligibility. Every ineligible path is byte-for-byte the previous escalate-only behaviour.

A consult may de-escalate only when ALL hold:

  • DeEscalationEnabled (effective, per-category resolved) is true - disabled by default
  • the D-0048 injection gate reports the input clean (InjectionDetected == false) - any detection keeps escalate-only, so a prompt-injection attempt can never cause a downward move
  • the deterministic base severity is strictly below DeEscalationProtectedSeverity (default 7, mirroring the policy ActionMinSeverity default) - a base classification already at the action severity can never be talked down
  • the model's own returned confidence is >= DeEscalationMinModelConfidence (default 0.7) - uncertain output cannot lower a deterministic decision

When eligible, the lower bound is base - MaxDownwardSeverityDelta (default 1, floored at 0) and base - MaxDownwardConfidenceDelta (default 0.10, floored at 0.0); the upward bound is unchanged. It applies to the final combined output, so under the ensemble (D-0047) both models must agree to lower, and it is re-applied on response-cache hits (D-0046). The downward deltas and the toggle are per-category overridable via local_model_advisor_category_bands (D-0044); protected-severity and min-confidence are global.

A sixth AdvisorConsultOutcome value DeEscalated records a downward move (escalation rate stays Escalated/total); /advisor and /api/v1/advisor report the de-escalation count and rate, and a de-escalated consult carries an [advisor] advisor lowered assessment reason.

How was this tested?

  • dotnet build - 0 errors, 0 warnings
  • dotnet test - 934 pass, 0 fail, 0 skip (+18 from 916)
  • Eligibility unit tests (each blocking condition tested incl. protected-severity and min-confidence boundaries), tri-state outcome tests, per-category override, ensemble + cache interaction, settings/category-band round-trips, and disabled-by-default regression

Checklist

  • I have read the Contributing Guide
  • Changes are focused - one logical change per PR
  • Documentation updated (DECISIONS.md D-0049, AGENT-README.md)
  • New dependencies are MIT/Apache-2.0/BSD, security-vetted, and recorded in THIRD-PARTY-NOTICES.md (none added)
  • No secrets, credentials, or real infrastructure identifiers in the diff
  • No commented-out code or debug leftovers
## What does this PR do? Final feature of the advisor control-refinements program (ADR D-0049). Turns the escalate-only clamp into a bounded **bidirectional** clamp that may lower severity and confidence below the deterministic base, but only under strict eligibility. Every ineligible path is byte-for-byte the previous escalate-only behaviour. A consult may de-escalate only when ALL hold: - `DeEscalationEnabled` (effective, per-category resolved) is true - **disabled by default** - the D-0048 injection gate reports the input clean (`InjectionDetected == false`) - any detection keeps escalate-only, so a prompt-injection attempt can never cause a downward move - the deterministic base severity is strictly below `DeEscalationProtectedSeverity` (default 7, mirroring the policy `ActionMinSeverity` default) - a base classification already at the action severity can never be talked down - the model's own returned confidence is >= `DeEscalationMinModelConfidence` (default 0.7) - uncertain output cannot lower a deterministic decision When eligible, the lower bound is `base - MaxDownwardSeverityDelta` (default 1, floored at 0) and `base - MaxDownwardConfidenceDelta` (default 0.10, floored at 0.0); the upward bound is unchanged. It applies to the **final combined output**, so under the ensemble (D-0047) both models must agree to lower, and it is re-applied on response-cache hits (D-0046). The downward deltas and the toggle are per-category overridable via `local_model_advisor_category_bands` (D-0044); protected-severity and min-confidence are global. A sixth `AdvisorConsultOutcome` value `DeEscalated` records a downward move (escalation rate stays Escalated/total); `/advisor` and `/api/v1/advisor` report the de-escalation count and rate, and a de-escalated consult carries an `[advisor] advisor lowered assessment` reason. ## How was this tested? - [x] `dotnet build` - 0 errors, 0 warnings - [x] `dotnet test` - 934 pass, 0 fail, 0 skip (+18 from 916) - [x] Eligibility unit tests (each blocking condition tested incl. protected-severity and min-confidence boundaries), tri-state outcome tests, per-category override, ensemble + cache interaction, settings/category-band round-trips, and disabled-by-default regression ## Checklist - [x] I have read the Contributing Guide - [x] Changes are focused - one logical change per PR - [x] Documentation updated (DECISIONS.md D-0049, AGENT-README.md) - [x] New dependencies are MIT/Apache-2.0/BSD, security-vetted, and recorded in THIRD-PARTY-NOTICES.md (none added) - [x] No secrets, credentials, or real infrastructure identifiers in the diff - [x] No commented-out code or debug leftovers
Turn the escalate-only clamp into a bounded bidirectional clamp that may lower
severity and confidence below the deterministic base, but only when de-escalation
is enabled, the D-0048 injection gate reports the input clean, the base severity
is below DeEscalationProtectedSeverity (default 7), and the model's own confidence
is at least DeEscalationMinModelConfidence (default 0.7).

Dedicated downward deltas (default severity 1, confidence 0.10, per-category
overridable) bound how far a value can fall; the upward bound is unchanged.  Applies
to the final combined (post-ensemble) output and is re-applied on cache hits.  Adds a
sixth AdvisorConsultOutcome value DeEscalated (escalation rate stays Escalated/total),
surfaced on /advisor and /api/v1/advisor with a de-escalation count and rate, and a
de-escalated consult carries an [advisor] advisor lowered assessment reason.

Disabled by default.  Every ineligible path stays escalate-only, so a prompt-injection
attempt can never cause a downward move.  934 tests pass (+18).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hannah-vernon/viegard-sentinel!124
No description provided.