Skip to content

fix: demo stub robustness — DB timeout, encoding, connectivity#119

Merged
Wool-xing merged 1 commit into
mainfrom
fix/demo-stub-robustness
May 16, 2026
Merged

fix: demo stub robustness — DB timeout, encoding, connectivity#119
Wool-xing merged 1 commit into
mainfrom
fix/demo-stub-robustness

Conversation

@Wool-xing
Copy link
Copy Markdown
Owner

Summary

  • Fix tagent demo hanging indefinitely when PostgreSQL is unavailable
  • Demo now completes in ~38s (stub mode, no real LLM cost)

Changes

  1. _is_postgres() — check actual DB connectivity with 3s timeout, not just SQLAlchemy dialect
  2. tool_search_similar() — catch connection errors gracefully, return error dict instead of crashing
  3. run_script() — use UTF-8 encoding + PYTHONIOENCODING=utf-8 for subprocess (fixes GBK decode errors on Windows)
  4. get_engine() — set connect_timeout=5 for psycopg to avoid 30s default timeout

Test plan

  • tagent demo completes with exit 0, all 4 steps pass
  • 128 tests pass, 0 failures
  • Pre-commit hooks all pass
  • 9/9 DAG nodes ok (stub LLM)

…checks

- _is_postgres(): check actual connectivity with 3s timeout, not just dialect
- tool_search_similar(): catch DB connection errors, return error dict
- run_script(): use UTF-8 encoding + PYTHONIOENCODING=utf-8 for subprocess
- get_engine(): set connect_timeout=5 for psycopg to avoid long hangs

Fixes tagent demo hanging on unavailable PostgreSQL and GBK encoding
errors on Windows. Demo now completes in ~38s (was infinite hang).
@Wool-xing Wool-xing merged commit 884e8e6 into main May 16, 2026
13 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