fix(systematize): align structured output and preserve diagnostics - #333
Open
Jake Present (jakepresent) wants to merge 3 commits into
Open
fix(systematize): align structured output and preserve diagnostics#333Jake Present (jakepresent) wants to merge 3 commits into
Jake Present (jakepresent) wants to merge 3 commits into
Conversation
Jake Present (jakepresent)
requested review from
Aaron Aspinwall (AaronAspinwall123),
Chang Liu (changliu2) and
tangym
as code owners
August 25, 2026 15:51
Jake Present (jakepresent)
force-pushed
the
jake/systematization-failure-diagnostics
branch
from
August 25, 2026 17:53
2ce84c7 to
9cec2b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
systematizationstring, and keep the generated artifact structured for conversion;Root causes
Prompt/schema mismatch
A real 0.2.0 pipeline failure returned output beginning with:
The prompt requested a top-level document containing
behavior,scope,concept_spec, and the other systematization fields. The response schema instead declared only asystematizationstring andsummary_items, so the model attempted to serialize the requested document inside that string. The revised Pydantic contract mirrors the prompt directly, and conversion accepts both the new object and legacy string artifacts.Output content filtering during conversion
A rerun with the aligned contract passed stage one and produced the new diagnostic at conversion. It showed:
finish_reason: content_filter;The conversion prompt was asking for 4–8 concrete raw examples per category and explicitly encouraged severe examples. For harmful taxonomies, that made the model reproduce the content being measured and triggered the provider's output filter. Both systematization prompts now require concise masked structural fragments with square-bracket placeholders for harmful material, while safe categories retain ordinary examples. A content-filter finish reason now raises one accurate error and diagnostic instead of making an identical second attempt.
Validation
finish_reason: content_filter, failed under the old generic retry path, and now stops after one call withreason: content_filtered;121 passed, 4 subtests passed;assert-ai 0.2.0,litellm 1.97.0,click 8.4.2, andpydantic 2.13.4);1,451 passed, 22 skipped, 840 subtests passed;git diff --checkclean.Data handling
Diagnostics stay local with the suite. Request payloads pass through the existing credential sanitizer. Responses remain complete in the file and may contain evaluation content, so normal terminal output only shows a short preview and the diagnostic path.
Remaining validation and deployment requirement
The two reported failure modes and exact Python/LiteLLM combination are covered locally. A follow-up rerun confirmed that masking harmful examples is not sufficient for every safety behavior: Foundry blocked the high-level
sexual_content_generationsystematization itself as high-severity completion content before the response reached the pattern examples. The prompt remained classified safe.With standard Azure OpenAI completion filtering, High-severity output remains blocked even at the least restrictive normal threshold. Running these red-team systematization and test-generation stages therefore requires either a deployment approved for Modified Content Filters (
Annotate onlyorNo filterson completions) or a different internal-generation provider. The evaluated target can remain unchanged. The prompt changes in this PR still reduce unnecessary explicit content, while the diagnostic and direct error make this deployment limitation visible.