-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
π fix: Align Summarization Trigger Schema with Documented and Runtime-Supported Types #12735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
072d224
599c0fe
bc4e2c8
1aba326
a2731a9
7521b7e
3d11e26
617e166
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1020,10 +1020,20 @@ export const memorySchema = z.object({ | |
|
|
||
| export type TMemoryConfig = DeepPartial<z.infer<typeof memorySchema>>; | ||
|
|
||
| export const summarizationTriggerSchema = z.object({ | ||
| type: z.enum(['token_count']), | ||
| value: z.number().positive(), | ||
| }); | ||
| export const summarizationTriggerSchema = z.discriminatedUnion('type', [ | ||
| z.object({ | ||
| type: z.literal('token_ratio'), | ||
| value: z.number().positive().max(1), | ||
| }), | ||
| z.object({ | ||
| type: z.literal('remaining_tokens'), | ||
| value: z.number().positive(), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new Useful? React with πΒ / π.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in a2731a9 β added |
||
| }), | ||
| z.object({ | ||
| type: z.literal('messages_to_refine'), | ||
| value: z.number().positive(), | ||
| }), | ||
| ]); | ||
|
|
||
| export const contextPruningSchema = z.object({ | ||
| enabled: z.boolean().optional(), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
token_ratio: 0trigger thresholdThe new
token_ratiobranch rejectsvalue: 0because it uses.positive().max(1), but the published trigger range is0.0β1.0; this means a documented configuration now fails schema validation and can stop startup whenconfigSchema.strict().safeParse(...)runs in config loading. This regression only appears when admins intentionally settrigger.type: "token_ratio"withvalue: 0(e.g., to force immediate summarization), and the fix is to include0in the accepted lower bound for that variant.Useful? React with πΒ / π.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in bc4e2c8 β switched
token_ratiofrom.positive().max(1)to.min(0).max(1)to match the documented inclusive 0.0β1.0 range.0is a valid extreme that means "summarize on every pruning event" per the SDK'susedRatio >= 0check.remaining_tokensandmessages_to_refinekeep.positive()β0on either is semantically no-op given the SDK'smessagesToRefineCount <= 0early return.