Skip to content

fix(chat): continue gRPC responses until natural EOS - #161

Merged
FluffyAIcode merged 1 commit into
mainfrom
AgentMemory/grpc-chat-natural-eos-0712
Jul 12, 2026
Merged

fix(chat): continue gRPC responses until natural EOS#161
FluffyAIcode merged 1 commit into
mainfrom
AgentMemory/grpc-chat-natural-eos-0712

Conversation

@FluffyAIcode

Copy link
Copy Markdown
Owner

Summary

  • treat Generate.max_tokens as a streaming chunk size rather than a full-answer limit
  • automatically issue additional Generate calls while the server reports STOP_REASON_MAX_TOKENS
  • stop on natural EOS/cancel/user interrupt, with an optional explicit client safety cap
  • print generated token count, server time, tok/s, and final stop reason after each answer

Why

The gRPC REPL returned to you> every 64 tokens, making healthy max-token chunk boundaries look like network truncation. The older Mac chat path already used natural EOS semantics; this brings the session-bound gRPC client to the same contract.

Tests

  • PYTHONPATH=.:sdks/python pytest -q tests/scripts/test_chat_grpc.py
  • python -m py_compile scripts/chat_grpc.py
  • covers max-token continuation to EOS, optional safety cap, and no-progress guard

Made with Cursor

Treat max_tokens as an internal streaming chunk instead of a response limit, preserve an optional safety cap, and report real stop reasons and throughput.

Co-authored-by: Cursor <cursoragent@cursor.com>
@FluffyAIcode
FluffyAIcode merged commit fb3ee9b into main Jul 12, 2026
7 checks passed
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