Repository navigation
Conversation
AI review: no P0-P2 findingsTreats ⚪ P3
Not checked: The AI review read the diff, the code, and the PR's text; it ran no tests or builds and read nothing outside this repository.
Human review: needed
The AI review found no P0-P2 problems at 33e2f79, so the code needs no second review for bugs. Decide the points above: approve to accept them, or request changes. Suggested reviewer: |
There was a problem hiding this comment.
🟡 Changes recommended
Grant credentials can still leak through telemetry bodies because redaction omits the pg prefix, requiring a pattern fix and regression tests for error redaction and resource filtering.
1 open issue
What changed in this PR
This PR adds delegated-grant (pg-) support to the CLI’s existing project-bound authentication flow, while leaving permission enforcement to Hosting.
Changes:
- Treat grants as project-bound credentials and refuse to save them through login.
- Omit grants from telemetry authorization and return exit code
6for exhausted mutation budgets. - Document grant behavior and add authentication, telemetry, and command-level tests.
| File | Description |
|---|---|
| internal/telemetry/telemetry.go | Disallow feedback with delegated grants. |
| internal/telemetry/telemetry_test.go | Test grant authorization omission and feedback restrictions. |
| internal/telemetry/send.go | Omit grant bearer tokens from telemetry requests. |
| internal/lavaflow/start.go | Reject grants for person-only run starts. |
| internal/lavaflow/lavaflow.go | Reject grants for person-only settings updates. |
| internal/durable/durable.go | Require personal credentials for approvals. |
| internal/config/config.go | Define grants and shared project-bound checks. |
| internal/config/config_test.go | Test credential classification and restrictions. |
| internal/cmd/feedback/feedback.go | Apply project-bound feedback status handling. |
| internal/cmd/connect/connect.go | Skip account validation for grants. |
| internal/cmd/auth/auth_test.go | Verify login rejects grants without requests or writes. |
| internal/auth/auth.go | Reject grant persistence and use project-bound checks. |
| internal/api/grant_errors.go | Identify grant-budget exhaustion responses. |
| docs/scripting.md | Document exit code 6. |
| docs/authentication.md | Explain delegated-grant usage and restrictions. |
| cmd/volcano/main.go | Map grant-budget exhaustion to exit code 6. |
| cmd/volcano/grant_test.go | Test worker authentication, refusals, and exit codes. |
Review effort: Balanced
…login does with one
|
Verdict findings on ea51c75, fixed in 726c499:
|
…eedback, LavaFlow and approval refusals
|
P3 findings on 726c499, fixed in 55e9a0e:
|
| exitPermissionDenied = 5 | ||
| // exitGrantBudgetExhausted is the API's 429 grant_budget_exhausted: a | ||
| // delegated grant used all of its mutations, and a new grant is the fix. | ||
| exitGrantBudgetExhausted = 6 |
There was a problem hiding this comment.
⚪ P3: Docs for exit code 6 and delegated grants were dropped in the merge, and no volcano-docs PR is linked
After the merge of main (#489 moved published docs to Kong/volcano-docs), this diff no longer touches docs/scripting.md, docs/authentication.md, docs/feedback.md, docs/lavaflow.md, docs/durable-functions.md, docs/domains.md or docs/git.md. The PR description still lists them under Summary, and its Tracking section links no Kong/volcano-docs PR. AGENTS.md says a change to user-facing behavior needs a companion PR in Kong/volcano-docs that updates content/cli, and that the two PRs must be linked. Without one, the published scripting page will not list exit code 6, which the Builder worker relies on. The authentication, feedback, LavaFlow and approvals pages also won't mention delegated grants. Fix: move those edits into a Kong/volcano-docs PR under content/cli, following its spec/markdown-format.md, link it here, and update the description's docs bullet.
Found by claude-opus-5-5
| and asks you to confirm; --yes skips the question. Only the project's owner | ||
| can turn it on, from their own session: a project access token is refused. The | ||
| can turn it on, from their own session: a project access token or a delegated | ||
| grant is refused. The |
There was a problem hiding this comment.
⚪ P3: volcano lavaflow enable --help now has a short line ending in "The"
The edit added "or a delegated grant" without rewrapping the paragraph, so line 42 reads grant is refused. The and the sentence continues on the next line. Cobra prints Long as written, so the help output shows this broken line. Rewrap lines 40–44 so each line is about the same length as the rest of the paragraph.
Found by claude-opus-5-5
| exitPermissionDenied = 5 | ||
| // exitGrantBudgetExhausted is the API's 429 grant_budget_exhausted: a | ||
| // delegated grant used all of its mutations, and a new grant is the fix. | ||
| exitGrantBudgetExhausted = 6 |
There was a problem hiding this comment.
⚪ P3: Link the required companion documentation PR
AGENTS.md requires a cross-linked Kong/volcano-docs PR for user-facing changes. The supplied description and comments contain no companion link and still cite removed local docs, including docs/scripting.md. Open or link the companion PR updating content/cli for grant handling and exit code 6.
Found by gpt-6.1-sol

Tracking
pg-grants), Kong/volcano-hosting#3312 (C2, grant route table), Kong/volcano-hosting#3313 (C3, mutation budget andgrant_budget_exhausted)docs/design/builder-app/designs/grant-acceptance.md§7 K1 and §11 in Kong/volcano-builderWhy
VOLCANO_TOKEN=pg-…, a delegated grant bound to one customer project. The CLI does not know thepg-prefix, so it treats the grant as an account token: it makes account calls the grant can't make, and the detached telemetry flush posts the grant to/cli/telemetry.grant_budget_exhausted) apart from other failures, because the fix is a new grant and a retry.Summary
Kept to what Hosting's refusals require ("the CLI carries minimal changes; things are controlled server-side"). Hosting decides what a grant may do and words every refusal; the CLI adds no hints of its own.
config.DelegatedGrantPrefix(pg-),IsDelegatedGrant, andIsProjectBound(pt-orpg-)IsProjectBoundwhereIsProjectTokenwas:RequireAccountToken,RequireProject, connect project handling, feedback, durable approvals, LavaFlow, so a grant is refused where apt-token is, with the same exit codes.volcano loginis unchanged for grants (decided 2026-11-13)ErrAccountTokenRequiredForGrantandErrNoProjectSelectedForGrant: the account-command and no-project refusals, and the feedback status line, name a delegated grant (pg-) instead of a project access token. Both match thept-errors witherrors.Is, so exit codes stay the same--helppg-grants andvgt_model-gateway run tokens in telemetry error text, resources and feedback, the same pattern Hosting usesFlushsends no bearer when the token is a grant.pt-behaviour is unchanged. This one can't be left to Hosting: it ignores the grant there, but only the client can stop sending it6for 429grant_budget_exhaustedonly (internal/api/grant_errors.go); C4's 429rate_limit_exceededstays exit1content/cli): exit code6inscripting.md; a short "Delegated grants" section inauthentication.mdthat says a grant is meant forVOLCANO_TOKENand whatvolcano login --token pg-…does with one: Hosting refuses a grant onGET /projects, so login fails without--projector with a project name; with the grant's own project ID it can pass and save the grantVOLCANO_TOKEN(or K4'sVOLCANO_TOKEN_FD),VOLCANO_API_URL, the link file.volcano/project.json(or--project <uuid>),VOLCANO_TELEMETRY_DISABLED=1,VOLCANO_NONINTERACTIVE=1.VOLCANO_PROJECT_IDworks but prints a deprecation warning on every run, so the worker should use the link fileVerification
go build ./...make check(openapi-generated-check,release-workflow-check,lintwith 0 issues,test)cmd/volcano/grant_test.goruns the real command tree with the worker's environment against a recording server. On every run it asserts the grant is never in stdout or stderr and no request goes to/service-keysor/user. It covers the exit code of each grant refusal, and account commands refused before any requestTestFlush_DelegatedGrantSendsNoAuthorizationcarries the telemetry guarantee. The harness check on/cli/telemetryproves little, since telemetry is a no-op in testsTestIsDelegatedGrantAndIsProjectBound,TestRequireAccountTokenAndProjectRefuseADelegatedGrant(grant wording, sameerrors.Ismatches),TestRunMapsErrorsToStableExitCodes(grant rows),TestFeedback_ProjectTokenSendsNothing(pt-andpg-),TestCanSendFeedbackRefusesProjectBoundTokens,TestRedact(pg-,vgt_),TestRunStartWithAProjectTokenNeedsTheOwnersSessionandTestApprovalsDecideRefusesAProjectTokenBeforeAnyRequest(pt-andpg-)mainat96438255: docs: move published docs to volcano-docs #489 moveddocs/to Kong/volcano-docs, so this PR's docs edits moved to docs(cli): document delegated grants, exit code 6 and VOLCANO_TOKEN_FD volcano-docs#190