Skip to content

feat: port signing fix, tool emulation, retry, circuit breaker, UI + docs#5

Open
mingles-agent wants to merge 3 commits intomainfrom
feature/1-port-signing-tools-retry-cb
Open

feat: port signing fix, tool emulation, retry, circuit breaker, UI + docs#5
mingles-agent wants to merge 3 commits intomainfrom
feature/1-port-signing-tools-retry-cb

Conversation

@mingles-agent
Copy link
Copy Markdown

Closes #1 in gonka-proxy-service.

What's changed

1. Signing fix — app/gonka_client.py

  • Added encode_with_low_s() as a standalone function for clean low-S ECDSA normalization
  • Added stream_read_timeout parameter (default 300s) to avoid stream cutoffs on long generations
  • Updated _sign_payload to use Phase 3 signing: SHA-256 hash of payload → input for signature (matches private repo)
  • No multi-node/DB/cluster code ported

2. Tool emulation — app/tool_emulation.py

  • Full port of tool emulation module (no DB dependencies)
  • Supports JSON format ({"tool_calls": [...]}) and XML format (<tool_call>...</tool_call>)
  • Handles both streaming and non-streaming response paths
  • Also ports test_tool_emulation.py with adapted imports

3. Retry — app/retry.py

  • Full port of retry utilities with exponential backoff + jitter
  • retry_with_backoff, retry_with_backoff_args, RetryConfig, predefined configs

4. Circuit breaker — app/circuit_breaker.py

  • Full port of circuit breaker implementation
  • CLOSED → OPEN after 5 failures, 60s recovery timeout, HALF_OPEN after timeout

5. UI — app/static/index.html

  • Updated UI from private repo
  • All mingles.ai references replaced with localhost:8000

6. Wired into main.py

  • Tool emulation applied transparently: if tools in request → emulate, parse response back to OpenAI format
  • Circuit breaker + retry wrap non-streaming GonkaClient calls
  • GONKA_STREAM_READ_TIMEOUT env var exposed in Settings
  • /health endpoint now includes circuit breaker state

7. README.md

  • Complete rewrite: self-hosted setup, all env vars with descriptions, Docker run example
  • Removed 👉 https://gonka-gateway.mingles.ai/ line
  • No mingles.ai references anywhere in the repo

Acceptance criteria

  • ✅ Starts with minimal .env (no MongoDB): GONKA_PRIVATE_KEY, GONKA_ADDRESS, GONKA_ENDPOINT, GONKA_PROVIDER_ADDRESS, API_KEY
  • ✅ Tool emulation wired in: falls back to prompt-based emulation if model doesn't support tools natively
  • ✅ Circuit breaker and retry wrap GonkaClient calls
  • ✅ README clean and sufficient for self-hosted setup
  • ✅ No mingles.ai URLs in public repo

MinglesAI added 3 commits March 31, 2026 10:31
…docs

- gonka_client.py: add encode_with_low_s() standalone function, stream_read_timeout
  parameter, updated signing to hash payload before signing (Phase 3 signing)
- tool_emulation.py: port tool emulation module (no DB deps); supports JSON and
  <tool_call> XML formats, streaming and non-streaming paths
- retry.py: port retry utilities with exponential backoff
- circuit_breaker.py: port circuit breaker (5-failure threshold, 60s recovery)
- main.py: wire tool emulation, circuit breaker, retry into chat completions;
  GONKA_STREAM_READ_TIMEOUT setting; circuit breaker state in /health
- app/static/index.html: updated UI from private repo, no mingles.ai references
- test_tool_emulation.py: port test suite with adapted imports
- README.md: clean self-hosted docs, all env vars, Docker example, removed
  gonka-gateway.mingles.ai link

Closes #1
- Remove Google OAuth login button and flow
- Remove Keplr/Leap wallet connect button and flow
- Remove balance display, deposit button, logout button
- Remove Dashboard, API Keys, Transactions pages/nav
- Remove session management (saveSession/loadSession/clearSession)
- Remove billing/balance docs section
- Remove GNK price display and token cost tracking
- Add API key input field in Chat (env-var key for proxy access)
- Simplify sendChatMessage to read key from input
- Fix footer: CloudMine URL → https://cloudmine.mingles.ai/
- Fix footer: remove Support (t.me) link
- Fix footer: add Gateway link → https://gonka-gateway.mingles.ai/
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.

feature request: docker-compose.yaml

1 participant