Skip to content

feat(agent): add credential pool selection strategies and state persistence#64

Merged
Tuanzi1015 merged 1 commit into
MLT-OSS:mainfrom
lml2468:feat/agent-credential-pool-strategies
Apr 11, 2026
Merged

feat(agent): add credential pool selection strategies and state persistence#64
Tuanzi1015 merged 1 commit into
MLT-OSS:mainfrom
lml2468:feat/agent-credential-pool-strategies

Conversation

@lml2468
Copy link
Copy Markdown
Contributor

@lml2468 lml2468 commented Apr 11, 2026

What does this PR do?

Extend the credential rotation system with multiple selection strategies, per-credential usage tracking, state persistence, and distinct quota (402) vs rate limit (429) handling.

Related Issue

Fixes #52

Type of Change

  • ✨ New feature (non-breaking change that adds functionality)

Changes Made

File Change
internal/agent/credential_rotation.go Add 4 strategies, usage counters, state persistence, quota handling
internal/agent/credential_rotation_test.go Comprehensive tests for all strategies and persistence
internal/agent/credentials.go Update credential pool to support new strategy config

How to Test

  1. Build: go build -o hermes ./cmd/hermes/
  2. Run tests: go test ./internal/agent/ -v -run Credential

Build & Test Verification

  • go build ./cmd/hermes/ — compiles without errors
  • go test ./... — all tests pass
  • go vet ./... — no issues
  • New code has test coverage
  • Commit messages follow Conventional Commits

…stence

- Add fill_first, random, least_used strategies alongside existing round_robin
- Add per-credential usage counters for least_used strategy
- Add provider state persistence to ~/.hermes/credential_state.json
- Distinguish 402 quota (24h cooldown) from 429 rate limit (1h cooldown)
- Make strategy configurable via config

Fixes MLT-OSS#52
@Tuanzi1015 Tuanzi1015 merged commit 3761f31 into MLT-OSS:main Apr 11, 2026
7 of 8 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.

[Feature]: Credential pool selection strategies and state persistence

3 participants