Skip to content

fix(mtproto): route auth and show proxy health#412

Merged
xlabtg merged 4 commits intoxlabtg:mainfrom
konard:issue-411-dc2a6a3a2720
Apr 24, 2026
Merged

fix(mtproto): route auth and show proxy health#412
xlabtg merged 4 commits intoxlabtg:mainfrom
konard:issue-411-dc2a6a3a2720

Conversation

@konard
Copy link
Copy Markdown

@konard konard commented Apr 24, 2026

Summary

Fixes #411.

  • Route WebUI phone-code and QR Telegram authentication through configured MTProto proxies.
  • Reuse the existing MTProto proxy timeout/failover behavior for setup auth and disconnect failed proxy clients before trying the next one.
  • Pass managed personal-agent MTProto proxy config into the personal auth flow.
  • Keep direct connection fallback after all configured proxies fail, matching the existing runtime client behavior.
  • Add per-proxy MTProto status checks for the MRTPOTO config tab, including availability, connection latency, active proxy, and error details without returning proxy secrets.
  • Refresh proxy status from the WebUI and after saving proxy changes so users can validate configured servers from the config page.

Reproduction

Before this change, setup/auth GramJS clients did not receive configured MTProto proxies, so primary setup auth and managed personal-agent auth could bypass proxy settings. The MRTPOTO config tab also only showed the current runtime connection state and did not report whether each configured proxy server was reachable or how long the proxy check took.

Verification

  • npm test -- --run src/telegram/__tests__/mtproto-proxy-health.test.ts src/webui/__tests__/mtproto-routes.test.ts src/webui/__tests__/setup-auth-proxy.test.ts src/webui/__tests__/setup-routes.test.ts src/webui/__tests__/agents-routes.test.ts src/telegram/__tests__/client-proxy.test.ts src/bot/__tests__/gramjs-bot-proxy.test.ts
  • npm run build -w packages/sdk
  • npm run typecheck
  • npm run lint
  • npm run format:check
  • npm run build
  • npm test (3428 passed)
  • cd web && npm ci
  • npm run build:web
  • npm run audit:ci

Screenshot

MRTPOTO proxy health status

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

Issue: xlabtg#411
@konard konard changed the title [WIP] Check MRTPOTO fix(mtproto): route setup auth through proxies Apr 24, 2026
@konard konard marked this pull request as ready for review April 24, 2026 13:56
@konard
Copy link
Copy Markdown
Author

konard commented Apr 24, 2026

Solution summary

Implemented and pushed the fix in PR 412: #412

What changed:

  • WebUI Telegram setup auth now uses configured MTProto proxies for phone-code and QR auth.
  • Managed personal-agent auth now carries its MTProto proxy config into the auth flow.
  • Auth proxy attempts now use timeout/failover cleanup before trying the next proxy, then fall back to direct only after all proxies fail.
  • Added regression coverage in setup-auth, setup routes, managed-agent routes, and managed-agent service tests.

Verification passed:

  • Full test suite: 3422 passed
  • npm run typecheck
  • npm run lint
  • npm run format:check
  • npm run build
  • npm run audit:ci
  • Fresh CI for commit 5b6be7c is passing: runs 24893270044 and 24893270731.

Working tree is clean, and PR 412 is marked ready for review.


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

@konard
Copy link
Copy Markdown
Author

konard commented Apr 24, 2026

🤖 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: $10.225120

📊 Context and tokens usage:

  • 16.2M / 1.1M (1543%) input tokens, 32.9K / 130K (25%) output tokens

Total: (252.9K + 16.0M cached) input tokens, 32.9K output tokens, $10.225120 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-5.5
  • Model: GPT-5.5 (gpt-5.5)

📎 Log file uploaded as Repository (48475KB)


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

@konard
Copy link
Copy Markdown
Author

konard commented Apr 24, 2026

✅ 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
Copy link
Copy Markdown
Owner

xlabtg commented Apr 24, 2026

it was meant that on our config page there is an MRTPOTO tab where users add MTPROTO PROXY, but we tried adding several servers and booting it with this setting, in addition, there is no information in the web interface for each added proxy about its availability and ping so that the user can view information on proxy servers in real time, we should check the whole logic of this mechanism, since now the agent in some locations does not work without a VPN, and the proxy should close this issue of the agent's uninterrupted operation in any location.

@konard konard marked this pull request as draft April 24, 2026 14:13
@konard
Copy link
Copy Markdown
Author

konard commented Apr 24, 2026

🤖 AI Work Session Started

Starting automated work session at 2026-04-24T14:13:40.858Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback.

@konard konard changed the title fix(mtproto): route setup auth through proxies fix(mtproto): route auth and show proxy health Apr 24, 2026
@konard konard marked this pull request as ready for review April 24, 2026 14:30
@konard
Copy link
Copy Markdown
Author

konard commented Apr 24, 2026

Solution summary

Implemented the follow-up for issue #411 and updated PR 412:

#412

What changed:

  • Added live per-proxy MTProto health checks with availability, latency, active proxy, and error details.
  • Exposed those checks through /api/mtproto/status without returning proxy secrets.
  • Updated the MRTPOTO config tab to refresh and display proxy status/ping.
  • Added regression tests plus a committed screenshot for the PR description.

Verification:

  • Full local test suite: 3428 passed
  • typecheck, lint, format:check, build, build:web, and audit:ci passed
  • Fresh CI for commit 7518889 is green
  • PR 412 is marked ready for review
  • Working tree is clean

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

@konard
Copy link
Copy Markdown
Author

konard commented Apr 24, 2026

🤖 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: $10.318207

📊 Context and tokens usage:

  • 15.2M / 1.1M (1447%) input tokens, 35.7K / 130K (27%) output tokens

Total: (366.9K + 14.8M cached) input tokens, 35.7K output tokens, $10.318207 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-5.5
  • Model: GPT-5.5 (gpt-5.5)

📎 Log file uploaded as Repository (48106KB)


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

@konard
Copy link
Copy Markdown
Author

konard commented Apr 24, 2026

✅ 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
Copy link
Copy Markdown
Owner

xlabtg commented Apr 24, 2026

that is, now we have this picture in the logs:

[14:15:40] INFO: [Telegram] [MTProxy] Trying proxy 1/4
server: "peyk.acharbashi.info"
port: 443
Error: [Telegram] getMe() timed out — proxy may be unresponsive
[14:16:01] ERROR: [Telegram] Connection error
err: {
"type": "TelegramError",
"message": "[Telegram] getMe() timed out тАФ proxy may be unresponsive",
"stack":
TelegramError: [Telegram] getMe() timed out тАФ proxy may be unresponsive
at Timeout._onTimeout (file:///C:/Users/User/teleton-agent/dist/chunk-CDPVR6JZ.js:375:13)
at listOnTimeout (node:internal/timers:605:17)
at process.processTimers (node:internal/timers:541:7)
"code": "GET_ME_TIMEOUT",
"context": {
"timeoutMs": 15000
},
"name": "TelegramError"
}
[14:16:01] INFO: [Lifecycle] Agent state: stopped ([Telegram] getMe() timed out proxy may be unresponsive)

@xlabtg xlabtg merged commit 3f5bec3 into xlabtg:main Apr 24, 2026
18 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.

Check MRTPOTO

2 participants