Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(email): triage fails fast when Lemonade is unreachable#1678

Merged
kovtcharov-amd merged 3 commits into
mainfrom
autofix/issue-1677
Jun 15, 2026
Merged

fix(email): triage fails fast when Lemonade is unreachable#1678
kovtcharov-amd merged 3 commits into
mainfrom
autofix/issue-1677

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Before: with no Lemonade Server running, POST /v1/email/triage hung ~30s (until the caller's HTTP timeout) before any error reached the client — "server down" looked like "server slow." After: it returns a prompt HTTP 502 within a couple seconds, naming that Lemonade isn't reachable and how to start it.

Root cause: the triage chat path's request timeout is a 900s scalar (right for long generation), but a scalar requests timeout also caps the TCP connect — so an unreachable server blocked on the OS-level SYN timeout (~30s) before failing. The fix adds a fast pre-flight /health probe with a short connect timeout in EmailTriageService._build_llm_chat; a connection/timeout failure raises LLMTriageError, which the route already maps to 502. Any HTTP response (even an error status) still counts as "reachable," so auth/model errors keep surfacing on the real chat call where their messages are specific. Fully contained to the email hub package — no change to the shared Lemonade client.

Closes #1677

Test plan

  • python -m pytest hub/agents/python/email/tests/test_email_agent.py passes (incl. new test_triage_fails_fast_when_lemonade_unreachable)
  • python -m pytest tests/unit/ -x passes (5640 passed)
  • python util/lint.py --all passes
  • With no Lemonade running, boot the email REST surface (gaia api) and POST /v1/email/triage with a valid single-message body — confirm a 502 local LLM triage failed: Local Lemonade Server is not reachable … returns within ~1–3s instead of hanging ~30s.

POST /v1/email/triage hung ~30s when no Lemonade Server was running: the
chat path's 900s scalar request timeout also governs the TCP connect, so an
unreachable server blocked on the OS SYN timeout before erroring. Add a
pre-flight /health probe with a short connect timeout in _build_llm_chat so
'server down' surfaces as a prompt, actionable HTTP 502 instead of a hang.

Closes #1677
@kovtcharov-amd kovtcharov-amd added this pull request to the merge queue Jun 15, 2026
Merged via the queue into main with commit 4546e11 Jun 15, 2026
20 checks passed
@kovtcharov-amd kovtcharov-amd deleted the autofix/issue-1677 branch June 15, 2026 22:02
github-merge-queue Bot pushed a commit that referenced this pull request Jun 16, 2026
## Why this matters

Before: every PR touching `hub/agents/python/**` (or `setup.py`) kicked
off `publish_agents.yml`'s `Discover Agent Packages` + `build` matrix,
rebuilding **all** agent wheels just to twine-check them — on #1678, an
email-only fix triggered the full agent-wheel matrix. And since PyPI
publishing is paused (#1179), the workflow never actually published
anything, so on PRs it was pure noise.

After: the workflow is tag-driven — it fires on `v*` tags (plus
`workflow_dispatch`), never on PRs. Broken wheels surface at release
time instead of on every PR.

Publishing **stays paused**: the `approve-publish`/`publish` jobs keep
their `false &&` gates, so a `v*` tag builds + twine-checks the wheels
but uploads nothing to PyPI. Re-enabling later is just dropping those
gates — the tag trigger is now already in place.

## Test plan

- [ ] Open/sync a PR touching `hub/agents/python/**` → `Discover Agent
Packages` and `build` checks no longer appear.
- [ ] `python -c "import yaml;
yaml.safe_load(open('.github/workflows/publish_agents.yml'))"` parses
clean (verified locally).
- [ ] On a future `v*` tag, the build matrix runs and
`approve-publish`/`publish` remain skipped (paused).

Co-authored-by: Ovtcharov <[email protected]>
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.

[email] triage hangs ~30s when Lemonade is unreachable — should fail fast + loud

1 participant