Skip to content

feat(ai): add Helm release management tools for the AI agent - #665

Open
yupanzi wants to merge 2 commits into
kite-org:mainfrom
yupanzi:feature/ai-helm-tool
Open

feat(ai): add Helm release management tools for the AI agent#665
yupanzi wants to merge 2 commits into
kite-org:mainfrom
yupanzi:feature/ai-helm-tool

Conversation

@yupanzi

@yupanzi yupanzi commented Jul 30, 2026

Copy link
Copy Markdown

Depends on #663 — this branch is stacked on it and includes its commit. Only the last commit (feat(ai): add Helm release management tools for the AI agent) is new; the shared value-redaction placeholder comes from #663. Happy to rebase once that lands.

Summary

Give the AI agent first-class Helm release tools:

  • Six new tools: list_helm_releases, get_helm_release (optionally with the chart's default values), get_helm_release_history, update_helm_release_values (merge — like --reuse-values — or replace semantics), rollback_helm_release, uninstall_helm_release.
  • Bounded results: item caps for lists/history/managed resources and a size cap per values section, so one large chart cannot consume the whole tool-result budget.
  • Value redaction: sensitive-looking values are masked with the shared placeholder, and update_helm_release_values rejects payloads that contain the placeholder so the agent cannot write "***" back into a release.
  • RBAC: tools map onto helmrelease get/update/delete permissions per namespace, and namespaced tools reject the _all pseudo-namespace — helm's storage would treat it as cluster-wide, which would bypass namespace deny rules.
  • Confirmation flow: the three mutating tools are registered as mutation tools, so they require the existing user confirmation; the chat UI describes them ("Update values of Helm release …") and previews the values_yaml like resource mutations.
  • Refactor: DeleteHelmReleaseAutoUpgradeTask moves from the resources handler into pkg/scheduler (exported) so uninstalling via the agent also clears a configured auto-upgrade task.

Why

The agent could only investigate Helm releases by poking at release Secrets with the generic resource tools, which is slow, leaks chart values wholesale, and cannot perform release operations safely.

Related issue

Closes #670

Validation

  • go test ./pkg/ai/... ./pkg/resources/... — new tool_helm_test.go plus authorization tests covering every helm tool, the _all rejection, and a coverage test asserting every registered tool has an authorization mapping
  • pnpm run type-check && pnpm run lint && pnpm run test

Checklist

  • I reviewed this PR myself before requesting review.
  • I understand the changes, including AI-generated parts (if any).
  • For new features, a feature request issue is linked.
  • I cleaned up AI noise (unnecessary comments, dead code, and unrelated changes).
  • This PR is reasonably scoped (or split into smaller PRs).

🤖 Generated with Claude Code

yupanzi and others added 2 commits July 30, 2026 22:13
Update the Claude integration to the current API surface and fix several
agent-loop bugs:

- Move the Anthropic path to the Beta Messages API with adaptive
  thinking, context management, and output_config.effort. Effort is the
  reasoning-depth knob on current Claude models (budget_tokens returns
  400 there); it is exposed as a new AIEffort setting
  (low/medium/high/xhigh/max, default xhigh) in the general settings.
  Feature use is gated per model so older models keep the classic
  request shape.
- Send AIMaxTokens as configured and make the default provider-aware
  (64000 for Anthropic, 8192 for OpenAI): on current Claude models
  thinking and answer share max_tokens, so the old 4096 default
  truncated answers mid-sentence. Default Anthropic model is now
  claude-opus-5.
- Replay tool turns structurally instead of flattening them to
  "[Tool: ...]" text. Textual replay poisoned the model into emitting
  tool calls as plain text/XML on later turns; the frontend now sends
  the tool round-trip (id, name, args, result) and the backend rebuilds
  real tool_use/tool_result blocks.
- Mask Secret data in tool results before they reach the model.
- Emit an SSE keepalive comment every 20s: an agent turn is
  legitimately silent while a tool runs, and ingress-nginx closes the
  connection after 60s of backend silence. Raise the chart's gateway
  request timeout to 900s and document the matching ingress-nginx
  annotations next to it.
- Tighten resource tool schemas/descriptions with explicit caps, and
  fix long-token overflow in AI chat markdown tables.
- Cover conversation replay, handler streaming, settings migration, and
  the agent loop with tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Give the agent first-class Helm capabilities instead of forcing it to
poke at release Secrets with generic resource tools:

- New tools: list_helm_releases, get_helm_release (with optional chart
  default values), get_helm_release_history, update_helm_release_values
  (merge or replace semantics), rollback_helm_release,
  uninstall_helm_release. Results are bounded (item caps, values size
  cap) so one large chart cannot consume the tool-result budget.
- Sensitive-looking values are masked with the shared redaction
  placeholder; masked placeholders written back in values_yaml are
  rejected so the agent cannot corrupt a release with "***".
- RBAC: helm tools map onto helmrelease get/update/delete permissions
  per namespace; namespaced tools reject the _all pseudo-namespace so
  helm's cluster-wide storage cannot bypass namespace deny rules. The
  three mutating tools require the existing user confirmation flow, and
  the chat UI describes and previews them like resource mutations.
- Export scheduler.DeleteHelmReleaseAutoUpgradeTask (moved from the
  resources handler) so uninstalling via the agent also clears a
  configured auto-upgrade task.

Built on top of the Anthropic modernization branch, which provides the
shared value-redaction placeholder.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

AI: first-class Helm release tools for the agent

1 participant