Repository navigation
feat(cloud): point agents at cloud access when a write hits read-only OAuth - #1495
Merged
balanza merged 1 commit intoNov 18, 2026
Merged
Conversation
… OAuth The OAuth write-gate error only mentioned long-lived API keys, so an agent on read-only OAuth that runs a write (e.g. `cloud service create`) never discovers the scoped `cloud access request` flow. Append a hint to that error, gated behind `experimental-access-negotiation` via a cfg-selected const so default binaries don't advertise commands they don't carry and both build configs stay warning-clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
balanza
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When an agent is authenticated with read-only OAuth and attempts a cloud write (e.g.
cloud service create,cloud postgres create), the write-gate error tells it only how to create a long-lived API key. It never mentions the scoped, human-approvedcloud access requestflow added in #1439, even in builds that carry it — so an agent in exactly the position the feature was built for can't discover it, and falls back to asking the user for an API key.This appends a scoped-access hint to that error, gated on the same
experimental-access-negotiationcargo feature as the commands it points at, so default/release binaries are unchanged.Why on top of
feature-access-requestcloud access roles/cloud access requestcompile only under#[cfg(feature = "experimental-access-negotiation")]. Any in-binary cross-reference must sit behind the same cfg gate, andmaindefines neither the feature nor the commands — so this belongs with #1439, not as a standalone PR tomain. Base isfeature-access-request; this assumes #1439 moves forward and does not modify it.Change
crates/clickhousectl/src/cloud/mod.rs— the write-gate error now appends the hint via a cfg-selected const, so both build configs stay warning-clean:experimental-access-negotiation: error ends withVerified:
cargo build+cargo clippyclean in both configs; hint present with the feature, absent without.Follow-ups (not in this PR)
Other spots that steer toward API keys and could carry the same gated hint — highest-leverage is
cloud/permissions.rs(permission_lines), one gated line there propagates to every write command's--help. Alsocli.rscloud help,cloud/client.rsno-credentials error,cloud/auth.rslogin help. Left out to keep this PR to the single fail-point.🤖 Generated with Claude Code
Note
Low Risk
User-facing error text only; behavior unchanged except optional extra remediation when the experimental feature is enabled.
Overview
When read-only OAuth users hit the early write gate in
cloud/mod.rs, theAuthRequirederror is built from a shared base message plus an optionalACCESS_HINTblock.With
experimental-access-negotiation**, the error adds guidance to usecloud access rolesandcloud access request --perms role:<UUID>instead of only long-lived API keys. Without the feature,ACCESS_HINTis empty, so the error text matches the previous release build.Reviewed by Cursor Bugbot for commit 2f2d7ba. Bugbot is set up for automated code reviews on this repo. Configure here.