Skip to content

Implement ProxyManager fallback routing#80

Merged
xlabtg merged 4 commits intomainfrom
issue-8-daf32065dc8d
Apr 25, 2026
Merged

Implement ProxyManager fallback routing#80
xlabtg merged 4 commits intomainfrom
issue-8-daf32065dc8d

Conversation

@konard
Copy link
Copy Markdown
Collaborator

@konard konard commented Apr 25, 2026

Summary

  • Add a foundation ProxyManager for direct, MTProto, and SOCKS5 route selection from health inputs.
  • Persist proxy preferences through the existing settings model so invalid entries and raw secrets are rejected.
  • Document the new capability and add unit coverage for direct preference, proxy fallback order, and secure-reference validation.

Reproduction and Verification

  • Reproduced the missing behavior with new ProxyManager unit tests covering deterministic fallback and persistence.

teleton-client@0.1.0 test
node --test test/*.test.mjs

TAP version 13

Subtest: foundation artifacts required by issue 1 are present

ok 1 - foundation artifacts required by issue 1 are present

duration_ms: 1.209536
...

Subtest: CODEOWNERS routes high-risk repository areas to human maintainers

ok 2 - CODEOWNERS routes high-risk repository areas to human maintainers

duration_ms: 4.70129
...

Subtest: GitHub templates collect reproducible, secret-free contribution details

ok 3 - GitHub templates collect reproducible, secret-free contribution details

duration_ms: 3.358334
...

Subtest: pre-commit hook is installable and runs deterministic local checks

ok 4 - pre-commit hook is installable and runs deterministic local checks

duration_ms: 1.473411
...

Subtest: epic backlog decomposes issue 1 into prioritized phases

ok 5 - epic backlog decomposes issue 1 into prioritized phases

duration_ms: 1.691546
...

Subtest: agent autonomy modes match the epic acceptance criteria

ok 6 - agent autonomy modes match the epic acceptance criteria

duration_ms: 1.264468
...

Subtest: proxy settings model covers MTProto and SOCKS5 without hardcoded secrets

ok 7 - proxy settings model covers MTProto and SOCKS5 without hardcoded secrets

duration_ms: 6.771682
...

Subtest: proxy manager prefers direct connectivity when direct health is reachable

ok 8 - proxy manager prefers direct connectivity when direct health is reachable

duration_ms: 1.998805
...

Subtest: proxy manager falls back through active MTProto and SOCKS5 proxy health

ok 9 - proxy manager falls back through active MTProto and SOCKS5 proxy health

duration_ms: 0.373448
...

Subtest: proxy manager persists validated user proxy preferences without raw secrets

ok 10 - proxy manager persists validated user proxy preferences without raw secrets

duration_ms: 0.570771
...

Subtest: package version is the documented release metadata source of truth

ok 11 - package version is the documented release metadata source of truth

duration_ms: 5.036691
...

Subtest: semantic version validation rejects prerelease, build metadata, and invalid bumps

ok 12 - semantic version validation rejects prerelease, build metadata, and invalid bumps

duration_ms: 1.291869
...

Subtest: release workflow does not publish from pull request events

ok 13 - release workflow does not publish from pull request events

duration_ms: 1.894489
...

Subtest: settings defaults are serializable and keep agent and proxy disabled

ok 14 - settings defaults are serializable and keep agent and proxy disabled

duration_ms: 2.160495
...

Subtest: settings validation rejects invalid proxy, notification, agent, and secret preferences

ok 15 - settings validation rejects invalid proxy, notification, agent, and secret preferences

duration_ms: 0.634488
...

Subtest: settings model produces valid platform snapshots for every wrapper

ok 16 - settings model produces valid platform snapshots for every wrapper

duration_ms: 1.115566
...

Subtest: settings migration upgrades legacy payloads and rejects unsupported future schemas

ok 17 - settings migration upgrades legacy payloads and rejects unsupported future schemas

duration_ms: 0.333238
...

Subtest: TDLib adapter contract declares supported platform callers

ok 18 - TDLib adapter contract declares supported platform callers

duration_ms: 1.321552
...

Subtest: TDLib authentication rejects raw Telegram credentials and accepts secure references

ok 19 - TDLib authentication rejects raw Telegram credentials and accepts secure references

duration_ms: 0.826074
...

Subtest: mock TDLib adapter covers chat list, message send, and update subscription without live credentials

ok 20 - mock TDLib adapter covers chat list, message send, and update subscription without live credentials

duration_ms: 1.408232
...

Subtest: TDLib client adapter validates bridge inputs before native calls

ok 21 - TDLib client adapter validates bridge inputs before native calls

duration_ms: 0.402471
...

Subtest: TDLib build targets, licensing, and adapter boundary are documented

ok 22 - TDLib build targets, licensing, and adapter boundary are documented

duration_ms: 5.323929
...
1..22

tests 22

suites 0

pass 22

fail 0

cancelled 0

skipped 0

todo 0

duration_ms 71.312892

teleton-client@0.1.0 validate:foundation
node scripts/validate-foundation.mjs

Foundation validation passed for 63 subtasks.

teleton-client@0.1.0 validate:release
node scripts/validate-release.mjs

Release validation passed for teleton-client@0.1.0.

teleton-client@0.1.0 decompose:dry-run
node scripts/decompose-epic.mjs --dry-run

Repository: xlabtg/Teleton-Client
Parent issue: #1
Issues to create: 63
01 [001] Configure repository structure, CI, linters, and pre-commit
phase: Infrastructure and Core
labels: foundation, infrastructure, ci, ai-solvable, good first issue
published: #5 #5
02 [002] Integrate TDLib build plan and baseline client adapter
phase: Infrastructure and Core
labels: tdlib, foundation, ai-solvable
published: #6 #6
03 [003] Implement cross-platform settings model
phase: Infrastructure and Core
labels: settings, foundation, ai-solvable
published: #7 #7
04 [004] Configure pre-commit hooks for code checks
phase: Infrastructure and Core
labels: infrastructure, ci, ai-solvable, good first issue
published: #33 #33
05 [005] Add pull request and issue templates
phase: Infrastructure and Core
labels: documentation, infrastructure, ai-solvable, good first issue
published: #34 #34
06 [006] Configure automated semantic versioning
phase: Infrastructure and Core
labels: release, ci, infrastructure, ai-solvable
published: #35 #35
07 [007] Add CODEOWNERS for automatic reviewer assignment
phase: Infrastructure and Core
labels: infrastructure, human-review-required
published: #36 #36
08 [008] Create CONTRIBUTING.md with contributor guidelines
phase: Infrastructure and Core
labels: documentation, infrastructure, ai-solvable, good first issue
published: #37 #37
09 [009] Configure automated changelog generation
phase: Infrastructure and Core
labels: documentation, release, ci, ai-solvable
published: #38 #38
10 [010] Implement ProxyManager detection, fallback, and persistence
phase: Connectivity Layer
labels: proxy, connectivity, ai-solvable
published: #8 #8
11 [011] Integrate MTProto and SOCKS5 proxy settings with TDLib
phase: Connectivity Layer
labels: tdlib, proxy, connectivity, ai-solvable
published: #9 #9
12 [012] Build proxy settings UI for add, test, enable, and disable
phase: Connectivity Layer
labels: ui, proxy, connectivity, ai-solvable
published: #10 #10
13 [013] Add connection quality indicator UI
phase: Connectivity Layer
labels: ui, connectivity, ai-solvable
published: #39 #39
14 [014] Add network error logging
phase: Connectivity Layer
labels: connectivity, proxy, ai-solvable
published: #40 #40
15 [015] Auto-select the fastest proxy from configured entries
phase: Connectivity Layer
labels: proxy, connectivity, ai-solvable
published: #41 #41
16 [016] Add HTTP CONNECT proxy support
phase: Connectivity Layer
labels: proxy, connectivity, tdlib, ai-solvable
published: #42 #42
17 [017] Add speed tests for each proxy
phase: Connectivity Layer
labels: proxy, testing, connectivity, ai-solvable
published: #43 #43
18 [018] Add proxy usage statistics
phase: Connectivity Layer
labels: proxy, connectivity, privacy, ai-solvable
published: #44 #44
19 [019] Curate optional public MTProto proxy catalog
phase: Connectivity Layer
labels: proxy, connectivity, human-review-required
published: #45 #45
20 [020] Configure local Teleton Agent runtime on all platforms
phase: Teleton Agent Integration
labels: agent, runtime, ai-solvable
published: #11 #11
21 [021] Implement IPC bridge for agent events and UI notifications
phase: Teleton Agent Integration
labels: agent, ipc, ai-solvable
published: #12 #12
22 [022] Build agent settings screen for mode, model, privacy, and action limits
phase: Teleton Agent Integration
labels: agent, settings, ui, ai-solvable
published: #13 #13
23 [023] Encrypt local agent memory through OS secure storage
phase: Teleton Agent Integration
labels: agent, security, privacy, ai-solvable
published: #14 #14
24 [024] Implement Teleton Agent plugin system
phase: Teleton Agent Integration
labels: agent, ai-solvable
published: #46 #46
25 [025] Add custom LLM provider support
phase: Teleton Agent Integration
labels: agent, settings, ai-solvable
published: #47 #47
26 [026] Implement agent configuration export and import
phase: Teleton Agent Integration
labels: agent, settings, privacy, ai-solvable
published: #48 #48
27 [027] Add agent resource monitoring for CPU and memory
phase: Teleton Agent Integration
labels: agent, runtime, ai-solvable
published: #49 #49
28 [028] Add notifications for agent actions
phase: Teleton Agent Integration
labels: agent, ui, ai-solvable
published: #50 #50
29 [029] Add reversible agent action history
phase: Teleton Agent Integration
labels: agent, security, ai-solvable
published: #51 #51
30 [030] Connect TON SDK adapter for basic wallet operations
phase: TON Blockchain Module
labels: ton, wallet, ai-solvable
published: #15 #15
31 [031] Integrate swap tools through STON.fi and DeDust adapters
phase: TON Blockchain Module
labels: ton, swap, agent, ai-solvable
published: #16 #16
32 [032] Build TON transaction confirmation UI
phase: TON Blockchain Module
labels: ton, ui, security, ai-solvable
published: #17 #17
33 [033] Add TON testnet coverage for wallet flows
phase: TON Blockchain Module
labels: ton, testing, ai-solvable
published: #18 #18
34 [034] Add NFT gallery support
phase: TON Blockchain Module
labels: ton, wallet, ui, ai-solvable
published: #52 #52
35 [035] Add TON staking through the client interface
phase: TON Blockchain Module
labels: ton, wallet, human-review-required
published: #53 #53
36 [036] Integrate TON DNS for domain names
phase: TON Blockchain Module
labels: ton, ai-solvable
published: #54 #54
37 [037] Add Jetton token support
phase: TON Blockchain Module
labels: ton, wallet, ai-solvable
published: #55 #55
38 [038] Implement filterable transaction history
phase: TON Blockchain Module
labels: ton, wallet, ui, ai-solvable
published: #56 #56
39 [039] Add multi-wallet support
phase: TON Blockchain Module
labels: ton, wallet, security, ai-solvable
published: #57 #57
40 [040] Implement Android wrapper for build, notifications, background work, and deep links
phase: Platform Wrappers
labels: android, platform, ai-solvable
published: #19 #19
41 [041] Implement iOS wrapper with Push, Keychain, and background tasks
phase: Platform Wrappers
labels: ios, platform, human-review-required
published: #20 #20
42 [042] Implement desktop wrapper with tray, shortcuts, and autostart
phase: Platform Wrappers
labels: desktop, platform, ai-solvable
published: #21 #21
43 [043] Design optional cross-device settings synchronization
phase: Platform Wrappers
labels: settings, sync, privacy, ai-solvable
published: #22 #22
44 [044] Implement responsive tablet UI
phase: Platform Wrappers
labels: ui, platform, ai-solvable
published: #58 #58
45 [045] Add web app support as a PWA
phase: Platform Wrappers
labels: platform, ui, ai-solvable
published: #59 #59
46 [046] Implement cross-device synchronization
phase: Platform Wrappers
labels: sync, platform, privacy, ai-solvable
published: #60 #60
47 [047] Add push notifications across platforms
phase: Platform Wrappers
labels: platform, ui, ai-solvable
published: #61 #61
48 [048] Add offline mode with later synchronization
phase: Platform Wrappers
labels: sync, platform, ai-solvable
published: #62 #62
49 [049] Add gesture and keyboard shortcut support
phase: Platform Wrappers
labels: ui, platform, desktop, ai-solvable
published: #63 #63
50 [050] Audit tokens, keys, rotation, and secure storage
phase: Security and Licenses
labels: security, privacy, human-review-required
published: #23 #23
51 [051] Verify licenses for TDLib, Telegram client references, Teleton Agent, and TON
phase: Security and Licenses
labels: license, compliance, human-review-required
published: #24 #24
52 [052] Publish privacy policy for local processing and data flows
phase: Security and Licenses
labels: privacy, documentation, human-review-required
published: #25 #25
53 [053] Implement two-factor authentication controls
phase: Security and Licenses
labels: security, settings, ai-solvable
published: #64 #64
54 [054] Add hardware security key support
phase: Security and Licenses
labels: security, human-review-required
published: #65 #65
55 [055] Create security audit system
phase: Security and Licenses
labels: security, compliance, human-review-required
published: #66 #66
56 [056] Implement automatic token refresh
phase: Security and Licenses
labels: security, ai-solvable
published: #67 #67
57 [057] Add encrypted message database storage
phase: Security and Licenses
labels: security, privacy, ai-solvable
published: #68 #68
58 [058] Implement secure data deletion
phase: Security and Licenses
labels: security, privacy, human-review-required
published: #69 #69
59 [059] Create SECURITY.md documentation
phase: Security and Licenses
labels: security, documentation, human-review-required
published: #70 #70
60 [060] Add unit tests for ProxyManager, TON adapter, and IPC bridge
phase: Testing and Release
labels: testing, ai-solvable
published: #26 #26
61 [061] Add end-to-end tests for auth, messaging, agent reply, and TON transaction
phase: Testing and Release
labels: testing, e2e, ai-solvable
published: #27 #27
62 [062] Build release packages for APK, IPA, DMG, EXE, and AppImage
phase: Testing and Release
labels: release, ci, human-review-required
published: #28 #28
63 [063] Prepare source publication, documentation, and release readiness
phase: Testing and Release
labels: release, documentation, human-review-required
published: #29 #29

Screenshots

Not applicable; this is a foundation connectivity-layer change with no UI.

Fixes #8

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

Issue: #8
@konard konard self-assigned this Apr 25, 2026
@konard konard changed the title [WIP] [010] Implement ProxyManager detection, fallback, and persistence Implement ProxyManager fallback routing Apr 25, 2026
@konard konard marked this pull request as ready for review April 25, 2026 05:42
@konard
Copy link
Copy Markdown
Collaborator Author

konard commented Apr 25, 2026

Solution summary

Implemented and pushed the ProxyManager work to PR 80: #80

What changed:

  • Added src/foundation/proxy-manager.mjs for direct, MTProto, and SOCKS5 route selection.
  • Uses existing settings validation so proxy preferences persist only with valid config and secure references.
  • Added unit tests for direct preference, deterministic proxy fallback, persistence, and raw-secret rejection.
  • Updated README and foundation coverage.

Validation:

  • npm test
  • npm run validate:foundation
  • npm run validate:release
  • npm run decompose:dry-run
  • Fresh GitHub CI and Release validation are passing on commit 69ec396.

PR 80 is now marked ready for review.


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

@konard
Copy link
Copy Markdown
Collaborator Author

konard commented Apr 25, 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: $2.228973

📊 Context and tokens usage:

  • 1.3M / 1.1M (124%) input tokens, 7.4K / 130K (6%) output tokens

Total: (66.0K + 1.2M cached) input tokens, 7.4K output tokens, $2.228973 cost

🤖 Models used:

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

📎 Log file uploaded as Gist (11806KB)


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

@konard
Copy link
Copy Markdown
Collaborator Author

konard commented Apr 25, 2026

🔄 Auto-restart triggered (iteration 1)

Reason: Merge conflicts detected

Starting new session to address the issues.


Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations.

@konard
Copy link
Copy Markdown
Collaborator Author

konard commented Apr 25, 2026

🔄 Auto-restart-until-mergeable Log (iteration 1)

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: $1.551172
  • Token usage: 70,480 input, 4,916 output, 625,152 cache read

🤖 Models used:

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

📎 Log file uploaded as Gist (17099KB)


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

@konard
Copy link
Copy Markdown
Collaborator Author

konard commented Apr 25, 2026

🔄 Auto-restart triggered (iteration 2)

Reason: Uncommitted changes detected

Starting new session to address the issues.


Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations.

@konard
Copy link
Copy Markdown
Collaborator Author

konard commented Apr 25, 2026

🔄 Auto-restart-until-mergeable Log (iteration 2)

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: $0.897433
  • Token usage: 44,246 input, 2,897 output, 324,608 cache read

🤖 Models used:

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

📎 Log file uploaded as Gist (20752KB)


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

@konard
Copy link
Copy Markdown
Collaborator Author

konard commented Apr 25, 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 xlabtg merged commit 0058c64 into main Apr 25, 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.

[010] Implement ProxyManager detection, fallback, and persistence

2 participants