Skip to content

Conversation

@spoons-and-mirrors
Copy link

@spoons-and-mirrors spoons-and-mirrors commented Jan 21, 2026

image

probably slop, but tested with antigrav accounts and worked


Important

Adds manual account selection feature to proxy, allowing users to force specific credentials for requests via a new endpoint and TUI updates.

  • Behavior:
    • Adds /v1/force-credential endpoint in main.py to force a specific credential for all requests, overriding normal rotation logic.
    • Supports clearing the forced credential to resume normal rotation.
  • TUI:
    • Updates show_provider_detail_screen() in quota_viewer.py to allow forcing and clearing credentials via numeric selection.
  • Usage Management:
    • Adds set_forced_credential() and get_forced_credential() in usage_manager.py to manage forced credential state.
    • Modifies acquire_key() in usage_manager.py to check and use forced credentials if set.

This description was created by Ellipsis for fa2e987. You can customize this summary. It will automatically update as commits are pushed.

@mirrobot-agent
Copy link
Contributor

I'm starting my review of the manual account selection feature. Diving into the new rotation logic and TUI changes now.

Copy link
Contributor

@mirrobot-agent mirrobot-agent bot left a comment

Choose a reason for hiding this comment

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

Overall Assessment

This is a solid implementation of manual account selection. The feature is well-integrated into the TUI and respects existing usage/cooldown constraints. The addition of the /v1/force-credential endpoint is a clean way to handle this override.

Architectural Feedback

The choice to handle the force logic at the beginning of acquire_key is correct as it allows you to reuse all the existing cooldown and concurrency checks. Falling back to normal rotation is a pragmatic choice to maintain proxy uptime, though it might surprise a user who expected a "hard lock".

Key Suggestions

  • Path Handling: Use pathlib in main.py for cleaner display name extraction.
  • Matching Logic: Be aware of potential ambiguity when matching by basename if multiple files share a name.
  • TUI Efficiency: Consider persisting the httpx.Client in QuotaViewer.

Questions for the Author

  • Was there a specific scenario where you found basename matching necessary over using the full path?
  • Should the "forced" state be persisted across proxy restarts, or is it intentionally transient?

This review was generated by an AI assistant.

if credential:
# Extract a friendly display name from the credential path
if "/" in credential or "\\" in credential:
display_name = credential.split("/")[-1].split("\\")[-1]
Copy link
Contributor

Choose a reason for hiding this comment

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

This path splitting logic is a bit brittle. Consider using Path(credential).name from pathlib for a more robust cross-platform solution.

Suggested change
display_name = credential.split("/")[-1].split("\\")[-1]
display_name = Path(credential).name

Comment on lines +2209 to +2213
# Try matching by filename (basename)
for key in available_keys:
if key.endswith(forced_cred) or Path(key).name == forced_cred:
matched_cred = key
break
Copy link
Contributor

Choose a reason for hiding this comment

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

Matching by basename (filename) could be ambiguous if multiple credentials have the same filename in different directories. While probably rare, it might be safer to prioritize exact matches (which you already do) and perhaps log a warning if multiple basename matches are found.

Comment on lines +997 to +1002
with httpx.Client(timeout=10.0) as http_client:
response = http_client.post(
url,
headers=self._get_headers(),
json=payload
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Creating a new httpx.Client for every request in a loop is slightly inefficient. For a TUI it likely doesn't matter, but using a single client instance for the QuotaViewer session might be cleaner for the long term.

Comment on lines +2244 to +2257
lib_logger.warning(
f"Forced credential {mask_credential(matched_cred)} is at max concurrency "
f"({current_count}/{max_concurrent}), falling back to normal rotation"
)
else:
lib_logger.warning(
f"Forced credential {mask_credential(matched_cred)} is on cooldown, "
f"falling back to normal rotation"
)
else:
lib_logger.warning(
f"Forced credential {mask_credential(forced_cred)} not found in available credentials, "
f"falling back to normal rotation"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

The fallback to normal rotation when a forced credential is on cooldown or at max concurrency is a safe choice for availability. However, if a user forces a credential, they might prefer a clear error if it can't be used. Since the TUI mentions "(if available)", this behavior is at least documented, but it's worth considering if a stricter 'force' is needed.

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.

1 participant