Skip to content

feat: request time-boxed operation access from the CLI - #540

Open
ab-alien-dev wants to merge 3 commits into
mainfrom
alan/alien-618-improve-operations-access-requests-through-cli
Open

feat: request time-boxed operation access from the CLI#540
ab-alien-dev wants to merge 3 commits into
mainfrom
alan/alien-618-improve-operations-access-requests-through-cli

Conversation

@ab-alien-dev

Copy link
Copy Markdown
Contributor

Summary

  • Adds alien access-requests create/get/wait so CLI/API callers (customers running their own AI agent, or a human) can request time-boxed operation access without Slack.
  • create supports both exact (--operation <plugin>/<operation>) and wildcard (--operation <plugin>/* + --max-risk) requests through a single --operation flag.
  • get/wait fetch and print the customer's actual kubectl patch ... approve command once the operator materializes the grant CR, polling briefly so it's available right after creation rather than requiring a follow-up call.
  • operations invoke --request-access creates an access request, waits for approval, then re-invokes the operation.
  • Approval always happens on the customer's side, in-cluster — there is deliberately no CLI action that approves a request.

Test plan

  • cargo check -p alien-cli and cargo test -p alien-cli --lib access_requests pass
  • Manually exercised end-to-end against a local kind cluster: create → operator materializes grant CR → kubectl patch approve → wait/invoke dispatches → verified pod restart via kubectl get pods
  • Manually exercised the wildcard path (--operation 'kubernetes/*' --max-risk mutating)

🤖 Generated with Claude Code

@greptile-apps

greptile-apps Bot commented Aug 30, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds CLI support for creating, inspecting, and waiting on time-boxed operation-access requests, including automatic access requests during operation invocation.

  • Adds exact and wildcard access-request creation.
  • Exposes in-cluster approval coordinates and approval polling.
  • Re-invokes operations after approval and reports post-operation verification separately.
  • Updates the generated Platform API contracts used by the Rust client.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
crates/alien-cli/src/commands/access_requests.rs Adds access-request creation, retrieval, approval-coordinate polling, and approval waiting with human and JSON output modes.
crates/alien-cli/src/commands/operations.rs Adds access-request-assisted invocation and post-operation verification while resolving the previously reported JSON-output, error-propagation, and polling-deadline issues.
crates/alien-cli/src/lib.rs Registers and dispatches the new platform-only access-requests command.
client-sdks/platform/openapi.json Updates the Platform API contract consumed by generated clients for access requests and operation invocation.

Sequence Diagram

sequenceDiagram
  participant Caller
  participant CLI
  participant Platform
  participant Operator
  participant Customer
  participant Deployment

  Caller->>CLI: operations invoke --request-access
  CLI->>Platform: Invoke operation
  Platform-->>CLI: Pending approval
  CLI->>Platform: Create access request
  Operator->>Platform: Report grant coordinates
  CLI->>Platform: Poll request and coordinates
  CLI-->>Caller: Request ID and kubectl command on stderr
  Customer->>Operator: Approve grant in cluster
  CLI->>Platform: Poll until approved
  CLI->>Platform: Re-invoke with access request ID
  Platform->>Deployment: Dispatch operation
  Deployment-->>CLI: Operation result
  CLI->>Platform: Check verification
  CLI-->>Caller: One final JSON result on stdout
Loading

Reviews (3): Last reviewed commit: "fix: address second round of greptile fi..." | Re-trigger Greptile

Comment thread crates/alien-cli/src/commands/operations.rs Outdated
Comment thread crates/alien-cli/src/commands/operations.rs
Comment thread crates/alien-cli/src/commands/operations.rs Outdated
Comment thread crates/alien-cli/src/commands/operations.rs Outdated
Comment thread crates/alien-cli/src/commands/operations.rs Outdated
Access requests previously only worked through Slack. Add a full
alien access-requests create/get/wait path so a customer running
their own AI agent (or a human) can request access, review the
kubectl approve command, and wait for in-cluster approval without
Slack. Approval always happens on the customer's side — there is
deliberately no CLI approve action.

- access-requests create: exact (<plugin>/<operation>) or wildcard
  (<plugin>/*, capped by --max-risk) requests, auto-detected from
  the --operation value.
- access-requests get/wait: print the actual kubectl patch command
  once the operator materializes the grant CR, polling briefly so
  it's usually available immediately rather than requiring a
  second call.
- operations invoke --request-access: create an access request,
  wait for approval, then re-invoke the same operation.
- operations invoke --request-access --json now emits the request ID
  and the kubectl approve command as JSON as soon as each is
  available, instead of suppressing all output until the up-to-1-hour
  approval wait resolves.
- invoke no longer fails the whole command when the write already
  succeeded but the verification check call itself errors (network
  blip, API error) — degrades to Unverified instead of discarding the
  real result and reporting an already-applied write as failed.
- Verification polling now caps its sleep to the remaining declared
  timeout instead of always sleeping a full interval, which could
  overrun the timeout by up to interval + request latency.
- --request-access --json no longer prints progress (request ID,
  approve command) as separate JSON documents on stdout, which made
  the stream unparseable as a single value. Progress now goes to
  stderr in all modes; stdout stays reserved for the one final JSON
  result, same convention as tools like docker pull.
- verify_operation's retry loop now also bounds the verify-check
  HTTP request itself by the remaining declared timeout (previously
  only the sleep between attempts was capped), so a slow or stalled
  response can no longer keep the CLI running past the configured
  duration. A bounded-out request degrades to "not yet verified"
  rather than erroring, consistent with verification being
  alert-only.
@ab-alien-dev
ab-alien-dev force-pushed the alan/alien-618-improve-operations-access-requests-through-cli branch from a9b7533 to dc5c81b Compare August 30, 2026 20:56
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