Skip to content

feat(cloud): point agents at cloud access when a write hits read-only OAuth - #1495

Merged
balanza merged 1 commit into
feature-access-requestfrom
feature-access-request-agent-hints
Nov 18, 2026
Merged

balanza merged 1 commit into
feature-access-requestfrom
feature-access-request-agent-hints

Conversation

@chloecdc

@chloecdc chloecdc commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

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-approved cloud access request flow 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-negotiation cargo feature as the commands it points at, so default/release binaries are unchanged.

Why on top of feature-access-request

cloud access roles / cloud access request compile only under #[cfg(feature = "experimental-access-negotiation")]. Any in-binary cross-reference must sit behind the same cfg gate, and main defines neither the feature nor the commands — so this belongs with #1439, not as a standalone PR to main. Base is feature-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:

  • with experimental-access-negotiation: error ends with

    Or request a short-lived, human-approved scoped key, with no long-lived API key to manage:
    clickhousectl cloud access roles
    clickhousectl cloud access request --perms role:<UUID>

  • without the feature: error is byte-for-byte unchanged.

Verified: cargo build + cargo clippy clean 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. Also cli.rs cloud help, cloud/client.rs no-credentials error, cloud/auth.rs login 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, the AuthRequired error is built from a shared base message plus an optional ACCESS_HINT block.

With experimental-access-negotiation**, the error adds guidance to use cloud access roles and cloud access request --perms role:<UUID> instead of only long-lived API keys. Without the feature, ACCESS_HINT is 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.

… 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>
@cla-assistant

cla-assistant Bot commented Nov 18, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@balanza
balanza merged commit fa0a2ca into feature-access-request Nov 18, 2026
10 of 11 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.

2 participants