feat: add OpenCode + Vertex AI demo with MLflow tracing - #7
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
📝 WalkthroughWalkthroughAdds an OpenCode and Vertex AI tracing demo guide for OpenShell on OpenShift. The demo includes PostgreSQL gateway deployment, Agent Sandbox setup, Vertex AI ADC configuration, Jira MCP integration, progressive network-policy updates, MLflow route and plugin configuration, trace verification, cleanup, troubleshooting, and environment-variable references. It also adds the OpenCode configuration, PostgreSQL Kubernetes manifest, repository documentation entry, and demo-specific ignore rules. Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 9 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (9 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 18
🧹 Nitpick comments (1)
demos/opencode-vertex-tracing/.gitignore (1)
4-4: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winDo not ignore
uv.lockwithout another reproducibility mechanism (CWE-829, CWE-494).This demo invokes
uv; confirm whether dependencies are prebuilt and pinned offline. Otherwise remove this ignore rule and commit the lockfile so dependency changes are reviewable and reproducible.As per path instructions, dependency configuration is treated as a supply-chain surface.
🤖 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 `@demos/opencode-vertex-tracing/.gitignore` at line 4, Remove the uv.lock ignore rule unless this demo’s dependencies are demonstrably prebuilt and pinned for offline use. Update the demo’s dependency setup to retain and commit uv.lock so uv dependency changes remain reviewable and reproducible.Source: Path instructions
🤖 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 `@demos/mlflow-openshell-tracing/agent.py`:
- Around line 87-91: Update the token-count logging after the response content
in the agent flow to handle a missing response.usage value before accessing
prompt_tokens or completion_tokens; preserve the model and content output, and
print token counts only when usage is available.
In `@demos/mlflow-openshell-tracing/README.md`:
- Around line 92-98: Remove the insecure
server.auth.allowUnauthenticatedUsers=true and server.disableTls=true flags from
the README helm install walkthrough, or replace them with an enforced ingress
NetworkPolicy and authenticated TLS configuration before deployment; do not
leave the documented gateway accessible without authentication.
- Around line 279-283: Update demos/mlflow-openshell-tracing/README.md lines
279-283 to upload pyproject.toml and the committed uv.lock into the sandbox,
create the environment with uv sync --locked, and stop installing mutable PyPI
ranges at runtime. Update demos/mlflow-openshell-tracing/pyproject.toml lines
6-9 as needed to define the locked dependencies, and remove uv.lock from
demos/mlflow-openshell-tracing/.gitignore line 4 so the generated lockfile is
committed.
- Around line 231-238: Update the sandbox creation command in the README to stop
passing the cluster-admin token from oc whoami -t through MLFLOW_TRACKING_TOKEN.
Document provisioning and using a dedicated least-privileged identity scoped
only to the demo MLflow workspace, then pass that identity’s scoped token to the
sandbox while preserving the existing MLflow configuration.
In `@demos/opencode-vertex-tracing/k8s/postgresql.yaml`:
- Around line 6-9: Remove hard-coded PostgreSQL credentials across all affected
sites: in demos/opencode-vertex-tracing/k8s/postgresql.yaml lines 6-9, generate
per-installation Secret values; in demos/opencode-vertex-tracing/README.md lines
82-87, construct pg-credentials from those generated values without a literal
URI; and in README.md lines 99-106, remove the documented default password and
provide secure secret retrieval instructions.
- Around line 39-62: Add startup and readiness probes to the postgresql
container definition, using PostgreSQL health checks against the configured
database so Kubernetes waits for initialization and only reports the pod ready
when the database accepts connections.
- Around line 40-41: Update the postgresql container image in the Kubernetes
PostgreSQL deployment to use the approved pgvector image pinned by an immutable
sha256 digest instead of the mutable pg16 tag. Preserve the intended PostgreSQL
image while ensuring deployment provenance and signed-image policy checks are
enforced through the repository’s established mechanism.
- Around line 37-41: Complete the PostgreSQL container securityContext for the
postgresql container by disabling privilege escalation, dropping unused
capabilities including CAP_NET_RAW, enabling readOnlyRootFilesystem, and
applying the RuntimeDefault seccomp profile. Add the writable temporary/log
volume mounts required for PostgreSQL to operate while preserving the existing
PGDATA PVC.
- Around line 64-74: Restrict PostgreSQL ingress by adding an openshell
NetworkPolicy with default-deny behavior and an ingress rule allowing only the
OpenShell gateway pod to reach the postgresql Service on TCP port 5432. Use the
existing gateway pod label selector, and keep the policy scoped to the openshell
namespace and app: postgresql selector.
In `@demos/opencode-vertex-tracing/opencode.json`:
- Line 3: The demo dependencies are not pinned or reproducibly provisioned. In
demos/opencode-vertex-tracing/opencode.json lines 3-3, pin the `@mlflow/opencode`
plugin version; in lines 13-15, replace runtime uv tool run mcp-atlassian
resolution with a preinstalled pinned bundle or environment; and in
demos/opencode-vertex-tracing/README.md lines 345-351, update the upload steps
to build node_modules from a locked dependency set with lifecycle scripts
disabled before uploading.
- Line 11: Align the default model in
demos/opencode-vertex-tracing/opencode.json and the step-by-step model selection
instruction in demos/opencode-vertex-tracing/README.md at line 293 with the
intended Claude Opus version, and verify that the selected model is available in
us-east5 before publishing.
In `@demos/opencode-vertex-tracing/README.md`:
- Around line 266-269: Update all three fenced code blocks in the README,
including the blocks around the sandbox command and the referenced sections, to
specify an appropriate language identifier such as bash or text immediately
after the opening fence, without changing their contents.
- Around line 232-245: Update the sandbox creation instructions to remove
JIRA_API_TOKEN and MLFLOW_TRACKING_TOKEN from command-line environment
variables. Use the project’s supported secret-injection mechanism or protected
files instead, with short-lived, least-privilege credentials, and adjust the
documented setup so sandbox processes can access them securely.
- Around line 196-202: Update the README curl verification commands and the
related instructions at the referenced sections to stop using insecure TLS
bypasses such as curl’s -k option and MLFLOW_TRACKING_INSECURE_TLS=true.
Document installing or locating the route CA in the client/sandbox and configure
curl and MLflow tracking to validate the server with that CA via --cacert or the
equivalent trusted CA setting.
- Around line 63-73: Make the README cleanup commands ownership-aware by
labeling resources created by this demo, including the openshell namespace,
MLflow Route, and Agent Sandbox CRDs. Update destructive commands to delete only
resources matching the demo’s ownership labels, never an entire shared namespace
or cluster-wide CRDs without confirming ownership. Apply this consistently to
the PostgreSQL setup and the additional cleanup sections referenced in the
review.
- Around line 69-70: Update the README walkthrough around the openshell-sandbox
SCC grant and the referenced gateway setup to avoid making privileged,
unauthenticated, TLS-disabled access the default. Require a throwaway isolated
cluster and least-privilege SCC, and configure authenticated/mTLS gateway access
for any non-demo use. Clearly isolate and label any insecure port-forwarded demo
path as temporary and non-production across the additional referenced sections.
- Around line 152-163: Update the Vertex AI credentials section to remove the
instruction to run `gcloud auth application-default login` and the claim that
`application_default_credentials.json` will be uploaded to the sandbox. Replace
it with secure guidance using workload identity, service-account impersonation,
or another short-lived, narrowly scoped credential without uploading long-lived
user credentials.
In `@README.md`:
- Line 23: Update the MLflow auto-instrumentation bullet in README.md to state
that tracing requires explicitly calling mlflow.openai.autolog() during setup,
rather than claiming it works with zero code changes.
---
Nitpick comments:
In `@demos/opencode-vertex-tracing/.gitignore`:
- Line 4: Remove the uv.lock ignore rule unless this demo’s dependencies are
demonstrably prebuilt and pinned for offline use. Update the demo’s dependency
setup to retain and commit uv.lock so uv dependency changes remain reviewable
and reproducible.
🪄 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: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 9d7c93a7-248f-4b9a-97d2-43289a644d69
⛔ Files ignored due to path filters (1)
demos/opencode-vertex-tracing/OpenCode-OpenShell-MLflow-on-OpenShift.pngis excluded by!**/*.png
📒 Files selected for processing (11)
README.mddemos/mlflow-openshell-tracing/.gitignoredemos/mlflow-openshell-tracing/README.mddemos/mlflow-openshell-tracing/agent.pydemos/mlflow-openshell-tracing/pyproject.tomldemos/mlflow-openshell-tracing/sandbox-policy.yamldemos/mlflow-openshell-tracing/verify-traces.pydemos/opencode-vertex-tracing/.gitignoredemos/opencode-vertex-tracing/README.mddemos/opencode-vertex-tracing/k8s/postgresql.yamldemos/opencode-vertex-tracing/opencode.json
OpenCode config (google-vertex provider, Jira MCP, MLflow plugin), PostgreSQL manifests for OpenShell Deployment mode, and .gitignore. Part of RHAIENG-6411. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Ian Miller <milleryan2003@gmail.com>
12-step walkthrough: PostgreSQL deploy, OpenShell Deployment mode, Vertex AI via google-vertex provider, Jira MCP with mcp-atlassian, progressive sandbox policy unlocking, and MLflow tracing via @mlflow/opencode plugin. Validated end-to-end on ROSA cluster. Part of RHAIENG-6411. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Ian Miller <milleryan2003@gmail.com>
New demo entry with feature bullets and stack listing. Part of RHAIENG-6411. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Ian Miller <milleryan2003@gmail.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Ian Miller <milleryan2003@gmail.com>
Tracing uses @mlflow/opencode plugin, not OTEL/OTLP directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Ian Miller <milleryan2003@gmail.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Ian Miller <milleryan2003@gmail.com>
28f47b5 to
eafe57d
Compare
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
demos/opencode-vertex-tracing/README.md (1)
20-24: 🔒 Security & Privacy | 🔵 TrivialProtect persisted MLflow trace data (CWE-200).
Prompts, responses, tool arguments, Jira contents, and token metadata can be persisted in a shared RHOAI workspace. Document retention, workspace ACLs, and redaction requirements, and prohibit secrets or unnecessary PII in prompts and tool outputs. As per path instructions, review priority 1 is security vulnerabilities.
Also applies to: 333-383
🤖 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 `@demos/opencode-vertex-tracing/README.md` around lines 20 - 24, Update the MLflow tracing documentation near the “MLflow tracing” and related workspace configuration sections to define trace-data retention, shared-workspace ACL requirements, and prompt/tool-output redaction rules. Explicitly prohibit secrets and unnecessary PII in prompts, responses, tool arguments, Jira contents, and token metadata, and document the required handling for persisted data.Source: Path instructions
🤖 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 `@demos/opencode-vertex-tracing/k8s/postgresql.yaml`:
- Around line 22-32: Update the postgresql Deployment strategy to use Recreate
instead of the default RollingUpdate, ensuring the existing PostgreSQL pod
terminates before its replacement starts while preserving the singleton replica
configuration and shared ReadWriteOnce PVC usage.
In `@demos/opencode-vertex-tracing/README.md`:
- Around line 112-124: Update the OpenShell Helm installation command in the
README to reference the tested immutable OCI artifact digest instead of the
mutable 0.0.85 version tag, and add Helm signature/provenance verification
requirements before installation. Preserve the existing chart settings and
deployment configuration.
- Around line 45-48: Replace the runtime GitHub URL in the local setup
instructions with a vendored or locally cached manifest for the agent-sandbox
resources. Document verification of that file using an immutable checksum or
signature before use, and update both kubectl apply and delete instructions to
reference the verified local manifest.
- Around line 347-355: Update the local plugin-bundle setup instructions to use
a reviewed exact `@mlflow/opencode` version, generate the lockfile offline, and
install dependencies with npm ci --ignore-scripts before packaging. Preserve the
existing tarball creation and sandbox upload steps, ensuring lifecycle scripts
are disabled before node_modules is archived.
- Around line 241-245: Update the sandbox creation instructions in README Step 7
to create or look up the opencode-vertex-demo MLflow experiment before running
openshell sandbox create, validate that MLFLOW_EXPERIMENT_ID is populated, and
replace the placeholder with the quoted environment argument --env
MLFLOW_EXPERIMENT_ID="$MLFLOW_EXPERIMENT_ID".
---
Nitpick comments:
In `@demos/opencode-vertex-tracing/README.md`:
- Around line 20-24: Update the MLflow tracing documentation near the “MLflow
tracing” and related workspace configuration sections to define trace-data
retention, shared-workspace ACL requirements, and prompt/tool-output redaction
rules. Explicitly prohibit secrets and unnecessary PII in prompts, responses,
tool arguments, Jira contents, and token metadata, and document the required
handling for persisted data.
🪄 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: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 7996358f-6875-4ada-9869-0849d41b1303
⛔ Files ignored due to path filters (1)
demos/opencode-vertex-tracing/OpenCode-OpenShell-MLflow-on-OpenShift.pngis excluded by!**/*.png
📒 Files selected for processing (5)
README.mddemos/opencode-vertex-tracing/.gitignoredemos/opencode-vertex-tracing/README.mddemos/opencode-vertex-tracing/k8s/postgresql.yamldemos/opencode-vertex-tracing/opencode.json
🚧 Files skipped from review as they are similar to previous changes (3)
- demos/opencode-vertex-tracing/opencode.json
- demos/opencode-vertex-tracing/.gitignore
- README.md
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: postgresql | ||
| namespace: openshell | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: postgresql | ||
| template: |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Prevent overlapping PostgreSQL pods during Deployment rollouts.
This singleton Deployment defaults to RollingUpdate while both revisions reference the same ReadWriteOnce PVC. A replacement pod can start before the old PostgreSQL pod exits, causing startup contention, a stuck rollout, or concurrent access to the same data directory. Set strategy.type: Recreate, or use a StatefulSet/operator with ordered database rollouts.
Proposed rollout strategy
spec:
replicas: 1
+ strategy:
+ type: Recreate
selector:📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: postgresql | |
| namespace: openshell | |
| spec: | |
| replicas: 1 | |
| selector: | |
| matchLabels: | |
| app: postgresql | |
| template: | |
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: postgresql | |
| namespace: openshell | |
| spec: | |
| replicas: 1 | |
| strategy: | |
| type: Recreate | |
| selector: | |
| matchLabels: | |
| app: postgresql | |
| template: |
🧰 Tools
🪛 Checkov (3.3.8)
[medium] 22-63: Containers should not run with allowPrivilegeEscalation
(CKV_K8S_20)
🤖 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 `@demos/opencode-vertex-tracing/k8s/postgresql.yaml` around lines 22 - 32,
Update the postgresql Deployment strategy to use Recreate instead of the default
RollingUpdate, ensuring the existing PostgreSQL pod terminates before its
replacement starts while preserving the singleton replica configuration and
shared ReadWriteOnce PVC usage.
| ```bash | ||
| # Run locally — applies upstream SIG manifests to the cluster | ||
| kubectl apply -f https://github.com/kubernetes-sigs/agent-sandbox/releases/download/v0.5.2/sandbox.yaml | ||
| ``` |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== locate README =="
fd -a 'README.md' . | sed 's#^\./##' | rg 'demos/opencode-vertex-tracing/README.md|opencode-vertex-tracing' || true
echo "== relevant README sections =="
if [ -f demos/opencode-vertex-tracing/README.md ]; then
nl -ba demos/opencode-vertex-tracing/README.md | sed -n '35,55p;415,430p'
fi
echo "== search manifest URLs in demo =="
rg -n "agent-sandbox|kubectl apply|kubectl delete|sandbox.yaml|releases/download" demos/opencode-vertex-tracing || true
echo "== inspect release asset headers/status (no trust assumptions) =="
curl -I --silent --location "https://github.com/kubernetes-sigs/agent-sandbox/releases/download/v0.5.2/sandbox.yaml" | sed -n '1,80p'Repository: opendatahub-io/agent-ops
Length of output: 312
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== relevant README sections =="
if [ -f demos/opencode-vertex-tracing/README.md ]; then
awk 'NR>=35 && NR<=55 || NR>=415 && NR<=430 {printf "%6d\t%s\n", NR, $0}' demos/opencode-vertex-tracing/README.md
fi
echo "== search manifest URLs in demo =="
rg -n "agent-sandbox|kubectl apply|kubectl delete|sandbox.yaml|releases/download" demos/opencode-vertex-tracing || true
echo "== inspect release asset headers/status =="
curl -I --silent --location "https://github.com/kubernetes-sigs/agent-sandbox/releases/download/v0.5.2/sandbox.yaml" | sed -n '1,100p'Repository: opendatahub-io/agent-ops
Length of output: 9122
Do not apply upstream GitHub release manifests at execution time.
kubectl apply/delete -f https://github.com/kubernetes-sigs/agent-sandbox/releases/download/v0.5.2/sandbox.yaml fetches a GitHub release asset at runtime and can install or remove cluster-scoped Kubernetes objects from an attacker-controlled or replaced asset (CWE-494, CWE-829). Vendor or cache the manifest, verify its immutable checksum/signature locally, and use that verified file for both apply and delete.
🤖 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 `@demos/opencode-vertex-tracing/README.md` around lines 45 - 48, Replace the
runtime GitHub URL in the local setup instructions with a vendored or locally
cached manifest for the agent-sandbox resources. Document verification of that
file using an immutable checksum or signature before use, and update both
kubectl apply and delete instructions to reference the verified local manifest.
Source: Path instructions
| Install the OpenShell Helm chart with PostgreSQL backend and Deployment mode: | ||
|
|
||
| ```bash | ||
| # Run locally | ||
| helm install openshell oci://ghcr.io/nvidia/openshell/helm-chart \ | ||
| --version 0.0.85 \ | ||
| --namespace openshell \ | ||
| --set workload.kind=deployment \ | ||
| --set server.externalDbSecret=pg-credentials \ | ||
| --set server.disableTls=true \ | ||
| --set podSecurityContext.fsGroup=null \ | ||
| --set securityContext.runAsUser=null \ | ||
| --set server.auth.allowUnauthenticatedUsers=true |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== file context =="
sed -n '90,135p' demos/opencode-vertex-tracing/README.md || true
echo
echo "== repository occurrences of helm install / openshell / oci://"
rg -n "helm install openshell|oci://ghcr.io/nvidia/openshell/helm-chart|0\.0\.85|allowUnauthenticatedUsers|unauthenticated" demos/opencode-vertex-tracing/README.md || true
echo
echo "== chart references across repo =="
rg -n "openshell|opencode-vertex-tracing|allowUnauthenticatedUsers|server\.auth|externalDbSecret|disabl[eE]Tls" . || true
echo
echo "== probe registry reference shape =="
python3 - <<'PY'
import urllib.request, urllib.error
refs = {
"tag": "oci://ghcr.io/nvidia/openshell/helm-chart:0.0.85",
"sha": "oci://ghcr.io/nvidia/openshell/helm-chart@sha256:",
"url": "https://ghcr.io/v2/nvidia/openshell/helm-chart/manifests/0.0.85",
}
for key, url in refs.items():
print(f"-- {key}: {url}")
try:
with urllib.request.urlopen(url, timeout=20) as r:
print("status", r.status)
for h in ["content-type", "docker-content-digest", "oci-digest"]:
print("header", h, r.getheader(h))
print("first 500 bytes ok", len(r.read(500)))
except Exception as e:
print(type(e).__name__, str(e))
PYRepository: opendatahub-io/agent-ops
Length of output: 20210
Install the Helm chart from an immutable, signed artifact (CWE-494, CWE-829).
--version 0.0.85 resolves a mutable OCI tag, so this privileged gateway installation depends on a tag rather than an immutable digest or verified provenance record. Pin the tested OCI digest and require signature/provenance verification before helm install.
🤖 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 `@demos/opencode-vertex-tracing/README.md` around lines 112 - 124, Update the
OpenShell Helm installation command in the README to reference the tested
immutable OCI artifact digest instead of the mutable 0.0.85 version tag, and add
Helm signature/provenance verification requirements before installation.
Preserve the existing chart settings and deployment configuration.
Source: Path instructions
| --env MLFLOW_EXPERIMENT_ID=<experiment-id> \ | ||
| --env MLFLOW_WORKSPACE=default \ | ||
| --env MLFLOW_TRACKING_INSECURE_TLS=true \ | ||
| --upload opencode.json:/sandbox/opencode.json \ | ||
| --upload ~/.config/gcloud/application_default_credentials.json:/sandbox/.gcloud/adc.json |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== repo files relevant =="
git ls-files | rg '(^|/)README\.md$|opencode|vertex|mlflow|sandbox' | head -200
echo
echo "== read targeted README sections =="
sed -n '220,255p;360,385p;445,465p' demos/opencode-vertex-tracing/README.md
echo
echo "== occurrences of MLFLOW_EXPERIMENT_ID =="
rg -n "MLFLOW_EXPERIMENT_ID|opencode-vertex-demo|openshell sandbox create|mlflow_opencode|vertex" demos/opencode-vertex-tracing/README.md demos -S || true
echo
echo "== package/version refs =="
rg -n '`@mlflow/opencode`|mlflow.*opencode|openshell|opencode' . -S || trueRepository: opendatahub-io/agent-ops
Length of output: 39284
🌐 Web query:
MLflow Python opencode vertex experiment id MLFLOW_OPENCODE_EXPERIMENT_ID documentation
💡 Result:
The environment variable MLFLOW_EXPERIMENT_ID is the standard mechanism in MLflow for specifying the experiment ID to which runs or traces should be logged [1][2][3]. Regarding the specific term "MLFLOW_OPENCODE_EXPERIMENT_ID," research indicates that this is not a standard, official MLflow configuration variable. Instead, the OpenCode integration (a plugin for MLflow Tracing) utilizes the standard MLFLOW_EXPERIMENT_ID environment variable to determine where to log traces [1][4]. Key points regarding MLflow experiment configuration: 1. Standard Variable: MLFLOW_EXPERIMENT_ID is the authoritative environment variable used by the MLflow Python client and integrations to define the default experiment ID for new runs or traces [2][3]. 2. OpenCode Integration: The OpenCode plugin for MLflow Tracing is configured using standard environment variables, specifically MLFLOW_TRACKING_URI and MLFLOW_EXPERIMENT_ID [1][4]. It does not use a variable named MLFLOW_OPENCODE_EXPERIMENT_ID [1]. 3. Vertex AI Context: When using MLflow with Vertex AI, you typically set the tracking URI to point to the managed MLflow service (often using the databricks URI scheme) and use MLFLOW_EXPERIMENT_ID to specify the experiment [5][6]. The Vertex AI plugin for MLflow overrides specific client methods (like create_run) to bridge MLflow calls to Vertex AI Experiments, but it continues to rely on standard MLflow configuration patterns rather than custom environment variables prefixed with integration names [7]. If you encountered the term MLFLOW_OPENCODE_EXPERIMENT_ID, it may be a misunderstanding or a custom environment variable defined in a specific user's project, but it is not part of the official MLflow or OpenCode plugin documentation [1][4]. To configure your experiment, you should use the standard MLFLOW_EXPERIMENT_ID environment variable [1].
Citations:
- 1: https://mlflow.org/docs/latest/genai/tracing/integrations/listing/opencode.md
- 2: https://www.mlflow.org/docs/latest/api_reference/python_api/mlflow.environment_variables.html
- 3: https://mlflow.openml.io/docs/latest/api_reference/python_api/mlflow.environment_variables
- 4: OpenCode Plugin and Multi-tenant MLFLow mlflow/mlflow#24301
- 5: https://docs.databricks.com/gcp/ja/mlflow/tracking-server-configuration
- 6: https://adhdecode.com/articles/mlflow/mlflow-vertex-ai-mlflow-tracking/
- 7: https://github.com/googleapis/python-aiplatform/blob/bd56d6bb/google/cloud/aiplatform/_mlflow_plugin/_vertex_mlflow_tracking.py
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== lines 350-405 =="
sed -n '350,405p' demos/opencode-vertex-tracing/README.md
echo
echo "== programmatic check: placeholder env value and script redirect semantics =="
python3 - <<'PY'
from pathlib import Path
import shlex
path = Path("demos/opencode-vertex-tracing/README.md")
s = path.read_text()
needle = "--env MLFLOW_EXPERIMENT_ID=<experiment-id>"
idx = s.find(needle)
print("placeholder_present:", idx != -1)
if idx != -1:
line = s.splitlines()[s.count('\n', 0, idx)]
print("line:", line.strip())
print("contains_name_placeholder:", "MLFLOW_EXPERIMENT_ID" in line and "<experiment-id>" in line)
PY
# Bash interprets angle brackets as redirection tokens only when unquoted and processed by the shell;
# this is a read-only parser/model check of token type.
cat >/tmp/angle_probe.sh <<'BASH'
set -u
echo MLFLOW_EXPERIMENT_ID=<experiment-id>
BASH
bash /tmp/angle_probe.sh >/tmp/angle_probe.out 2>/tmp/angle_probe.err || true
printf 'exit_code=%s\nstdout=%s\nstderr=%s\n' "$?" <(cat /tmp/angle_probe.out) <(cat /tmp/angle_probe.err)
echo
echo "== all get-by-name snippets =="
rg -n "get-by-name|experiment_name=opencode-vertex-demo|MLFLOW_EXPERIMENT_ID" demos/opencode-vertex-tracing/README.mdRepository: opendatahub-io/agent-ops
Length of output: 2886
Resolve and pass a real MLFLOW_EXPERIMENT_ID during sandbox creation.
Step 7 passes the placeholder <experiment-id>, but steps later expect the opencode-vertex-demo experiment to already exist and reads it by name. Add the experiment creation/lookup before openshell sandbox create, validate that the ID is set, then pass it quoted as --env MLFLOW_EXPERIMENT_ID="$MLFLOW_EXPERIMENT_ID" so the shell does not treat /dev/fd/* redirection tokens as the env value.
🤖 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 `@demos/opencode-vertex-tracing/README.md` around lines 241 - 245, Update the
sandbox creation instructions in README Step 7 to create or look up the
opencode-vertex-demo MLflow experiment before running openshell sandbox create,
validate that MLFLOW_EXPERIMENT_ID is populated, and replace the placeholder
with the quoted environment argument --env
MLFLOW_EXPERIMENT_ID="$MLFLOW_EXPERIMENT_ID".
| ```bash | ||
| # Run locally — build plugin bundle with all dependencies | ||
| cd /tmp && rm -rf mlflow-bundle && mkdir mlflow-bundle && cd mlflow-bundle | ||
| npm init -y > /dev/null | ||
| npm install @mlflow/opencode | ||
|
|
||
| # Create tarball and upload to sandbox | ||
| tar czf /tmp/mlflow-node-modules.tar.gz node_modules/ | ||
| openshell sandbox upload opencode-demo /tmp/mlflow-node-modules.tar.gz /tmp/mlflow-node-modules.tar.gz |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== locate README =="
fd -a 'README\.md$' . | sed 's#^\./##' | grep 'demos/opencode-vertex-tracing/README.md' || true
echo "== relevant snippet =="
if [ -f demos/opencode-vertex-tracing/README.md ]; then
nl -ba demos/opencode-vertex-tracing/README.md | sed -n '330,365p'
fi
echo "== search for package references =="
rg -n '`@mlflow/opencode`|npm install|node_modules|npm ci|package-lock|openshell sandbox upload' demos/opencode-vertex-tracing/README.md demos .git 2>/dev/null || true
echo "== repo files nearby =="
fd -t f '' demos/opencode-vertex-tracing 2>/dev/null | sed -n '1,120p'Repository: opendatahub-io/agent-ops
Length of output: 304
🌐 Web query:
npm install lifecycle scripts executes postinstall package scripts default behavior
💡 Result:
The default behavior of npm is to execute postinstall and other lifecycle scripts (such as preinstall and install) automatically after the package is installed into node_modules [1][2][3]. However, this behavior is subject to configuration and security settings: 1. Lifecycle Script Execution: During an npm install (or npm ci), npm automatically runs the preinstall, install, and postinstall scripts in the specified order [1][2][3]. This also applies to dependencies [1][3]. 2. Security Configuration: To mitigate security risks, npm provides options to restrict script execution [4][5]: - allow-scripts: Users can configure an allow-list of packages permitted to run install-time scripts using the allow-scripts configuration [4][5]. In projects, this can be managed via an allowScripts field in package.json [6][4]. - --ignore-scripts: Users can globally or command-specifically disable all lifecycle scripts by passing the --ignore-scripts flag [4][5]. - --dangerously-allow-all-scripts: This flag bypasses security restrictions and forces the execution of all lifecycle scripts [4][5]. In summary, while automatic execution is the default, it is standard practice and often recommended for security-conscious environments to audit or restrict which packages are permitted to run these scripts [6][4].
Citations:
- 1: https://docs.npmjs.com/cli/v11/using-npm/scripts/
- 2: https://docs.npmjs.com/cli/v7/using-npm/scripts/
- 3: https://docs.npmjs.com/cli/v8/using-npm/scripts/?v=true
- 4: https://docs.npmjs.com/cli/v11/commands/npm-install/
- 5: https://docs.npmjs.com/cli/v11/commands/npm-install/?v=true
- 6: https://github.com/npm/rfcs/blob/main/accepted/0054-make-scripts-install-opt-in.md
🌐 Web query:
npm install package-lock-only does not install nodes_modules generates package-lock.json without running scripts
💡 Result:
The npm install --package-lock-only command is designed to update or generate the package-lock.json file based on the package.json file, without modifying the node_modules directory or downloading dependencies [1][2]. Regarding the behavior of lifecycle scripts, while the primary intent of this flag is to avoid dependency installation, users have reported that npm may still execute certain lifecycle scripts (such as prepare, preinstall, install, etc.) during this process [3][4]. This behavior has been identified in various npm versions as problematic, particularly when those scripts require dependencies that are not installed [3][4]. To prevent scripts from running when using this flag, it is recommended to combine it with the --ignore-scripts flag: npm install --package-lock-only --ignore-scripts This combination ensures that the lock file is generated or updated without attempting to execute any lifecycle scripts [4].
Citations:
- 1: https://docs.npmjs.com/cli/v11/commands/npm-install/
- 2: https://stackoverflow.com/questions/55599356/what-does-npm-i-package-lock-only-do
- 3: [BUG]
npm i --package-lock-onlyexecutes scripts and crashes npm/cli#5985 - 4: [BUG] lifecycle scripts are run for 'npm install --package-lock-only' npm/cli#2787
Pin the plugin bundle and disable npm lifecycle scripts before upload.
npm install @mlflow/opencode`` fetches mutable latest dependencies and can run install lifecycle scripts in node_modules before the tarball leaves the operator’s workstation. Pin an reviewed exact version, generate the lockfile offline, and install with `npm ci --ignore-scripts` before creating `mlflow-node-modules.tar.gz`.
🤖 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 `@demos/opencode-vertex-tracing/README.md` around lines 347 - 355, Update the
local plugin-bundle setup instructions to use a reviewed exact `@mlflow/opencode`
version, generate the lockfile offline, and install dependencies with npm ci
--ignore-scripts before packaging. Preserve the existing tarball creation and
sandbox upload steps, ensuring lifecycle scripts are disabled before
node_modules is archived.
Source: Path instructions
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Summary
@mlflow/opencodepluginDemo files (
demos/opencode-vertex-tracing/)README.mdopencode.jsonk8s/postgresql.yaml.gitignoreWhat the demo shows
openshell policy update --add-endpointwith per-binary authorization (--binary)aiplatform.googleapis.comusing built-ingoogle-vertexprovider with ADCmcp-atlassiangives OpenCode read access to Jira sprints and issues@mlflow/opencodeplugin auto-traces conversation turns, tool calls, and token usageTest plan
Jira: RHAIENG-6411
🤖 Generated with Claude Code
Summary by CodeRabbit