Skip to content

NIMbus v2.0.15

Latest

Choose a tag to compare

@cyberofficial cyberofficial released this 05 Sep 07:56
· 2 commits to master since this release

v2.0.15 - Date: 2026-09-05

Full Changelog: v2.0.14...v2.0.15

Fixed

  • DeepSeek-V4-Pro CoT leakage in streaming - Disabled the forced thinking flag for deepseek-v4-pro. With server-default thinking, DeepSeek-V4 on NIM returns Chain-of-Thought inline in message.content with a trailing (orphan) response instead of the separate reasoning_content field.
  • Inline thinking → thinking blocks (buffered mode) - Split inline CoT via split_think_content and emit proper Anthropic thinking blocks; optimization_response_to_sse now emits thinking blocks too instead of dropping them.
  • Degraded DeepSeek-V4 DSML tool-call parsing & stop_reason guard - Rewrote the DSML parser to fix degraded tool-call extraction and guard stop_reason correctly.
  • Dangling DSML tag stripping - Added _strip_residual_tags to providers/dsml_parser.py. When NVIDIA's server-side tool-call parser consumes the head of a DSML block, only the closing tags survive in message.content. These residuals are never legitimate text, so all DSML tags outside parsed tool-call blocks are now stripped, ensuring Claude Code never sees raw markup.
  • Missing tool_use blocks in buffered→SSE conversion - Emitted tool_use blocks when converting buffered responses to SSE.
  • SERVER_TYPE config - Fixed SERVER_TYPE handling and added DeepSeek-V4-Pro DSML tool-call parsing for stream mode.
  • NotFoundError & overloads retryability - NotFoundError and overload errors are now treated as retryable.
  • Bot protection bypass for localhost - Localhost requests are ignored by bot protection.
  • Mid-stream truncation retry - Streams that end without a finish_reason (NVIDIA backend cut off mid-response) now trigger a retry instead of silently returning a partial response. Previously only completely empty streams were detected.
  • Mid-stream connection drop retry (stream mode) - Connection errors (APIConnectionError, APITimeoutError, httpx.ReadError, httpx.TimeoutException) raised during chunk iteration are now retried in streaming mode. Previously they were treated as non-retryable and emitted an incomplete SSE sequence (error event without message_stop), causing Claude Code to fail with "empty or malformed response (HTTP 200)".
  • Stream retry duplicate message_start - Fixed a bug where a retried stream emitted a second message_start into the buffered SSE (one per attempt), leaving Claude Code with two message sequences and failing with "empty or malformed response (HTTP 200)". stream_response now keeps only the final attempt's events (from its last message_start onward), dropping partial earlier attempts.
  • stop_reason mismatch with streamed tool_use blocks - When DeepSeek emits tool calls as DSML markup, OpenAI's finish_reason is "stop" even though the proxy streams tool_use content blocks. Claude Code requires stop_reason="tool_use" when tool_use blocks are present and rejected the delivered end_turn + tool_use message as "empty or malformed response (HTTP 200)". The stop_reason guards in both streaming and buffered paths now also upgrade end_turn/other → tool_use when tool_use blocks were actually streamed (tracked via a new tool_blocks_started counter in SSEBuilder).
  • Reasoning budget sets max_tokens - The reasoning budget (from effort config, <nimeffort:level:budget> tag, or session store) now directly sets max_tokens instead of being silently capped. This allows models like deepseek-v4-flash-0731 to use their full reasoning capability (e.g. <nimeffort:ultracode:100> → max_tokens=100). DeepSeek uses reasoning_effort in chat_template_kwargs to control thinking intensity; Nemotron uses reasoning_budget in extra_body.
  • Nimeffort combined format - The <nimeffort> tag now supports <nimeffort:level:budget> format (e.g. <nimeffort:ultracode:100> sets effort to ultracode with a 100-token budget). The budget directly controls max_tokens. Budget is stored in the session store by _handle_nimeffort in routes.py and retrieved per-request.
  • DeepSeek reasoning_budget exclusion - reasoning_budget parameter is no longer sent to DeepSeek models (which reject it with 400 errors). Only Nemotron/default styles send it. DeepSeek uses reasoning_effort in chat_template_kwargs + max_tokens instead.
  • Partial response delivery on truncated SSE - Truncated NVIDIA streams with partial content (text, reasoning, or tool calls) now close their blocks and deliver the partial response instead of failing. Only empty (or empty-but-truncated) streams raise StreamTruncatedError for retry.
  • Partial-response proxy notice - Truncated/partial responses delivered to the client are appended with a visible notice ([PROXY NOTICE] ... partial reply ... split the work into smaller chunks) so the model knows the reply was cut short and can adapt instead of assuming the task finished.
  • Partial tool-use stop reason - The provider no longer emits end_turn for streamed tool-use blocks; it sets stop_reason="tool_use" when tool blocks were started, matching the normal completion path.
  • Reasoning-only partial stream retry - When a stream cuts mid-response with only reasoning content and no assistant text or tool calls, it is now treated as truncation and retried instead of delivering an untouchable thinking block to Claude Code.
  • httpx.RemoteProtocolError retry - NVIDIA's "incomplete chunked read" mid-body disconnects (httpx.RemoteProtocolError) are now retryable.
  • Unique tool_use IDs (Kimi-k3 deadlock fix) - _fresh_tool_id() always mints a globally-unique Claude-style tool_use id instead of forwarding NIM's raw tool_call id. Kimi-k3 returns ids in Name:index format (Bash:0, Read:1) that repeat per same-named call across turns; Claude Code de-duplicates assistant tool_use blocks on id, strips the repeated block, and replaces the turn with [Tool use interrupted] — an empty re-prompt loop. Always-fresh ids (like the real Anthropic API) fix the deadlock.
  • Bot protection localhost exemption & /api/hello - Localhost requests no longer accumulate failed-attempt strikes toward a ban in record_failed_attempt, and a keyless GET /api/hello route was added (returns {}) so clients that probe it don't trigger bot protection. @api/app.py and api/bot_protection.py.
  • Optimization SSE defaults - optimization_response_to_sse now falls back to a fresh msg_* id and "unknown" model when a mocked optimization response omits them, instead of emitting a malformed message_start.
  • Reasoning config module-cache fix - _load_reasoning_config now assigns the parsed JSON back to the _REASONING_CONFIG_RAW module cache, so runtime edits to reasoning_config.json are honored instead of the stale initial value.
  • sse_content_block_stop standalone helper - SSE builder exposes a standalone content_block_stop event emitter (no full SSEBuilder state needed) for stream-retry de-dup to close already-opened blocks; _keepalive typing tightened to AsyncGenerator.
  • Duplicate RequestQueue.get_stats removed - Removed the duplicate method definition (the @property get_stats was the remaining one).
  • kimi-k3 400/top_p fix & reasoning style - Force immutable top_p=0.95 for moonshotai/kimi-k3 (the server rejects any other value) and add a kimi thinking style that sends top-level reasoning_effort (low/high/max) via extra_body.
  • Real-time streaming delivery - Provider SSE events now stream to the client as they arrive instead of fully buffering, so the first token reaches Claude Code quickly and idle timeouts are avoided. This superseded the earlier SSE keepalive workaround (_keepalive/_buffered_stream removed).
  • Unlimited truncation retry - provider_retry_on_truncation default changed from 3 to 0, where 0 now means unlimited retries on truncated/mid-stream responses so the client always receives a complete message sequence.
  • Error diagnostics & transport logging - Enriched retry/error logs with request/model context, timeout subtype, __context__/__cause__ chains, total elapsed summaries, and periodic "still retrying" info; header capture now emits a timed failure line on transport timeout/connection errors.

Changed

  • SERVER_TYPE now defaults to buffer - config/settings.py default changed from stream to buffer (unset SERVER_TYPE now uses buffered mode with unlimited truncation retry). stream remains explicitly selectable via SERVER_TYPE=stream or <nimserver:stream>. This brings the code default in line with the reliability-first retry model.
  • reasoning_config.json kimi-k3 budgets - moonshotai/kimi-k3 efforts now use explicit token budgets (low:1000 → ultracode:32000) instead of -1, so the kimi reasoning style benefits from the budget→max_tokens behavior.
  • Discord bot & rate-limiter hardening - Tightened Discord channel/guild type-safety and checks (isinstance guards, getattr fallbacks), a minor rate-limiter typing fix, updated Playwright stealth usage, and a setup_wizard.py pyright ignore. Tests updated to async generators and aligned timeout-error construction.

Removed

  • UV references - Removed uv.lock and UV_* references from pyproject.toml, server.py, and start_server.py.
  • minimaxai/minimax-m3 from reasoning config - Dropped the Minimax entry from reasoning_config.json because the model was removed from the NVIDIA endpoint.

Files Touched

  • providers/provider.py - Inline thinking split logic; DeepSeek-V4 DSML parsing; retryable error handling.
  • providers/think_parser.py - split_think_content for separating CoT from content.
  • providers/dsml_parser.py - Rewritten DSML tool-call parsing for stream/buffered modes; _strip_residual_tags for dangling DSML tags.
  • api/optimization_handlers.py - Thinking and tool_use block emission in buffered→SSE conversion.
  • api/routes.py - SERVER_TYPE config fix.
  • providers/request.py - Force include_stop_str_in_output for deepseek-v4; budget sets max_tokens directly from session store; deepseek sends reasoning_effort in chat_template_kwargs; reasoning_budget sent only for nemotron/default styles; nimeffort combined format parsing.
  • api/swapper/parser.py - Nimeffort tag regex supports <nimeffort:level:budget> combined format; returns (level, budget) tuple.
  • api/routes.py - Nimeffort handler stores both effort level and budget from combined format; SERVER_TYPE config fix.
  • api/bot_protection.py - Localhost bypass.
  • api/routes.py - /v1/messages streaming (buffered → real-time SSE); _buffered_sse_generator and in-stream error handling; nimeffort combined-format handler.
  • providers/header_capture.py - Transport timeout/connection error capture and failure logging.
  • reasoning_config.json - Renamed model key to deepseek-v4-pro-0813 with explicit token budgets; disabled forced thinking flag; added moonshotai/kimi-k3 with kimi thinking style; removed minimaxai/minimax-m3 (dropped from endpoint).
  • tests/test_stream_retry_dedup.py - Tests for stream retry, truncation, _format_error_detail/_timeout_subtype/_req_ctx.
  • pyproject.toml, server.py, start_server.py, uv.lock - UV reference removal.
  • tests/test_think_split.py, tests/test_optimization_sse.py, tests/test_dsml_parser.py - New/updated tests.
  • nimbus_linux.spec - Hidden imports update.
  • BUILD_LINUX_BINARY.md - Build documentation.
  • config/settings.py - SERVER_TYPE default stream → buffer; reasoning-config module-cache assignment fix.
  • providers/provider.py - _fresh_tool_id() unique tool_use id minting (Kimi-k3 deadlock fix); _keepalive AsyncGenerator typing.
  • api/routes.py, api/bot_protection.py - Keyless GET /api/hello endpoint; localhost failed-attempt exemption.
  • api/optimization_handlers.py - Default response id (msg_*) / model (unknown) for mocked SSE.
  • providers/sse_builder.py - Standalone sse_content_block_stop helper.
  • providers/request_queue.py - Removed duplicate get_stats method.
  • reasoning_config.json - kimi-k3 explicit effort→budget mapping.
  • discord_bot/bot.py, discord_bot/cog.py, discord_bot/views.py, discord_bot/rate_limit.py - Type-safety/channel hardening.
  • websearch/duckduckgo_html.py - Updated Playwright stealth usage.
  • setup_wizard.py - pyright ignore.
  • tests/test_stream_retry_dedup.py - Async-generator tests, timeout-error alignment.