Repository navigation
feat(remote): support admin tokens - #651
Conversation
|
Warning Review limit reached
More reviews will be available in 25 minutes and 36 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds ChangesAdmin Credential Support for Remote Endpoints
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
coding-agent/tests/cli/test_remote_client.py (1)
1663-1668: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert
remote listauth labels per remote row.These checks only prove the four substrings appear somewhere in
listed.output. Ifremote listaccidentally swaps theuser-auth/admin-authcombinations betweendirectandenv, this test still passes. Tie the expected labels to each remote's line instead of asserting them independently.Suggested tightening
assert listed.exit_code == 0 - assert "direct" in listed.output - assert "env" in listed.output - assert "user-auth=token" in listed.output - assert "user-auth=no-token" in listed.output - assert "admin-auth=admin-token" in listed.output - assert "admin-auth=admin-token-env" in listed.output + lines = listed.output.splitlines() + assert any( + "direct" in line + and "user-auth=token" in line + and "admin-auth=admin-token" in line + for line in lines + ) + assert any( + "env" in line + and "user-auth=no-token" in line + and "admin-auth=admin-token-env" in line + for line in lines + ) assert "user-token" not in listed.output assert "admin-secret" not in listed.output assert "REMOTE_ADMIN_TOKEN" not in listed.output🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@coding-agent/tests/cli/test_remote_client.py` around lines 1663 - 1668, The remote list assertions are too loose because they only check for auth labels anywhere in listed.output, so swapped labels between rows would still pass. Tighten test_remote_client.py by asserting each remote row’s line contains the expected label combination, using the existing remote names like direct, env, user-auth=token, and admin-auth=admin-token to locate the correct row output. Update the checks around the remote list output to bind each expected auth label to its specific remote entry instead of independent substring assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@coding-agent/src/coding_agent/remote/client.py`:
- Around line 138-146: The add_remote() flow currently validates the admin
credential choice but still allows blank admin_token and admin_token_env values
to be persisted through RemoteEndpoint and _remote_payload(). Update
add_remote() to normalize these inputs by trimming whitespace and rejecting
empty results before constructing RemoteEndpoint, using the existing
_validate_admin_credential_choice and nearby validation helpers as the right
place to enforce this for direct callers.
- Around line 183-198: The admin token normalization in the token-resolution
logic is incomplete: `endpoint.admin_token` and the value read from
`endpoint.admin_token_env` are only checked with `strip()` but the untrimmed
string is still returned. Update the token-return path in the admin token helper
in `client.py` so both direct and env-sourced values are stripped once,
validated for emptiness, and the normalized token is what gets returned for
later `Authorization` use.
---
Nitpick comments:
In `@coding-agent/tests/cli/test_remote_client.py`:
- Around line 1663-1668: The remote list assertions are too loose because they
only check for auth labels anywhere in listed.output, so swapped labels between
rows would still pass. Tighten test_remote_client.py by asserting each remote
row’s line contains the expected label combination, using the existing remote
names like direct, env, user-auth=token, and admin-auth=admin-token to locate
the correct row output. Update the checks around the remote list output to bind
each expected auth label to its specific remote entry instead of independent
substring assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 7af5867a-e63f-4cc5-8c0c-85e913f8ee97
📒 Files selected for processing (3)
coding-agent/src/coding_agent/cli/remote_commands.pycoding-agent/src/coding_agent/remote/client.pycoding-agent/tests/cli/test_remote_client.py
Summary
Verification
Review
Summary by CodeRabbit
New Features
remote addnow supports separate credentials for admin-only actions, including environment-variable-based tokens.remote listnow shows distinctuser-authandadmin-authstatus columns.Bug Fixes