-
-
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 3 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().min(0).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_rationow acceptsvalue: 0here, butshapeSummarizationConfigforwardstriggeronly whenconfig?.trigger?.valueis truthy (packages/api/src/agents/run.ts, around lines 197-200). Withvalue: 0, the trigger is silently dropped and runtime falls back to βno trigger configured,β which changes behavior (e.g., it can summarize on pruning even when token-ratio inputs are unavailable) instead of honoring the explicit ratio trigger. This makes a documented valid config behave differently than configured.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.
Good catch β addressed in 1aba326.
shapeSummarizationConfigwas using a truthy check onconfig?.trigger?.valuewhich droppedvalue: 0silently. Switched totypeof value === 'number'so the trigger survives and the runtime honors the explicit ratio instead of falling back to the no-trigger default. Added a regression test for the{ type: 'token_ratio', value: 0 }passthrough.