Skip to content

fix: accept 0 as a valid token_count in ContextManager.add_message - #356

Closed
andrewwhitecdw wants to merge 1 commit into
huggingface:mainfrom
andrewwhitecdw:andrewwhitecdw/fix/context-manager-token-count-optional
Closed

fix: accept 0 as a valid token_count in ContextManager.add_message#356
andrewwhitecdw wants to merge 1 commit into
huggingface:mainfrom
andrewwhitecdw:andrewwhitecdw/fix/context-manager-token-count-optional

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 24, 2026

Copy link
Copy Markdown

Closing this stale PR. Happy to reopen if the maintainers would like to revisit it.

add_message annotated token_count as int but defaulted to None, and the
 guard  treated 0 as unset. This meant callers could not
 explicitly set the running context usage to 0.

Annotate token_count as int | None and check  so 0 is
honored.

Signed-off-by: Andrew White <andrewh@cdw.com>
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.

1 participant