Skip to content

fix(agent): восстановить NVIDIA GLM-5.1 после пустого stream#677

Merged
xlabtg merged 3 commits into
xlabtg:mainfrom
konard:issue-676-61e795d703ef
Jun 20, 2026
Merged

fix(agent): восстановить NVIDIA GLM-5.1 после пустого stream#677
xlabtg merged 3 commits into
xlabtg:mainfrom
konard:issue-676-61e795d703ef

Conversation

@konard

@konard konard commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Fixes #676

Что изменено

  • Сохранил NVIDIA GLM-5.1 на OpenAI-compatible Chat Completions endpoint с native tools, без возврата к text-only режиму.
  • После трёх обычных retry для пустого streaming ответа с нулевым usage runtime делает один provider-specific recovery retry: добавляет системную инструкцию продолжить тот же запрос и вернуть tool calls или финальный текст.
  • Счётчики empty-response retry сбрасываются после любого осмысленного ответа, поэтому recovery работает и после промежуточных tool calls.
  • Диагностика про недоступность Public API Endpoints остаётся как fallback, если recovery не помог.

Почему так

NVIDIA для z-ai/glm-5.1 документирует streaming и tool calling в API, поэтому исправление не отключает native tools, а обрабатывает пустой stream как recoverable provider edge case.

Ссылки:

Как воспроизведено

Добавлен тест, где NVIDIA GLM-5.1 возвращает четыре пустых zero-token stream responses подряд. Раньше runtime падал на диагностике после стандартных retry; теперь пятая попытка получает recovery prompt и может вернуть нормальный ответ.

Проверка

  • npm ci
  • npx vitest run src/agent/__tests__/runtime-retry.test.ts src/agent/__tests__/runtime-utils.test.ts src/providers/__tests__/nvidia-glm-tools.test.ts
  • npm run format:check
  • npm run lint
  • npm run build:sdk
  • npm run typecheck
  • npm test

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: xlabtg#676
@konard konard changed the title [WIP] Errors when working with GLM 5.1 from NVIDIA fix(agent): восстановить NVIDIA GLM-5.1 после пустого stream Jun 20, 2026
@konard konard marked this pull request as ready for review June 20, 2026 18:29
@konard

konard commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator Author

Working session summary

Готово.

В PR #677 реализовал восстановление для случая, когда NVIDIA GLM-5.1 возвращает пустой streaming response с нулевым usage: runtime теперь после обычных retry делает одну дополнительную попытку с recovery-инструкцией в system prompt, не отключая native tools. Добавлены регрессионные тесты для самого сценария и unit-тесты helper-логики.

PR: #677
Финальный SHA: e17dc632cade6a5f534364a63d40feca5a746cac
Состояние: PR не draft, merge state CLEAN, рабочее дерево чистое.

Проверки прошли:

  • npx vitest run src/agent/__tests__/runtime-retry.test.ts src/agent/__tests__/runtime-utils.test.ts src/providers/__tests__/nvidia-glm-tools.test.ts
  • npm run format:check
  • npm run lint
  • npm run build:sdk
  • npm run typecheck
  • npm test
  • GitHub checks на PR прошли, skipped только ожидаемые jobs вроде E2E/notify/quality push.

This summary was automatically extracted from the AI working session output.

@konard

konard commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: GPT-5.5
  • Provider: OpenAI
  • Public pricing estimate: $14.148240

📊 Context and tokens usage:

  • 458.8K / 200K (229%) input tokens, 30.3K / 128K (24%) output tokens

Total: (458.8K + 8.2M cached) input tokens, 30.3K output tokens, $14.148240 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-5.5
  • Thinking level: max (~31999 tokens)
  • Model: GPT-5.5 (gpt-5.5)

📎 Log file uploaded as Repository (39658KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator Author

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@xlabtg xlabtg merged commit b2256c0 into xlabtg:main Jun 20, 2026
30 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.

Errors when working with GLM 5.1 from NVIDIA

2 participants