Skip to content

feat: Add skill linking support for agents - #1440

Merged
pdettori merged 141 commits into
rossoctl:mainfrom
eranra:feature/agent-skill-linking
May 25, 2026
Merged

pdettori merged 141 commits into
rossoctl:mainfrom
eranra:feature/agent-skill-linking

Conversation

@eranra

@eranra eranra commented May 3, 2026

Copy link
Copy Markdown
Contributor

Closes #1342

This PR implements the ability to link imported skills to agents during creation and deployment, addressing the integration requirements outlined in issue #1342.

Changes

Backend

  • Added parameter to agent creation API endpoints
  • Extended and models to include skill references
  • Modified all workload types (Deployment, StatefulSet, Job, Sandbox) to mount skill ConfigMaps as volumes
  • Skills are mounted at with read-only access
  • Added environment variable containing comma-separated skill mount paths
  • Stored skill references in Shipwright Build annotations for finalization workflow
  • Added function to fetch skill metadata for agent cards
  • Added constants: , ,

Frontend

  • Added skill selection UI in with checkboxes
  • Skills are fetched from the API and displayed with name and description
  • Selected skills are passed to both direct deployment and Shipwright build workflows
  • Added TypeScript types for skill references in API service

Testing

  • Added comprehensive test coverage for skill mounting across all workload types
  • Tests verify ConfigMap volume creation, mount paths, and environment variable
  • Tests verify skill references are stored in Shipwright Build annotations

Implementation Details

Skills are referenced by their display name (from annotation) or resource name. The backend looks up matching skill ConfigMaps and mounts them as volumes. Missing skills are silently ignored to prevent agent creation failures when referenced skills are deleted.

The environment variable provides a comma-separated list of mount paths that agents can use to discover and load skills at runtime.

Testing Performed

  • Unit tests for all workload types with skill mounting
  • Verified skill ConfigMap lookup by display name and resource name
  • Tested Shipwright build annotation storage and retrieval

Signed-off-by: Eran Raichstein [email protected]

This commit implements the ability to link imported skills to agents during
creation and deployment. Skills are mounted as ConfigMap volumes and exposed
via the SKILL_FOLDERS environment variable.

Key changes:
- Added skill selection UI in ImportAgentPage with checkboxes
- Extended agent creation API to accept skills parameter
- Modified all workload types (Deployment, StatefulSet, Job, Sandbox) to mount skill ConfigMaps
- Added skill metadata to agent cards for display
- Stored skill references in Shipwright Build annotations for finalization
- Added comprehensive test coverage for skill mounting across workload types

Skills are referenced by display name or resource name and mounted at
/app/skills/<skill-name> with read-only access.

Signed-off-by: Eran Raichstein <[email protected]>
@eranra
eranra force-pushed the feature/agent-skill-linking branch from cf604d4 to c50bd81 Compare May 3, 2026 14:56
eranra added 2 commits May 3, 2026 17:58
Move user-provided namespace parameter to structured logging extra field
to prevent log injection attacks. This addresses the CodeQL security alert.

Signed-off-by: Eran Raichstein <[email protected]>
@eranra

eranra commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

@pdettori this PR is working and the demo is ready but we have to wait for rossoctl/examples#279 to merge before we can accept this PR.

@eranra
eranra force-pushed the feature/agent-skill-linking branch from a98512c to fdc2ba9 Compare May 4, 2026 09:39
Addresses CodeQL security alert by escaping newline and carriage return
characters in the namespace parameter before logging. This prevents
malicious input from injecting fake log entries or manipulating log output.

Fixes log injection vulnerability in _load_agent_skill_summaries function.

Signed-off-by: Eran Raichstein <[email protected]>
@eranra
eranra force-pushed the feature/agent-skill-linking branch from fdc2ba9 to 88b0d64 Compare May 4, 2026 09:41
@eranra

eranra commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

@pavelanni FYI ^^^ this will close the set of MVP with configMap and than we can work on the interface and various implementations of repos (hope this make sense to you) - need to wait for rossoctl/examples#279 to merge first.

@eranra eranra changed the title WIP: Add skill linking support for agents feat: Add skill linking support for agents May 6, 2026
@eranra

eranra commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

I moved the PR into "feat".

Now that rossoctl/examples#279 is merged we can review and merge also this PR - and this docs/demos/demo-generic-agent-skill.md will provide and end-to-end MVP demo of how skills connect to agents in Kagenti.

Thanks + FYI @pdettori ^^^

Once we merge @pavelanni we will want to add "additional integration options"

rubambiza added 3 commits May 6, 2026 13:04
…ssoctl#1349)

- Add scripts/check-release-pins.sh with --json and --verify-images flags
- Add e2e-release-validation.yaml (workflow_dispatch for tagged releases)
- Add ci-release-pins.yaml (PR gate for charts/** changes)
- Pin template :latest defaults via common.oseCLIImage in values.yaml
- Remove stale bitnami/kubectl:latest fallbacks from templates
- Update release skill Phase 2 (mandatory pin check) and Phase 4 (dispatch)
- Document new tools in docs/releasing.md

Signed-off-by: Gloire Rubambiza <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
The JSON capture step must allow failure (|| true) so the summary
step can write to GITHUB_STEP_SUMMARY. A separate final step runs
the script without || true to serve as the actual pass/fail gate.

Signed-off-by: Gloire Rubambiza <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
- Build JSON via jq -n --arg (prevents injection when file paths, version
  strings, or issue text contain quotes, backslashes, or colons)
- Parse Chart.yaml dependencies with a block-aware walker that doesn't
  assume version follows name immediately (uses yq when available)
- Use grep -Fn (fixed string) everywhere instead of grep -n with regex
  (prevents semver range strings like ">=1.0" from being interpreted
  as regex patterns)
- Record dependency version line numbers during parsing so the second
  grep lookup is no longer needed
- Expose kagenti_extensions_ref as a workflow_dispatch input so releases
  can be validated against a pinned extensions ref, not just main
- Shellcheck-clean (SC2059: use %s for colored markers)

Signed-off-by: Gloire Rubambiza <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>

@pdettori pdettori left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review Summary

Solid implementation of skill linkage across all workload types with good test coverage and proper log injection mitigation. CI passes. One blocking issue: the feature is not gated behind a feature flag (mandatory per repo policy).

Areas reviewed: Python (backend logic, security), Frontend (React UI, API types), GitHub URL parsing, Documentation
Commits: 5, all signed-off
CI: All passing (HyperShift E2E pending maintainer trigger)

Assisted-By: Claude Code

Comment thread kagenti/backend/app/routers/agents.py Resolved
Comment thread docs/demos/demo-generic-agent-skill.md Resolved
eranra added 3 commits May 10, 2026 12:14
Resolved conflict in kagenti/backend/app/routers/agents.py by combining:
- Feature branch: skill mounting functionality (_get_linked_skill_mounts)
- Main branch: PORT environment variable handling for Sandbox workloads

Both features are now integrated in _build_sandbox_manifest function.
Resolved conflict in kagenti/backend/app/routers/agents.py by combining:
- Feature branch: skill mounting functionality (_get_linked_skill_mounts)
- Main branch: PORT environment variable handling for Sandbox workloads

Both features are now integrated in _build_sandbox_manifest function.

Signed-off-by: Eran Raichstein <[email protected]>
@eranra
eranra force-pushed the feature/agent-skill-linking branch from 2059c36 to 7312dd5 Compare May 10, 2026 09:38
@eranra
eranra requested a review from pdettori May 10, 2026 10:03
@eranra eranra mentioned this pull request May 10, 2026
1 task done
pdettori and others added 18 commits May 22, 2026 12:49
RHOAI 3.3.x ships MLflow 3.6.x which has a client-side JS bug where
OTEL-ingested traces fail to render in the detail view ("Trace failed
to render"). The root cause is a num_spans metadata mismatch fixed in
upstream MLflow 3.10.0 (PR #20596).

RHOAI 3.4.0 (channel stable-3.4) ships MLflow 3.10.1 which includes
the fix. Update the default RHOAI subscription channel accordingly.

Also adds RHOAI MLflow integration documentation covering:
- Enabling the integration
- Authentication (SA bearer token + kubernetes-auth plugin)
- RHOAI version requirements
- OTEL collector configuration differences vs standalone MLflow

Fixes rossoctl#1637

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
The OpenShift section incorrectly claimed the OCP installer handles
OpenShell deployment. In reality, deploy-shared.sh and deploy-tenant.sh
must be run manually after the platform is installed. Replace the
misleading paragraph with explicit step-by-step instructions.

Also add troubleshooting entries for two common OCP failures:
- deploy-tenant.sh hanging due to missing openshell Keycloak realm
- deploy-shared.sh hanging due to RHBK credential mismatch after
  Keycloak pod recreation

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
- Simplify cookie secret generation to use full entropy from /dev/urandom
- Pre-resolve oauth-proxy image before heredoc with validation/early return
- Pass SA token via pod env var instead of argv to avoid exposure in ps
- Remove redundant `[ -n "$cr_name" ] && break` (while loop condition suffices)

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
- Fetch username from secret dynamically instead of hardcoding 'temp-admin'
- Read hashIterations from existing credential row instead of hardcoding 27500
- Use psql -tA for clean output without whitespace stripping hacks
- chmod 600 the temp file and rm -f it after use

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
…uide-ocp

docs: fix OpenShift section in sandbox guide and add troubleshooting
Signed-off-by: Eran Raichstein <[email protected]>
…ration-gaps

fix(ocp): MLflow integration gaps on RHOAI
Signed-off-by: Eran Raichstein <[email protected]>
Companion to kagenti-extensions PR rossoctl#432, which replaces the bundled
spiffe-helper binary with an in-process go-spiffe SDK integration.
The new authbridge image expects two schema changes:

  * a top-level `spiffe:` block (empty mapping when SPIRE is enabled)
    that signals the framework to construct the in-process Provider
    (X.509 source for mTLS + lazy JWT source for tokenexchange);
  * a per-plugin `tokenexchange.identity.jwt_audience` field carrying
    the JWT-SVID client-assertion audience (replaces the audience that
    spiffe-helper previously baked into helper.conf).

Updates the two places kagenti emits authbridge config so both Helm-
installed and backend-API-created agents render the new shape:

  * charts/kagenti/templates/{authbridge-template-configmaps,
    agent-namespaces}.yaml — render the spiffe block + jwt_audience.
    JWT_AUDIENCE env var (dead code; nothing reads it) dropped from
    authbridge-config ConfigMap.
  * kagenti/backend/app/routers/agents.py:_build_authbridge_runtime_yaml
    and the matching tests — same shape change for backend-rendered
    ConfigMaps.

Adds the optional `jwt_audience` field on the UI's IdentityConfig
type so the form/validation surface stays in sync.

Backward compatibility with the OLD authbridge image (during rollout):
both schema changes are additive — the old image's YAML decoder
silently drops unknown keys, so deployments running the old image
keep working with the new chart. spiffe-helper-config ConfigMap and
the helper.conf rendering are intentionally left in place; they are
no-ops against the new image and required by the old one.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Hai Huang <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
- Chart: add `kagenti.authBridge.validateSpiffeIdentity` helper that
  fails fast at helm template time when authBridge.clientAuthType=
  federated-jwt is set without spire.enabled=true. Without the guard,
  the chart silently emits identity.type=spiffe + jwt_audience but
  no top-level spiffe block, and the new authbridge image
  CrashLoopBackOffs with "spiffe identity requires a SPIFFE provider
  to be injected". Helper is invoked from both authbridge-template-
  configmaps.yaml and agent-namespaces.yaml.

- Backend test: drop the dead `or cfg["spiffe"] is None` disjunct;
  yaml.safe_load on `spiffe: {}` always returns the empty dict, so
  the None branch was unreachable.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Hai Huang <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
…ce-rendering

feat: align kagenti with kagenti-extensions go-spiffe SDK migration
Signed-off-by: Eran Raichstein <[email protected]>
Bump the chart's self-references (ui-v2, backend, *-oauth-secret,
spiffe-idp-setup) from v0.7.0-alpha.1 to v0.7.0-alpha.2, and the
chart version + appVersion to match. The v0.7.0-alpha.2 tag was
just pushed and the Build-Publish workflow has produced images
for these references.

The kagenti-extensions image pins (authbridge*, proxy-init at
v0.6.0-alpha.4) and kagenti-operator pin (0.3.0-alpha.2) were
bumped in earlier commits on main; this PR only completes the
self-bump.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Hai Huang <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
… 0.3.0-alpha.2

The first commit on this branch only bumped the kagenti self-images
(v0.7.0-alpha.1 → v0.7.0-alpha.2). It missed the cross-repo bumps
that motivated the PR in the first place:

  * kagenti-extensions sidecar images (authbridge / authbridge-envoy /
    authbridge-lite / proxy-init): v0.6.0-alpha.3 → v0.6.0-alpha.4
    (carries the spiffe-helper → in-process go-spiffe SDK migration
    from kagenti-extensions#432)
  * kagenti-operator-chart subchart dependency: 0.3.0-alpha.1 →
    0.3.0-alpha.2 (carries the JWTAudience dead-code cleanup from
    kagenti-operator#373)
  * kagenti-operator-chart.controllerManager.container.image.tag:
    0.3.0-alpha.1 → 0.3.0-alpha.2 (override for the operator image)

Chart.lock refreshed via `helm dep update` after the dep version bump.

Both upstream tags + chart packages + container images verified
present:

  * kagenti/kagenti-extensions tag v0.6.0-alpha.4 at e541c2cb
  * kagenti/kagenti-operator   tag v0.3.0-alpha.2 at c90ef899
  * kagenti-operator-chart 0.3.0-alpha.2 pulled from
    oci://ghcr.io/kagenti/kagenti-operator (digest sha256:8340c8e...)

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Hai Huang <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
…spiffe-sdk

chore(release): bump image pins to v0.6.0-alpha.4 / 0.3.0-alpha.2 / v0.7.0-alpha.2
Signed-off-by: Eran Raichstein <[email protected]>
cryptography is intentionally pinned to <47 in kagenti/backend because
versions 47+ crash with SIGILL on ARM64 Kind clusters. Add a Dependabot
ignore rule to prevent it from repeatedly opening PRs that conflict with
this constraint.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
The OCP setup script unconditionally overrode UI/backend image tags by
fetching the latest git tag from the remote repo. This caused version
mismatch when installing from a local repo that has pinned tags in its
chart values (e.g. v0.6.0-rc.6 in values.yaml gets overridden to
v0.7.0-alpha.1 from the remote).

Now the remote tag detection only runs when no --kagenti-repo is passed.
When a local repo is provided, the chart's pinned image tags are used
as-is.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
…-tag-override

fix(ocp): skip remote tag detection when --kagenti-repo is provided
Signed-off-by: Eran Raichstein <[email protected]>
Resolved conflicts in kagenti/backend/app/routers/agents.py:
- Combined skill mounting logic from PR with persistent storage logic from main
- Preserved service port handling for Sandbox workloads
- Integrated skill volumes with conditional persistent storage volumes

Signed-off-by: Eran Raichstein <[email protected]>
Remove custom PORT env var logic from _build_sandbox_manifest.
The PORT env var should use the default value from _build_env_vars()
which is DEFAULT_IN_CLUSTER_PORT (8000), not the service port.

This fixes the test_port_env_var_is_in_cluster_port test which expects
PORT to be 8000, not 8080.

Signed-off-by: Eran Raichstein <[email protected]>

Signed-off-by: Eran Raichstein <[email protected]>
@eranra
eranra force-pushed the feature/agent-skill-linking branch from 8748420 to a088e4e Compare May 24, 2026 09:23
eranra added 4 commits May 24, 2026 12:32
Resolved conflicts in kagenti/backend/app/routers/agents.py:
- Combined skill volume mounting logic with persistent storage conditional
- Preserved skill_volumes, skill_volume_mounts from PR branch
- Maintained persistent storage emptyDir conditional from main branch

Signed-off-by: Eran Raichstein <[email protected]>
Add clarification about skill volume mounts and persistent storage support.

Signed-off-by: Eran Raichstein <[email protected]>
Fix ruff W293 linting error.

Signed-off-by: Eran Raichstein <[email protected]>
The _make_request() helper was missing req.skills, causing AttributeError
when _build_sandbox_manifest called _get_linked_skill_mounts(request) on
the MagicMock(spec=CreateAgentRequest) object.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Eran Raichstein <[email protected]>

@pdettori pdettori left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approval

All review comments from May 7 have been addressed (feature flag guards, session-based caching, newline fix, log injection fix). CI is green. LGTM.

Note: 141 commits in this PR

The branch shows 141 commits, but only 9 are actual feature work (11 files changed). The rest are unrelated commits from other contributors that got pulled in via repeated git merge main into the feature branch.

Root cause: Instead of rebasing onto the latest upstream/main, the branch was updated by merging main into it 3 times. Each merge dragged in all new commits that had landed on main since the fork point.

For future PRs, please rebase instead of merging main:

# Keep your feature branch up to date with upstream
git fetch upstream main
git rebase upstream/main
# If conflicts arise, resolve them one commit at a time
git push --force-with-lease origin feature/your-branch

This keeps the PR commit list clean (only your work) and makes review much easier.

For this PR: I'll squash-merge it, which collapses everything into a single clean commit.

Assisted-By: Claude Code

@pdettori
pdettori merged commit 06d1b11 into rossoctl:main May 25, 2026
24 checks passed
@github-project-automation github-project-automation Bot moved this from New /:ToDo to Done in Rossoctl Issue Prioritization May 25, 2026
@Ronen-Levy Ronen-Levy added this to the Release v0.7.0 milestone Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

epic: Skills Management for Kagenti