Skip to content

feat(spec,aip-go): inline K8s schemas, own go.mod, named client, transport ergonomics#274

Merged
ravisantoshgudimetla merged 3 commits into
mainfrom
phase12-aip-go
Jun 22, 2026
Merged

feat(spec,aip-go): inline K8s schemas, own go.mod, named client, transport ergonomics#274
ravisantoshgudimetla merged 3 commits into
mainfrom
phase12-aip-go

Conversation

@ravisantoshgudimetla

@ravisantoshgudimetla ravisantoshgudimetla commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Spec: Replaced 16 x-go-type vendor extensions with inline OpenAPI schemas. Added ObjectMeta, AgentRegistrationSpec, AgentRegistrationStatus, AgentRequestSpec, AgentRequestStatus. Spec is now language-neutral.
  • go.mod: pkg/aip/ has its own module (github.com/agent-control-plane/aip-go) with zero K8s dependencies. Root go.mod has replace directive.
  • Named client: pkg/aip/client.go — GatewayClient wraps ClientWithResponses with idiomatic methods.
  • Transport: TokenSource, dynamicTransport, NewTransport, PendingApprovalError.
  • Renamed all imports: aip-k8s/pkg/aip → aip-go.
  • aipctl: Removed v1alpha1 dependency. Added registrationObjectName helper.
  • Clients: Added make clients targets and publish CI workflow (.github/workflows/publish-clients.yml).

Test plan

  • go build ./... passes
  • make docs-generate && make docs-lint passes
  • Gateway unit tests pass

Summary by CodeRabbit

Release Notes

  • New Features

    • Added official Python and TypeScript client libraries, published to PyPI and npm automatically on tagged releases.
    • Introduced a Go SDK for gateway operations (list/get/approve/deny/self-register/request token) with support for dynamic token sources.
  • Enhancements

    • Updated OpenAPI/API schemas to use explicit, tooling-friendly structures for better client compatibility.
    • Improved registration naming and made registration/token handling more resilient.
  • Bug Fixes

    • More defensive handling for optional registration fields and safer request/response parsing.
  • Chores

    • Automated OpenAPI-based client generation/publishing and upgraded the Go toolchain to 1.26.1.

@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@ravisantoshgudimetla, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 53 minutes and 59 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 refill rate.

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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d88791d2-5fa8-4f64-84f2-8fd465abcef0

📥 Commits

Reviewing files that changed from the base of the PR and between 91aa12e and 1653f89.

📒 Files selected for processing (29)
  • .github/workflows/publish-clients.yml
  • Makefile
  • api/v1alpha1/mcpserver_types_test.go
  • cmd/gateway/admin_handlers_test.go
  • cmd/gateway/agent_graduation_policy_handlers_test.go
  • cmd/gateway/cel_validation_test.go
  • cmd/gateway/gateway_e2e_test.go
  • cmd/gateway/gateway_oidc_test.go
  • cmd/gateway/gateway_suite_test.go
  • cmd/gateway/handlers_test.go
  • cmd/gateway/integration_agent_graduation_policy_test.go
  • cmd/gateway/integration_agent_registration_test.go
  • cmd/gateway/integration_auth_test.go
  • cmd/gateway/integration_basic_test.go
  • cmd/gateway/integration_registration_approval_test.go
  • cmd/gateway/integration_registration_test.go
  • cmd/gateway/integration_result_test.go
  • cmd/gateway/integration_self_registration_test.go
  • cmd/gateway/integration_session_token_test.go
  • cmd/gateway/integration_sse_test.go
  • cmd/gateway/integration_trust_test.go
  • cmd/gateway/optimization_test.go
  • cmd/gateway/sse_test.go
  • cmd/gateway/trust_profile_handlers_test.go
  • internal/controller/agentrequest_controller.go
  • internal/controller/agentrequest_controller_test.go
  • internal/controller/agenttrustprofile_controller_test.go
  • internal/evaluation/evaluator_test.go
  • internal/evaluation/fetchers/k8s_deployment_fetcher_test.go
📝 Walkthrough

Walkthrough

This PR extracts the AIP Go client types into a standalone pkg/aip module (github.com/agent-control-plane/aip-go), expanding OpenAPI schemas from Go-vendor annotations to explicit object definitions. It regenerates typed model structs, adds GatewayClient/TokenSource/PendingApprovalError primitives, migrates all gateway handlers and aipctl commands to the new module path, and adds Makefile targets plus a CI workflow to generate and publish Python/TypeScript clients on tag pushes.

Changes

aip-go module extraction, schema expansion, and client publishing

Layer / File(s) Summary
OpenAPI schema: replace vendor annotations with explicit object shapes
api/openapi/openapi.yaml
Replaces all x-go-type/x-go-type-import vendor annotations with explicit OpenAPI object schemas. Adds ObjectMeta and expands AgentRegistration*, AgentRequest*, GovernedResource*, SafetyPolicy*, AgentGraduationPolicy*, AuditRecord*, DiagnosticAccuracySummary*, and AgentTrustProfile* schemas. Removes the json.RawMessage annotation from CreateAgentRequestBody.parameters.
pkg/aip module creation, generated models, and build system updates
pkg/aip/go.mod, pkg/aip/api.gen.go, go.mod, Dockerfile*, test/e2e/Dockerfile.fake-mcp
Creates pkg/aip/go.mod as github.com/agent-control-plane/aip-go with Go 1.26.1 and oapi-codegen dependency. Regenerates api.gen.go replacing v1alpha1 type aliases with expanded local structs (ObjectMeta, AgentRegistration*, AgentRequest*, and governance resource types) and changes CreateAgentRequestBody.Parameters to *map[string]interface{}. Wires root go.mod with require and replace directives. Updates all Dockerfile builder base images to Go 1.26 and adds COPY steps for nested module manifests.
GatewayClient API wrapper and token-source transport primitives
pkg/aip/transport.go, pkg/aip/client.go
Adds transport.go with TokenSource interface for per-request token acquisition, dynamicTransport that injects bearer tokens into outgoing requests, and PendingApprovalError for HTTP 202 approval-pending responses. Adds client.go with GatewayClient wrapping ClientWithResponses, static/dynamic constructors, and methods for list/get/approve/deny/self-register registrations plus request-token with pending-approval handling.
aipctl: migrate to aip-go, deterministic registration naming, nil-safe field access
cmd/aipctl/client.go, cmd/aipctl/register.go, cmd/aipctl/registrations.go, cmd/aipctl/token.go, cmd/aipctl/token_flow.go
Switches aipctl imports to aip-go. Adds registrationObjectName helper using SHA-256 hash + DNS slug normalization for deterministic naming. Updates runRegister to derive initial name via the helper and conditionally override with response metadata. Rebuilds registration create with aip.ObjectMeta/aip.AgentRegistrationSpec pointer fields. Updates list rendering to nil-safe pointer reads. Adds nil guards for reg.Spec and reg.Spec.AgentIdentity in token flow. Replaces strPtr calls with new().
Gateway handlers and tests: bulk import swap from aip-k8s to aip-go
cmd/gateway/accuracy_handlers.go, cmd/gateway/agent_graduation_policy_handlers*.go, cmd/gateway/agent_registration*.go, cmd/gateway/agent_request_*.go, cmd/gateway/audit_handlers.go, cmd/gateway/governed_resource_handlers.go, cmd/gateway/main.go, cmd/gateway/registration_sse.go, cmd/gateway/safety_policy_handlers.go, cmd/gateway/session_handlers.go, cmd/gateway/sse*.go, cmd/gateway/trust_profile_handlers*.go, cmd/gateway/*_test.go
Switches the aip import alias from aip-k8s/pkg/aip to aip-go across all gateway handler, server wiring, and test files. Handler logic and test assertions remain unchanged. Test pointer construction via ptr.To() is replaced with new() operator throughout.
Makefile client generation targets and GitHub Actions release workflow
Makefile, .github/workflows/publish-clients.yml
Adds OPENAPI_GENERATOR_VERSION, OPENAPI_GENERATOR Docker configuration, and phony Makefile targets clients, clients-python, clients-typescript to generate SDKs from api/openapi/openapi.yaml with version threading. Adds publish-clients.yml GitHub Actions workflow triggered on v* tag pushes with publish-python (PyPI via twine, PYPI_TOKEN) and publish-typescript (npm --access public, NPM_TOKEN) jobs including validation, setup, build, and upload steps.
Add modernize lint suppressions in tests and controller code
api/v1alpha1/mcpserver_types_test.go, cmd/gateway/gateway_*.go, internal/controller/*.go, internal/evaluation/*.go
Adds //nolint:modernize inline comments to ptr.To(...) usages in controller lease spec assignments, test pointer field initializers, and policy band thresholds to suppress linter warnings while preserving test logic and assertions.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant GatewayClient
  participant dynamicTransport
  participant TokenSource
  participant Gateway

  Caller->>GatewayClient: RequestToken(ctx, registrationName, service, ttl)
  GatewayClient->>dynamicTransport: RoundTrip(POST /session-token, NoWait=true)
  dynamicTransport->>TokenSource: Token(ctx)
  TokenSource-->>dynamicTransport: bearer token string
  dynamicTransport->>Gateway: POST /session-token Authorization: Bearer <token>
  alt HTTP 200
    Gateway-->>GatewayClient: JSON body with token
    GatewayClient-->>Caller: token string, nil
  else HTTP 202
    Gateway-->>GatewayClient: JSON body with agentRequestName
    GatewayClient-->>Caller: "", PendingApprovalError{AgentRequestName}
  else other status
    Gateway-->>GatewayClient: error body text
    GatewayClient-->>Caller: "", error
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • agent-control-plane/aip-k8s#262: Both PRs directly touch the cmd/aipctl implementation (notably cmd/aipctl/client.go, plus related aipctl token/registration flows), so the main PR's aipctl changes are code-level related to the retrieved PR's aipctl CLI and hardening work.
  • agent-control-plane/aip-k8s#263: Both PRs change the AIP token/session intent path by overlapping on cmd/aipctl/token_flow.go and cmd/gateway/session_handlers.go—main PR retargets the token/session handler/client types to aip-go, while the retrieved PR adds the session-intent query/request flow and corresponding gateway behavior.
  • agent-control-plane/aip-k8s#273: Both PRs touch the same aipctl migration surface—cmd/aipctl/{client,register,registrations,token,token_flow}.go—switching token/registration flows to use generated aip-go client APIs and adjusting request/parameter wiring for NoWait and registration object naming.

Poem

🐇 A module once tangled in vines so deep,
Now hops on its own with a clean little leap!
The schemas grew explicit, the vendors all fled,
And Python and TypeScript clients were fed.
With tokens that pend and a transport that's bright,
This rabbit ships clients at v*-tag night! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.34% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main changes: inlining K8s schemas into the OpenAPI spec, creating a standalone go.mod for aip-go, adding a named GatewayClient, and improving transport ergonomics.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch phase12-aip-go

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (6)
pkg/aip/client.go (2)

11-15: 🧹 Nitpick | 🔵 Trivial | 💤 Low value

Unused gateway field in GatewayClient.

The gateway field is stored but never referenced after construction. Consider removing it or documenting its intended future use.

♻️ Proposed fix
 type GatewayClient struct {
-	inner   *ClientWithResponses
-	gateway string
+	inner *ClientWithResponses
 }

And update constructors accordingly.

🤖 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 `@pkg/aip/client.go` around lines 11 - 15, The GatewayClient struct has a
gateway field that is never referenced anywhere in the codebase after
initialization. Remove the gateway field from the GatewayClient struct
definition, and update the constructor function (NewGateway or similar) that
populates this field to no longer assign the gateway parameter to the struct. If
the field is intended for future use, add a comment explaining the planned usage
instead of removing it.

161-167: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Add comment explaining why json.Unmarshal error is ignored.

Per coding guidelines, errors should not be silently ignored. If the intent is to proceed with an empty AgentRequestName when parsing fails, document this explicitly.

♻️ Proposed fix
 	if resp.HTTPResponse.StatusCode == 202 {
 		var ar struct {
 			AgentRequestName string `json:"agentRequestName"`
 		}
-		_ = json.Unmarshal(resp.Body, &ar)
+		// Best-effort parse; proceed with empty name if body is malformed
+		_ = json.Unmarshal(resp.Body, &ar)
 		return "", &PendingApprovalError{AgentRequestName: ar.AgentRequestName}
 	}
🤖 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 `@pkg/aip/client.go` around lines 161 - 167, In the 202 status code handling
block where json.Unmarshal is called on resp.Body to parse the agentRequestName,
add an explanatory comment above the json.Unmarshal line documenting why the
error is intentionally ignored. The comment should clarify that if JSON parsing
fails, the code intentionally proceeds with an empty AgentRequestName value in
the PendingApprovalError rather than failing completely, making the error
suppression deliberate and transparent to future maintainers.

Source: Coding guidelines

api/openapi/openapi.yaml (1)

73-74: 🧹 Nitpick | 🔵 Trivial | 💤 Low value

Consider adding maxItems constraints to unbounded arrays.

The requestedServices and allowedSubjects arrays lack maxItems constraints. While not critical for internal APIs, unbounded arrays can be a DoS vector if clients send excessively large payloads.

-        requestedServices: { type: array, items: { type: string } }
+        requestedServices: { type: array, items: { type: string }, maxItems: 100 }

Also applies to: 87-87

🤖 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 `@api/openapi/openapi.yaml` around lines 73 - 74, The `requestedServices` and
`allowedSubjects` arrays in the OpenAPI specification lack `maxItems`
constraints, which can allow clients to send excessively large payloads and
create a potential DoS vector. Add a reasonable `maxItems` constraint to both
the `requestedServices` array definition (around line 73) and the
`allowedSubjects` array definition (around line 87) to limit the maximum number
of items each array can contain and prevent unbounded payload sizes.

Source: Linters/SAST tools

.github/workflows/publish-clients.yml (2)

10-10: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Set persist-credentials: false on checkout actions.

Prevents Git credentials from persisting in subsequent steps, reducing exposure if later steps are compromised.

🛡️ Proposed fix
       - uses: actions/checkout@v4
+        with:
+          persist-credentials: false

Apply to both checkout steps (lines 10 and 29).

Also applies to: 29-29

🤖 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 @.github/workflows/publish-clients.yml at line 10, Add the security
configuration persist-credentials: false to both checkout action steps in the
workflow file. Locate the first actions/checkout@v4 step (around line 10) and
the second actions/checkout@v4 step (around line 29), and add
persist-credentials: false as a with parameter to each checkout action to
prevent Git credentials from being persisted across subsequent workflow steps.

Source: Linters/SAST tools


10-10: 🧹 Nitpick | 🔵 Trivial | ⚖️ Poor tradeoff

Consider pinning actions to commit SHAs for supply chain security.

Using version tags like @v4 can be updated by the action maintainer. Pinning to a specific commit SHA provides stronger guarantees.

Also applies to: 13-13, 29-29, 32-32

🤖 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 @.github/workflows/publish-clients.yml at line 10, Replace all action version
tags with specific commit SHAs in the publish-clients.yml workflow file. Find
each instance where actions are referenced with version tags (such as
actions/checkout@v4 on line 10, and the additional occurrences on lines 13, 29,
and 32) and replace the version tag with its corresponding full commit SHA. For
example, change `actions/checkout@v4` to `actions/checkout@<full-commit-sha>`
where the commit SHA should be the exact commit hash of that action version.
This applies to all uses statements that specify actions in the workflow.

Source: Linters/SAST tools

Makefile (1)

509-531: 🧹 Nitpick | 🔵 Trivial | ⚖️ Poor tradeoff

Hardcoded packageVersion=0.1.0 won't match git tags.

The workflow publishes on v* tags but client versions are hardcoded to 0.1.0. Consider parameterizing the version or extracting it from the git tag.

🤖 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 `@Makefile` around lines 509 - 531, The packageVersion and npmVersion are
hardcoded to 0.1.0 in the clients-python and clients-typescript targets, but
this doesn't align with git tag versioning used in the workflow. Create a
VERSION variable at the top of the Makefile (similar to how
OPENAPI_GENERATOR_VERSION is defined), and replace the hardcoded 0.1.0 values in
both the packageVersion and npmVersion properties with this new VERSION
variable. This ensures the generated client versions will match your git tag
releases.
🤖 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 @.github/workflows/publish-clients.yml:
- Around line 1-5: The Publish Clients workflow is missing an explicit
permissions block, which defaults to write-all access and poses a security risk.
Add a permissions block after the on section (after the tags trigger) that
restricts the workflow to only the minimum required permissions needed for
publishing. For a workflow that runs scripts and uploads packages, this
typically means restricting to read-only access for contents or adding only the
specific write permissions needed for release operations, rather than allowing
unrestricted write access to all resources.

In `@go.mod`:
- Line 3: The go.mod file specifies an invalid Go version 1.26.1 which does not
exist as a released version. Update the go directive in go.mod to use a valid,
released Go version (such as 1.21, 1.22, 1.23, or another currently available
stable release) instead of 1.26.1.

---

Nitpick comments:
In @.github/workflows/publish-clients.yml:
- Line 10: Add the security configuration persist-credentials: false to both
checkout action steps in the workflow file. Locate the first actions/checkout@v4
step (around line 10) and the second actions/checkout@v4 step (around line 29),
and add persist-credentials: false as a with parameter to each checkout action
to prevent Git credentials from being persisted across subsequent workflow
steps.
- Line 10: Replace all action version tags with specific commit SHAs in the
publish-clients.yml workflow file. Find each instance where actions are
referenced with version tags (such as actions/checkout@v4 on line 10, and the
additional occurrences on lines 13, 29, and 32) and replace the version tag with
its corresponding full commit SHA. For example, change `actions/checkout@v4` to
`actions/checkout@<full-commit-sha>` where the commit SHA should be the exact
commit hash of that action version. This applies to all uses statements that
specify actions in the workflow.

In `@api/openapi/openapi.yaml`:
- Around line 73-74: The `requestedServices` and `allowedSubjects` arrays in the
OpenAPI specification lack `maxItems` constraints, which can allow clients to
send excessively large payloads and create a potential DoS vector. Add a
reasonable `maxItems` constraint to both the `requestedServices` array
definition (around line 73) and the `allowedSubjects` array definition (around
line 87) to limit the maximum number of items each array can contain and prevent
unbounded payload sizes.

In `@Makefile`:
- Around line 509-531: The packageVersion and npmVersion are hardcoded to 0.1.0
in the clients-python and clients-typescript targets, but this doesn't align
with git tag versioning used in the workflow. Create a VERSION variable at the
top of the Makefile (similar to how OPENAPI_GENERATOR_VERSION is defined), and
replace the hardcoded 0.1.0 values in both the packageVersion and npmVersion
properties with this new VERSION variable. This ensures the generated client
versions will match your git tag releases.

In `@pkg/aip/client.go`:
- Around line 11-15: The GatewayClient struct has a gateway field that is never
referenced anywhere in the codebase after initialization. Remove the gateway
field from the GatewayClient struct definition, and update the constructor
function (NewGateway or similar) that populates this field to no longer assign
the gateway parameter to the struct. If the field is intended for future use,
add a comment explaining the planned usage instead of removing it.
- Around line 161-167: In the 202 status code handling block where
json.Unmarshal is called on resp.Body to parse the agentRequestName, add an
explanatory comment above the json.Unmarshal line documenting why the error is
intentionally ignored. The comment should clarify that if JSON parsing fails,
the code intentionally proceeds with an empty AgentRequestName value in the
PendingApprovalError rather than failing completely, making the error
suppression deliberate and transparent to future maintainers.
🪄 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

Run ID: cf55329e-60a5-489a-83fc-90eb29f77527

📥 Commits

Reviewing files that changed from the base of the PR and between 4385247 and 631eb8c.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • pkg/aip/go.sum is excluded by !**/*.sum
📒 Files selected for processing (46)
  • .github/workflows/publish-clients.yml
  • Makefile
  • api/openapi/openapi.yaml
  • cmd/aipctl/client.go
  • cmd/aipctl/register.go
  • cmd/aipctl/registrations.go
  • cmd/aipctl/token.go
  • cmd/aipctl/token_flow.go
  • cmd/gateway/accuracy_handlers.go
  • cmd/gateway/admin_handlers_test.go
  • cmd/gateway/agent_graduation_policy_handlers.go
  • cmd/gateway/agent_graduation_policy_handlers_test.go
  • cmd/gateway/agent_registration_handlers.go
  • cmd/gateway/agent_registration_lifecycle_handlers.go
  • cmd/gateway/agent_request_lifecycle_handlers.go
  • cmd/gateway/agent_request_review_handlers.go
  • cmd/gateway/agent_request_token_handlers.go
  • cmd/gateway/audit_handlers.go
  • cmd/gateway/cel_validation_test.go
  • cmd/gateway/governed_resource_handlers.go
  • cmd/gateway/handlers_test.go
  • cmd/gateway/integration_agent_graduation_policy_test.go
  • cmd/gateway/integration_agent_registration_test.go
  • cmd/gateway/integration_auth_test.go
  • cmd/gateway/integration_basic_test.go
  • cmd/gateway/integration_registration_approval_test.go
  • cmd/gateway/integration_registration_test.go
  • cmd/gateway/integration_result_test.go
  • cmd/gateway/integration_self_registration_test.go
  • cmd/gateway/integration_session_token_test.go
  • cmd/gateway/integration_sse_test.go
  • cmd/gateway/integration_trust_test.go
  • cmd/gateway/main.go
  • cmd/gateway/optimization_test.go
  • cmd/gateway/registration_sse.go
  • cmd/gateway/safety_policy_handlers.go
  • cmd/gateway/session_handlers.go
  • cmd/gateway/sse.go
  • cmd/gateway/sse_test.go
  • cmd/gateway/trust_profile_handlers.go
  • cmd/gateway/trust_profile_handlers_test.go
  • go.mod
  • pkg/aip/api.gen.go
  • pkg/aip/client.go
  • pkg/aip/go.mod
  • pkg/aip/transport.go

Comment thread .github/workflows/publish-clients.yml
Comment thread go.mod

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 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 @.github/workflows/publish-clients.yml:
- Line 13: The GitHub Actions workflow uses floating version tags (like `@v4` and
`@v5`) which are vulnerable to upstream drift and supply chain attacks. Replace
each floating tag reference in the uses clauses at lines 13, 23, 39, and 50 with
their corresponding immutable full commit SHA values. For example, convert
actions/checkout@v4 to actions/checkout@<full-commit-sha> format for each action
reference throughout the workflow file.

In `@api/openapi/openapi.yaml`:
- Around line 85-86: The `approvedServices` array field in the OpenAPI schema is
currently unbounded and lacks a `maxItems` constraint. Add a `maxItems` property
to the `approvedServices` field definition to limit the array size and prevent
oversized payloads. Use the same maximum value that is applied to other similar
array fields in the schema like `requestedServices` to maintain consistency
across the API specification.

In `@Makefile`:
- Line 517: The fallback logic for VERSION derivation is ineffective because sed
exits successfully even when git describe fails and produces no output. The
issue is that the pipeline operator runs sed on empty input, which succeeds
instead of failing to trigger the fallback. Wrap the entire git describe and sed
pipeline in parentheses before the || operator so that the fallback echo "0.1.0"
is triggered when git describe actually fails. This ensures that if git describe
produces no output, the grouped command fails and the fallback value is used
instead of leaving VERSION empty.
🪄 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

Run ID: 2017c121-96d2-428c-9950-a2a0f8f4172f

📥 Commits

Reviewing files that changed from the base of the PR and between 631eb8c and dbcf02a.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • pkg/aip/go.sum is excluded by !**/*.sum
📒 Files selected for processing (58)
  • .github/workflows/publish-clients.yml
  • Dockerfile
  • Dockerfile.dashboard
  • Dockerfile.gateway
  • Makefile
  • api/openapi/openapi.yaml
  • api/v1alpha1/mcpserver_types_test.go
  • cmd/aipctl/client.go
  • cmd/aipctl/register.go
  • cmd/aipctl/registrations.go
  • cmd/aipctl/token.go
  • cmd/aipctl/token_flow.go
  • cmd/gateway/accuracy_handlers.go
  • cmd/gateway/admin_handlers_test.go
  • cmd/gateway/agent_graduation_policy_handlers.go
  • cmd/gateway/agent_graduation_policy_handlers_test.go
  • cmd/gateway/agent_registration_handlers.go
  • cmd/gateway/agent_registration_lifecycle_handlers.go
  • cmd/gateway/agent_request_lifecycle_handlers.go
  • cmd/gateway/agent_request_review_handlers.go
  • cmd/gateway/agent_request_token_handlers.go
  • cmd/gateway/audit_handlers.go
  • cmd/gateway/cel_validation_test.go
  • cmd/gateway/gateway_e2e_test.go
  • cmd/gateway/gateway_oidc_test.go
  • cmd/gateway/gateway_suite_test.go
  • cmd/gateway/governed_resource_handlers.go
  • cmd/gateway/handlers_test.go
  • cmd/gateway/integration_agent_graduation_policy_test.go
  • cmd/gateway/integration_agent_registration_test.go
  • cmd/gateway/integration_auth_test.go
  • cmd/gateway/integration_basic_test.go
  • cmd/gateway/integration_registration_approval_test.go
  • cmd/gateway/integration_registration_test.go
  • cmd/gateway/integration_result_test.go
  • cmd/gateway/integration_self_registration_test.go
  • cmd/gateway/integration_session_token_test.go
  • cmd/gateway/integration_sse_test.go
  • cmd/gateway/integration_trust_test.go
  • cmd/gateway/main.go
  • cmd/gateway/optimization_test.go
  • cmd/gateway/registration_sse.go
  • cmd/gateway/safety_policy_handlers.go
  • cmd/gateway/session_handlers.go
  • cmd/gateway/sse.go
  • cmd/gateway/sse_test.go
  • cmd/gateway/trust_profile_handlers.go
  • cmd/gateway/trust_profile_handlers_test.go
  • go.mod
  • internal/controller/agentrequest_controller.go
  • internal/controller/agentrequest_controller_test.go
  • internal/controller/agenttrustprofile_controller_test.go
  • internal/evaluation/evaluator_test.go
  • internal/evaluation/fetchers/k8s_deployment_fetcher_test.go
  • pkg/aip/api.gen.go
  • pkg/aip/client.go
  • pkg/aip/go.mod
  • pkg/aip/transport.go
✅ Files skipped from review due to trivial changes (15)
  • cmd/gateway/integration_registration_approval_test.go
  • pkg/aip/go.mod
  • cmd/gateway/sse.go
  • cmd/gateway/integration_session_token_test.go
  • internal/evaluation/evaluator_test.go
  • cmd/gateway/cel_validation_test.go
  • cmd/gateway/integration_registration_test.go
  • internal/controller/agentrequest_controller_test.go
  • internal/controller/agenttrustprofile_controller_test.go
  • internal/evaluation/fetchers/k8s_deployment_fetcher_test.go
  • cmd/gateway/integration_basic_test.go
  • cmd/gateway/integration_agent_registration_test.go
  • api/v1alpha1/mcpserver_types_test.go
  • internal/controller/agentrequest_controller.go
  • cmd/gateway/agent_graduation_policy_handlers.go
🚧 Files skipped from review as they are similar to previous changes (23)
  • cmd/gateway/integration_result_test.go
  • cmd/gateway/handlers_test.go
  • cmd/gateway/agent_request_token_handlers.go
  • cmd/aipctl/register.go
  • cmd/gateway/main.go
  • cmd/gateway/agent_request_lifecycle_handlers.go
  • cmd/gateway/accuracy_handlers.go
  • cmd/aipctl/token.go
  • cmd/gateway/agent_request_review_handlers.go
  • cmd/gateway/integration_self_registration_test.go
  • cmd/gateway/trust_profile_handlers.go
  • cmd/gateway/admin_handlers_test.go
  • cmd/gateway/audit_handlers.go
  • cmd/gateway/trust_profile_handlers_test.go
  • cmd/gateway/governed_resource_handlers.go
  • go.mod
  • cmd/gateway/agent_registration_handlers.go
  • cmd/gateway/agent_graduation_policy_handlers_test.go
  • cmd/gateway/session_handlers.go
  • cmd/aipctl/registrations.go
  • pkg/aip/transport.go
  • pkg/aip/client.go
  • cmd/gateway/registration_sse.go

Comment thread .github/workflows/publish-clients.yml Outdated
Comment thread api/openapi/openapi.yaml Outdated
Comment thread Makefile Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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 @.github/workflows/publish-clients.yml:
- Around line 50-53: The
actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 step in the publish
job is missing an explicit cache configuration, which creates a security risk in
a secret-bearing workflow. Add package-manager-cache: false to the with section
of the setup-node action to explicitly disable the implicit npm cache and
prevent potential cache-poisoning attacks.
🪄 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

Run ID: d0a16e8b-e461-4e4b-88b1-0b9865877325

📥 Commits

Reviewing files that changed from the base of the PR and between dbcf02a and a110ac2.

📒 Files selected for processing (4)
  • .github/workflows/publish-clients.yml
  • Makefile
  • api/openapi/openapi.yaml
  • test/e2e/Dockerfile.fake-mcp
✅ Files skipped from review due to trivial changes (1)
  • test/e2e/Dockerfile.fake-mcp
🚧 Files skipped from review as they are similar to previous changes (2)
  • Makefile
  • api/openapi/openapi.yaml

Comment thread .github/workflows/publish-clients.yml Outdated
…sport ergonomics

Extract pkg/aip as standalone module github.com/agent-control-plane/aip-go with
its own go.mod and replace directive. Inline ObjectMeta/Spec/Status K8s schemas
into openapi.yaml so generated types are self-contained (no api/v1alpha1 aliases).

aip-go additions:
- GatewayClient: named wrapper over ClientWithResponses with SelfRegister(),
  RequestToken(), and defaultTokenTTL constant
- NewTransport(TokenSource): http.RoundTripper for in-cluster operators that
  cannot use exec credential plugins
- PendingApprovalError: typed error on HTTP 202 so reconcile loops requeue cleanly
- TokenSource interface: for rotating credentials (projected SA token, keychain)

aipctl updates:
- SelfRegister uses namespace parameter threaded to nsPtr()
- register.go uses server-returned name when present in 201 response
- registrations.go aligns with updated client signatures
…o Docker context

go.mod requires go >= 1.26.1; all four builder images were still on golang:1.25.
Also add pkg/aip/go.mod and pkg/aip/go.sum COPY lines before RUN go mod download
in the three main Dockerfiles — the root go.mod replace directive requires the
pkg/aip module files to be present for go mod download to succeed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/publish-clients.yml (1)

34-34: 🧹 Nitpick | 🔵 Trivial | 🏗️ Heavy lift

Prefer OIDC trusted publishing over long-lived registry tokens

Line 34 (twine upload) and Line 61 (npm publish) currently depend on stored secrets. Consider moving to trusted publishing (OIDC) for PyPI and npm to remove long-lived credentials from repo settings.

Also applies to: 61-61

🤖 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 @.github/workflows/publish-clients.yml at line 34, The twine upload command
on line 34 and npm publish command on line 61 are currently using long-lived
registry tokens stored as secrets, which presents a security risk. Replace both
the PyPI and npm publishing steps to use OIDC trusted publishing instead. For
the twine upload step, configure it to use OIDC authentication with PyPI by
adding the appropriate OIDC token exchange step and removing the reliance on
stored token secrets. For the npm publish step, similarly configure it to use
OIDC trusted publishing with npm registry, removing the npm registry token
secret dependency. This will eliminate the need for long-lived credentials
stored in repository settings.

Source: Linters/SAST tools

🤖 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 @.github/workflows/publish-clients.yml:
- Around line 18-25: The "Validate generated client" step runs Python commands
(py_compile) before the
`actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065` step is
executed, which relies on pre-installed Python versions from the runner image
and can break when hosted images change. Move the `actions/setup-python` step
with python-version 3.12 to execute BEFORE the "Validate generated client" step
to ensure the correct Python runtime is configured before any Python commands
run. Apply the same reordering pattern to ensure `actions/setup-node` executes
before any Node commands (as noted in the "Also applies to" section).

---

Nitpick comments:
In @.github/workflows/publish-clients.yml:
- Line 34: The twine upload command on line 34 and npm publish command on line
61 are currently using long-lived registry tokens stored as secrets, which
presents a security risk. Replace both the PyPI and npm publishing steps to use
OIDC trusted publishing instead. For the twine upload step, configure it to use
OIDC authentication with PyPI by adding the appropriate OIDC token exchange step
and removing the reliance on stored token secrets. For the npm publish step,
similarly configure it to use OIDC trusted publishing with npm registry,
removing the npm registry token secret dependency. This will eliminate the need
for long-lived credentials stored in repository settings.
🪄 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

Run ID: 49f20792-1f9a-47ac-954b-c60453861580

📥 Commits

Reviewing files that changed from the base of the PR and between a110ac2 and 91aa12e.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • pkg/aip/go.sum is excluded by !**/*.sum
📒 Files selected for processing (59)
  • .github/workflows/publish-clients.yml
  • Dockerfile
  • Dockerfile.dashboard
  • Dockerfile.gateway
  • Makefile
  • api/openapi/openapi.yaml
  • api/v1alpha1/mcpserver_types_test.go
  • cmd/aipctl/client.go
  • cmd/aipctl/register.go
  • cmd/aipctl/registrations.go
  • cmd/aipctl/token.go
  • cmd/aipctl/token_flow.go
  • cmd/gateway/accuracy_handlers.go
  • cmd/gateway/admin_handlers_test.go
  • cmd/gateway/agent_graduation_policy_handlers.go
  • cmd/gateway/agent_graduation_policy_handlers_test.go
  • cmd/gateway/agent_registration_handlers.go
  • cmd/gateway/agent_registration_lifecycle_handlers.go
  • cmd/gateway/agent_request_lifecycle_handlers.go
  • cmd/gateway/agent_request_review_handlers.go
  • cmd/gateway/agent_request_token_handlers.go
  • cmd/gateway/audit_handlers.go
  • cmd/gateway/cel_validation_test.go
  • cmd/gateway/gateway_e2e_test.go
  • cmd/gateway/gateway_oidc_test.go
  • cmd/gateway/gateway_suite_test.go
  • cmd/gateway/governed_resource_handlers.go
  • cmd/gateway/handlers_test.go
  • cmd/gateway/integration_agent_graduation_policy_test.go
  • cmd/gateway/integration_agent_registration_test.go
  • cmd/gateway/integration_auth_test.go
  • cmd/gateway/integration_basic_test.go
  • cmd/gateway/integration_registration_approval_test.go
  • cmd/gateway/integration_registration_test.go
  • cmd/gateway/integration_result_test.go
  • cmd/gateway/integration_self_registration_test.go
  • cmd/gateway/integration_session_token_test.go
  • cmd/gateway/integration_sse_test.go
  • cmd/gateway/integration_trust_test.go
  • cmd/gateway/main.go
  • cmd/gateway/optimization_test.go
  • cmd/gateway/registration_sse.go
  • cmd/gateway/safety_policy_handlers.go
  • cmd/gateway/session_handlers.go
  • cmd/gateway/sse.go
  • cmd/gateway/sse_test.go
  • cmd/gateway/trust_profile_handlers.go
  • cmd/gateway/trust_profile_handlers_test.go
  • go.mod
  • internal/controller/agentrequest_controller.go
  • internal/controller/agentrequest_controller_test.go
  • internal/controller/agenttrustprofile_controller_test.go
  • internal/evaluation/evaluator_test.go
  • internal/evaluation/fetchers/k8s_deployment_fetcher_test.go
  • pkg/aip/api.gen.go
  • pkg/aip/client.go
  • pkg/aip/go.mod
  • pkg/aip/transport.go
  • test/e2e/Dockerfile.fake-mcp
✅ Files skipped from review due to trivial changes (17)
  • test/e2e/Dockerfile.fake-mcp
  • internal/controller/agenttrustprofile_controller_test.go
  • pkg/aip/go.mod
  • internal/evaluation/fetchers/k8s_deployment_fetcher_test.go
  • cmd/gateway/integration_registration_test.go
  • cmd/gateway/agent_request_lifecycle_handlers.go
  • internal/controller/agentrequest_controller_test.go
  • cmd/gateway/integration_agent_registration_test.go
  • cmd/gateway/agent_request_token_handlers.go
  • cmd/gateway/integration_result_test.go
  • api/v1alpha1/mcpserver_types_test.go
  • cmd/gateway/safety_policy_handlers.go
  • cmd/gateway/gateway_e2e_test.go
  • cmd/gateway/integration_registration_approval_test.go
  • cmd/gateway/agent_graduation_policy_handlers.go
  • internal/controller/agentrequest_controller.go
  • internal/evaluation/evaluator_test.go
🚧 Files skipped from review as they are similar to previous changes (39)
  • cmd/gateway/integration_sse_test.go
  • Dockerfile
  • cmd/gateway/session_handlers.go
  • cmd/gateway/integration_session_token_test.go
  • cmd/aipctl/token.go
  • cmd/gateway/audit_handlers.go
  • cmd/gateway/cel_validation_test.go
  • cmd/gateway/sse_test.go
  • Dockerfile.dashboard
  • cmd/gateway/handlers_test.go
  • cmd/gateway/agent_registration_handlers.go
  • cmd/gateway/integration_agent_graduation_policy_test.go
  • cmd/gateway/agent_request_review_handlers.go
  • cmd/gateway/integration_auth_test.go
  • cmd/gateway/agent_registration_lifecycle_handlers.go
  • cmd/aipctl/client.go
  • cmd/gateway/governed_resource_handlers.go
  • Dockerfile.gateway
  • cmd/gateway/trust_profile_handlers.go
  • cmd/gateway/admin_handlers_test.go
  • cmd/gateway/registration_sse.go
  • cmd/gateway/gateway_suite_test.go
  • cmd/aipctl/registrations.go
  • cmd/gateway/integration_trust_test.go
  • cmd/aipctl/register.go
  • cmd/gateway/trust_profile_handlers_test.go
  • cmd/gateway/optimization_test.go
  • go.mod
  • cmd/gateway/integration_self_registration_test.go
  • cmd/gateway/integration_basic_test.go
  • api/openapi/openapi.yaml
  • cmd/aipctl/token_flow.go
  • cmd/gateway/accuracy_handlers.go
  • cmd/gateway/agent_graduation_policy_handlers_test.go
  • cmd/gateway/main.go
  • pkg/aip/client.go
  • pkg/aip/transport.go
  • cmd/gateway/gateway_oidc_test.go
  • pkg/aip/api.gen.go

Comment thread .github/workflows/publish-clients.yml Outdated
…rray bounds

Lint (Go 1.26 modernize linter):
- Add //nolint:modernize to ptr.To() calls that carry runtime values where
  new(x) would be wrong per staticcheck SA4006
- Remove now-unused strPtr/boolPtr helper functions made unused by lint-fix
- Fix comma-before-comment placement in composite literals (gofmt)

CI/workflow:
- Pin all GitHub Actions uses: to immutable commit SHAs (supply chain hardening)
- Add package-manager-cache: false to setup-node (prevent cache poisoning in
  secret-bearing publish workflow)
- Add permissions: contents: read and persist-credentials: false
- Fix py_compile glob path (was double-prefixing working-directory)
- Fix VERSION Makefile fallback: sh -c with empty-tag check so 0.1.0 fires
  correctly when git describe produces no output

OpenAPI spec:
- Add maxItems: 100 to approvedServices, requestedServices, allowedSubjects
@ravisantoshgudimetla ravisantoshgudimetla merged commit bff38fc into main Jun 22, 2026
9 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.

1 participant