Skip to content

fix: improve Telegram gateway error reporting and connection reliability#9223

Merged
michaelneale merged 1 commit into
mainfrom
fix/7826-telegram-error-reporting
May 18, 2026
Merged

fix: improve Telegram gateway error reporting and connection reliability#9223
michaelneale merged 1 commit into
mainfrom
fix/7826-telegram-error-reporting

Conversation

@DOsinga
Copy link
Copy Markdown
Collaborator

@DOsinga DOsinga commented May 14, 2026

Summary

Fixes #7826 — Telegram gateway fails with the unhelpful error error sending request for url after successfully validating the bot token.

Two root causes addressed:

  1. HTTP/2 long-polling issues: reqwest's default HTTP/2 support has known problems with long-lived connections (especially Telegram's 30s long-poll). Switching to http1_only() avoids these.

  2. Vague error logging: The poll error was logged with Display format (%e) which only shows the top-level reqwest error. Switching to Debug format (?e) prints the full error source chain (TLS failures, connection resets, DNS issues, etc.), making future reports actionable.

Also adds an explicit connect_timeout(10s) separate from the overall request timeout so stuck TCP connections fail fast instead of hanging for 40s.

Changes

  • crates/goose/src/gateway/telegram.rs: Use Client::builder() with http1_only() and connect_timeout(10s); log poll errors with ?e instead of %e

- Use http1_only() to avoid HTTP/2 long-polling issues with reqwest
- Add explicit connect_timeout (10s) separate from the request timeout
- Log poll errors with Debug format (?e) to include the full error chain

Fixes #7826

Signed-off-by: Douwe Osinga <douwe@squareup.com>
Copy link
Copy Markdown
Collaborator

@jh-block jh-block left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reqwest's default HTTP/2 support has known problems with long-lived connections

[citation needed]! Are there some references for these known problems? I worry that we might be baking in a workaround for a problem with a better solution

the timeout and error fix seem obviously great, and if the HTTP/2 thing has a better solution we can follow up to turn it back on with that solved

@DOsinga
Copy link
Copy Markdown
Collaborator Author

DOsinga commented May 17, 2026

@michaelneale can you have a look?

Copy link
Copy Markdown
Collaborator

@michaelneale michaelneale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ok

@michaelneale michaelneale added this pull request to the merge queue May 18, 2026
Merged via the queue into main with commit 2eb4685 May 18, 2026
37 of 43 checks passed
@michaelneale michaelneale deleted the fix/7826-telegram-error-reporting branch May 18, 2026 02:15
lifeizhou-ap added a commit that referenced this pull request May 18, 2026
* main:
  fix(desktop): eliminate cross-window deep link contamination (#9273)
  fix: improve Telegram gateway error reporting and connection reliability (#9223)
  fix(cli): enable VT processing on Windows Console Host (#9248)
michaelneale added a commit that referenced this pull request May 19, 2026
* origin/main: (160 commits)
  Add Linux musl CLI builds (#9240)
  feat(acp): paginate session list (#9199)
  docs: reorganize (#9310)
  Structured per-provider config block, non-destructive provider switching (#8977)
  feat(cli): add `goose review` local code review command (#9114)
  feat(tui): diff viewer (#9260)
  fix(otel): emit trace_output as span attribute instead of event (#9255)
  docs: add guide for connecting goose Desktop to a remote goosed server (#9275)
  fix(config): check file fallback when keyring has no entry (#9279)
  fix(desktop): ScheduleModal error message styling (#9278)
  fix(ui): align sidebar hamburger in macOS fullscreen (#9257)
  Add documentation for new provider SaladCloud AI Gateway (#9253)
  fix: use current_exe() instead of PATH lookup when spawning goose (#9236)
  fix(extension_manager): set TCP_USER_TIMEOUT on streamable HTTP clients (#9207)
  fix: activate custom provider after adding via configure (#9213)
  Flush OTLP traces reliably on exit with configurable timeout (#9228)
  fix: reduce excessive MISSING_TRANSLATION warnings for fallback locales (#9294)
  feat(acp): pass session cwd param to acp providers (#9229)
  fix(desktop): eliminate cross-window deep link contamination (#9273)
  fix: improve Telegram gateway error reporting and connection reliability (#9223)
  ...

Signed-off-by: Michael Neale <michael.neale@gmail.com>

# Conflicts:
#	crates/goose/src/agents/agent.rs
#	crates/goose/tests/agent.rs
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.

Telegram Gateway - "error sending request for url" to Telegram API**

3 participants