Skip to content

fix : Tutorbot websocket resilience and CLI config parsing edge case#354

Merged
pancacake merged 1 commit intoHKUDS:devfrom
srinivasrk:srini/fix-websocket-reconnect
Apr 22, 2026
Merged

fix : Tutorbot websocket resilience and CLI config parsing edge case#354
pancacake merged 1 commit intoHKUDS:devfrom
srinivasrk:srini/fix-websocket-reconnect

Conversation

@srinivasrk
Copy link
Copy Markdown
Contributor

Description

This PR hardens TutorBot and CLI behavior across three failure modes that surfaced in local UI usage on Windows:

  • Prevents CLI crashes when --config-json is present but arrives as blank/whitespace by normalizing and treating it as {} before JSON parsing.
  • Improves TutorBot WebSocket startup by auto-starting a configured bot when a chat socket connects and the bot is currently not running.
  • Makes TutorBot WebSocket send/receive flow resilient to client disconnects so normal browser/tab closure does not cascade into noisy secondary exceptions.
  • Guards route param handling in the bot chat UI so botId is normalized safely and no API/WS calls are attempted with undefined.

Regression coverage was added for CLI parsing, TutorBot WS startup behavior, and web route-param normalization.

Related Issues

  • Closes #...
  • Related to #...

Module(s) Affected

  • agents
  • api
  • config
  • core
  • knowledge
  • logging
  • services
  • tools
  • utils
  • web (Frontend)
  • docs (Documentation)
  • scripts
  • tests
  • Other: cli

Checklist

  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run pre-commit run --all-files and fixed any issues.
  • I have added relevant tests for my changes.
  • I have updated the documentation (if necessary).
  • My changes do not introduce any new security vulnerabilities.

Additional Notes

Tests run locally:

  • uv run pytest tests/cli/test_common.py tests/api/test_tutorbot_router.py
  • node --test "web/tests/route-params.test.ts"

Key files touched:

  • deeptutor_cli/common.py
  • deeptutor/api/routers/tutorbot.py
  • web/app/(workspace)/agents/[botId]/chat/page.tsx
  • web/lib/route-params.ts
  • tests/cli/test_common.py
  • tests/api/test_tutorbot_router.py
  • web/tests/route-params.test.ts

Handle blank --config-json safely, auto-start bots on websocket connect, guard botId route param usage in UI,
and add regression tests for CLI/router/web param normalization.`
@pancacake pancacake merged commit 6735adf into HKUDS:dev Apr 22, 2026
4 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.

2 participants