Repository navigation
fix(py): isolate .prompt loader errors, honor output.constrained, and serialize NaN/Infinity as null - #85
Merged
Conversation
huangjeff5
force-pushed
the
fix/py-1.0-pr3c-action-context-ai-run
branch
from
November 11, 2026 06:22
a44f8d2 to
4376044
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr3d-prompt-loader-sse
branch
from
November 11, 2026 06:22
7239c1a to
f581401
Compare
huangjeff5
changed the base branch from
fix/py-1.0-pr3c-action-context-ai-run
to
main
November 11, 2026 18:37
huangjeff5
force-pushed
the
fix/py-1.0-pr3d-prompt-loader-sse
branch
from
November 11, 2026 18:38
1ac7d23 to
b2313a4
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr3d-prompt-loader-sse
branch
from
November 12, 2026 07:27
b2313a4 to
b5ca24e
Compare
hilariie
approved these changes
Nov 16, 2026
hilariie
left a comment
Contributor
There was a problem hiding this comment.
The description doesn't match the diff in a few places. The SSE unboxing bullet is already on main, the old loader didn't abort startup (it silently skipped the rest of the folder and its subfolders), the log is an error rather than a warning, example 2 needs await and opts.output.constrained, and Go sends an error for NaN rather than null. It's also missing the Breaking changes and Cross-SDK sections: the variant split changes x.v2.1.prompt from variant v2 to v2.1, and the SSE format and frontmatter both change.
… the model request Log per-file loader failures with logger.exception so the exception type and traceback survive. Loader tests now assert on the request the model receives: constrained survives apply_format, contentType reaches the model when no format claims it. Move the flow-returns-FAILED SSE case into to_sse_test.py and drop sse_failed_response_test.py; the rest was already covered.
apply_format replaced any caller content type with the format's own, so output_content_type (and frontmatter contentType) only reached the model when no format was set. The format now fills it in only when the caller left it unset, the same rule constrained already follows and JS applyFormat uses.
This was referenced Nov 18, 2026
Merged
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.
A syntax error in one
.promptfile no longer drops the rest of its folder, frontmatteroutput.constrainedreaches the model, and non-finite floats in flow results serialize asnullinstead of failing the request.Main Changes
.promptload failures to the file: Previously, onetrywrapped the whole folder walk, so the first bad prompt or partial ended it. Later files in that folder and all its subfolders were skipped, and the log named the folder, not the file. Each file now has its owntry, logged at ERROR with the file path and traceback. Only read and frontmatter errors surface here; templates compile on first use, so template errors surface at render.output.constrained; an explicit content type beats the format's: Previously,load_promptsetoutput_constrained=Truewheneveroutput.schemawas present, soconstrained: falsewas dropped. Frontmatterconstrainednow wins; a schema with no setting still asks for native JSON mode. FrontmattercontentTypeis forwarded the same asdefine_prompt(output_content_type=...).apply_formatused to replace any explicit content type with the format's own (json →application/json), so it only reached the model with no format set. It now fills in the format's value only when the caller didn't set one, the same ruleconstrainedalready followed.formatstays format-owned, so a custom format likecited-jsonstill maps onto wire formatjson.NaNandInfinityasnullingenkit.web: Previously,result_jsonandto_sseencoded withallow_nan=Falseand no fallback, so a non-finite float in a flow result raised (HTTP 500 / INTERNAL error frame).to_jsonable_python(..., inf_nan_mode='null')now emitsnull, the same as tool outputs and model messages already do (mode='json').scorer.v2.1.promptsplit on every.and registered variantv2, dropping.1. The name splits on the first.only, so the variant isv2.1.---had everything up to the next---anywhere in the file removed, including a Markdown divider in the body. Both delimiters must now be lines of their own.Breaking changes
x.v2.1.promptregisters variantv2.1, notv2. Lookups withvariant='v2'for such a file now miss.output.constrained: falsewith a schema now sends an unconstrained request, with the schema instructions injected into the prompt. Previously it was silently constrained.output_content_type(or frontmattercontentType) now reaches the model even when a format is set. Before, the format's content type replaced it. Gemini keys JSON mode onformat == 'json' or content_type == 'application/json', so a mismatched pair likeoutput_format='text', output_content_type='application/json'now turns JSON mode on.---must be on its own line to open or close frontmatter in a partial. A partial that relied on the old substring match keeps more of its text.result_jsonandto_sseemitnullforNaN,Infinityand-Infinityinstead of raising or sending an INTERNAL error frame.Cross-SDK
slog.Error("failed to load prompt file, skipping it", ...)). JS has no per-file catch inloadPromptFolderRecursively.strings.Cut(base, ".")). JS still takesname.split('.')[1], sox.v2.1.promptisv2there.applyFormat({...resolvedFormat.config, ...outRequest.output}). Go has no caller-facing output content type option.constrained/contentType: neither JS nor Go reads these from frontmatter today. A.promptwithconstrained: falsebehaves differently in Python than in JS/Go until they follow.NaN/Infinity: matches JSJSON.stringify(null). Go'sencoding/jsonreturns an error for non-finite floats.