Skip to content

fix: do not block negated reasoning-disclosure safety rules - #129

Merged
dofastted merged 1 commit into
dofastted:mainfrom
joyoner:fix/negated-distill-guard
Sep 25, 2026
Merged

dofastted merged 1 commit into
dofastted:mainfrom
joyoner:fix/negated-distill-guard

Conversation

@joyoner

@joyoner joyoner commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A benign system instruction such as Do not reveal hidden reasoning matches the hard reveal hidden reasoning extraction regex. detectDistill returns distill_blocked (403) before credential/slot routing, even for an ordinary Claude request.

Fix

Skip only regex matches directly preceded by a negative instruction (do not, don't, never, must not, should not). Continue checking subsequent matches: a positive extraction request after the safety instruction still blocks. Harvest needles and other guard layers are unchanged.

Tests

  • Regression tests for negative system policies, positive user requests following a negative policy, and positive requests later in the same prompt.
  • node --test test/unit/distill-detect.test.mjs
  • npm run test:unit
  • npx biome check src/lib/core/distill-detect.mjs test/unit/distill-detect.test.mjs
  • git diff --check

@dofastted
dofastted merged commit 3afcd86 into dofastted:main Sep 25, 2026
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