From c3993426498d5b602ec080bc1d3cbad5e8460f4a Mon Sep 17 00:00:00 2001 From: krishicks Date: Wed, 26 Aug 2026 14:44:47 +0000 Subject: [PATCH 1/2] feat(dev): unify local Kubernetes gateway workflow (#2914) Make the local k3s gateway workflow match the Docker and Podman flows by registering and selecting successful plaintext Skaffold deployments with the OpenShell CLI. Derive the registration name from the worktree-specific k3d cluster name so parallel worktrees retain independent gateway metadata. Add helm:k3s:forward as the standard way to expose the Kubernetes gateway on localhost:8090, and update the development and debugging guidance to use the active registered gateway instead of one-off endpoint flags. Signed-off-by: Kris Hicks --- .../skills/debug-openshell-cluster/SKILL.md | 7 ++- .agents/skills/helm-dev-environment/SKILL.md | 23 ++++++-- tasks/helm.toml | 12 ++-- tasks/scripts/helm-k3s-local.sh | 58 ++++++++++++++++++- 4 files changed, 87 insertions(+), 13 deletions(-) diff --git a/.agents/skills/debug-openshell-cluster/SKILL.md b/.agents/skills/debug-openshell-cluster/SKILL.md index 3fc53df904..9db860995c 100644 --- a/.agents/skills/debug-openshell-cluster/SKILL.md +++ b/.agents/skills/debug-openshell-cluster/SKILL.md @@ -435,11 +435,14 @@ kubectl -n openshell get endpoints openshell For local port-forward testing: ```bash -kubectl -n openshell port-forward svc/openshell 8080:8080 -openshell gateway add http://127.0.0.1:8080 --local --name local +mise run helm:k3s:forward +openshell gateway list openshell status ``` +A successful plaintext `helm:skaffold:run` registers and selects the local +gateway; the forwarding task does not modify gateway metadata. + If the gateway is healthy but sandbox creation fails: ```bash diff --git a/.agents/skills/helm-dev-environment/SKILL.md b/.agents/skills/helm-dev-environment/SKILL.md index 2dad568c79..0c6afb8162 100644 --- a/.agents/skills/helm-dev-environment/SKILL.md +++ b/.agents/skills/helm-dev-environment/SKILL.md @@ -81,7 +81,17 @@ sidecar-mTLS profile reuses `ci/values-sidecar.yaml` and restores Job that runs `openshell-gateway generate-certs`) generates mTLS secrets on first install. Envoy Gateway opt-in; see the Optional Add-ons section below. -The gateway Service uses ClusterIP. Access is via Envoy Gateway (port `8080`) or `kubectl port-forward`. +The gateway Service uses ClusterIP. Access is via Envoy Gateway (port `8080`) or +the local forwarding task: + +```bash +mise run helm:k3s:forward +``` + +The task forwards the Kubernetes gateway to `http://127.0.0.1:8090`. A +successful plaintext `helm:skaffold:run` or `helm:skaffold:run:sidecar` +registers and selects the gateway under the worktree-specific k3d cluster name. +Keep the forwarding task running while using the endpoint. **HA test deploy** (two gateway replicas + external PostgreSQL Secret): uncomment `#- ci/values-high-availability.yaml` in `deploy/helm/openshell/skaffold.yaml`, @@ -99,19 +109,20 @@ plaintext by default. To test sidecar topology with TLS enabled, use | Skaffold dev (default) | `true` | `http://` | | TLS enabled | `false` (or omitted) | `https://` | -### Connecting via port-forward +### Connecting through the forwarding task -Port `8080` is already bound by the k3d load balancer when Envoy Gateway is active, so -the port-forward uses local port `8090` to avoid a collision: +Port `8080` is already bound by the k3d load balancer when Envoy Gateway is +active, so the forwarding task uses local port `8090` for the gateway. In a +second terminal, confirm that the gateway is registered and active: ```bash -KUBECONFIG=kubeconfig kubectl port-forward -n openshell svc/openshell 8090:8080 +openshell gateway list ``` **Plaintext (default Skaffold deploy):** ```bash -openshell sandbox list --gateway-endpoint http://localhost:8090 +openshell sandbox list ``` **With mTLS enabled** — extract the client cert the PKI hook wrote to the cluster, diff --git a/tasks/helm.toml b/tasks/helm.toml index 33a61c022c..7f78ce4a8f 100644 --- a/tasks/helm.toml +++ b/tasks/helm.toml @@ -69,14 +69,14 @@ dir = "deploy/helm/openshell" run = "skaffold dev -p sidecar-mtls" ["helm:skaffold:run"] -description = "Run skaffold run for deploy/helm/openshell (one-shot deploy)" +description = "Run a one-shot Skaffold deploy and register its local plaintext gateway" dir = "deploy/helm/openshell" -run = "skaffold run" +run = "skaffold run && ../../../tasks/scripts/helm-k3s-local.sh register" ["helm:skaffold:run:sidecar"] -description = "Run skaffold run with the Kubernetes supervisor sidecar topology" +description = "Run a sidecar Skaffold deploy and register its local plaintext gateway" dir = "deploy/helm/openshell" -run = "skaffold run -p sidecar" +run = "skaffold run -p sidecar && ../../../tasks/scripts/helm-k3s-local.sh register" ["helm:skaffold:run:sidecar-mtls"] description = "Run skaffold run with the Kubernetes supervisor sidecar topology and TLS/mTLS enabled" @@ -130,6 +130,10 @@ description = "List local k3d clusters" run = "tasks/scripts/helm-k3s-local.sh status" hide = true +["helm:k3s:forward"] +description = "Forward the local Kubernetes gateway to port 8090" +run = "tasks/scripts/helm-k3s-local.sh forward" + # Install Envoy Gateway's GatewayClass into the cluster ["helm:gateway:apply"] diff --git a/tasks/scripts/helm-k3s-local.sh b/tasks/scripts/helm-k3s-local.sh index 82b8d5cfc8..2234497b44 100755 --- a/tasks/scripts/helm-k3s-local.sh +++ b/tasks/scripts/helm-k3s-local.sh @@ -38,6 +38,13 @@ PRELOAD_SANDBOX_IMAGE="${HELM_K3S_PRELOAD_SANDBOX_IMAGE-${DEFAULT_SANDBOX_PRELOA # exercise the v1alpha1 controller release. AGENT_SANDBOX_VERSION="${AGENT_SANDBOX_VERSION:-v0.5.0}" +# Host endpoint registered for the Skaffold-deployed gateway. Derive the +# gateway name from the worktree-specific cluster name so concurrent local +# clusters do not overwrite each other's CLI metadata. +GATEWAY_NAMESPACE="openshell" +GATEWAY_HOST_PORT="${HELM_K3S_GATEWAY_HOST_PORT:-8090}" +GATEWAY_NAME="${HELM_K3S_GATEWAY_NAME:-${CLUSTER_NAME}}" + default_kubeconfig="${ROOT}/kubeconfig" if [[ -n "${HELM_K3S_KUBECONFIG:-}" ]]; then KUBECONFIG_TARGET="${HELM_K3S_KUBECONFIG}" @@ -54,7 +61,7 @@ fi usage() { cat >&2 < +usage: $(basename "$0") Environment: HELM_K3S_CLUSTER_NAME k3d cluster name (default: openshell-dev-) @@ -65,6 +72,9 @@ Environment: HELM_K3S_PRELOAD_SANDBOX_IMAGE Sandbox image to docker pull and import into k3d (default: ${DEFAULT_SANDBOX_PRELOAD_IMAGE}; set empty to skip) + HELM_K3S_GATEWAY_HOST_PORT Host port forwarded to the gateway (default: 8090) + HELM_K3S_GATEWAY_NAME CLI gateway registration name + (default: worktree-specific k3d cluster name) macOS uses k3d from mise (Docker required). Linux can use this flow only when k3d is installed explicitly; otherwise use kind or an existing cluster context. @@ -312,6 +322,50 @@ cmd_status() { k3d cluster list } +register_local_gateway() { + local config_home openshell_dir gateway_dir endpoint + + if [[ ! "${GATEWAY_NAME}" =~ ^[A-Za-z0-9._-]+$ ]]; then + echo "error: HELM_K3S_GATEWAY_NAME must contain only letters, numbers, dots, underscores, or dashes" >&2 + return 2 + fi + + config_home="${XDG_CONFIG_HOME:-${HOME}/.config}" + openshell_dir="${config_home}/openshell" + gateway_dir="${openshell_dir}/gateways/${GATEWAY_NAME}" + endpoint="http://127.0.0.1:${GATEWAY_HOST_PORT}" + + mkdir -p "${gateway_dir}" + chmod 700 "${gateway_dir}" 2>/dev/null || true + cat >"${gateway_dir}/metadata.json" </dev/null || true + printf '%s' "${GATEWAY_NAME}" >"${openshell_dir}/active_gateway" + chmod 600 "${openshell_dir}/active_gateway" 2>/dev/null || true + + echo "Registered and selected local gateway '${GATEWAY_NAME}' at ${endpoint}." +} + +cmd_forward() { + require_supported_os + require_kubectl + + echo "Forwarding gateway to http://127.0.0.1:${GATEWAY_HOST_PORT}" + echo "Press Ctrl-C to stop." + kubectl \ + --kubeconfig="${KUBECONFIG_TARGET}" \ + --context="$(k3d_context_name)" \ + --namespace="${GATEWAY_NAMESPACE}" \ + port-forward service/openshell "${GATEWAY_HOST_PORT}:8080" +} + main() { local sub="${1:-}" case "${sub}" in @@ -320,6 +374,8 @@ main() { start) cmd_start ;; stop) cmd_stop ;; status) cmd_status ;; + register) register_local_gateway ;; + forward) cmd_forward ;; -h | --help | help | "") usage ; [[ -n "${sub}" ]] || exit 1 ;; *) echo "error: unknown command '${sub}'" >&2 From 572843baf8a68263dda80a46441d1697e201ba74 Mon Sep 17 00:00:00 2001 From: krishicks Date: Wed, 26 Aug 2026 15:39:18 +0000 Subject: [PATCH 2/2] docs(agents): clarify user-visible PR review feedback (#2910) Agents will often give a ton of feedback, but it can be hard to quantify the impact of the issue the feedback is about. This change updates the PR review feedback template to be more human-readable, rooting any concerns in user-visible behavior when appropriate, and comparing the new behavior to old behavior so that PR authors can make a determination of whether they want to accept or reject the feedback. Signed-off-by: Kris Hicks --- .agents/skills/review-github-pr/SKILL.md | 27 ++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.agents/skills/review-github-pr/SKILL.md b/.agents/skills/review-github-pr/SKILL.md index 1058bfb3e9..21cd131885 100644 --- a/.agents/skills/review-github-pr/SKILL.md +++ b/.agents/skills/review-github-pr/SKILL.md @@ -102,7 +102,9 @@ Read through the full diff (and the PR description if available). Produce a summ ### Potential Concerns <- omit if none -- +- **** — Before this PR, + experienced . With this PR, , so + . Details: `:`. ``` **Guidelines for the summary:** @@ -110,7 +112,28 @@ Read through the full diff (and the PR description if available). Produce a summ - **Overview**: State what changed and why. Pull context from the PR description if available. - **Key Design Decisions**: Focus on _why_ something was done a particular way, not _what_ changed. Include `file_path:line_number` references. Examples: choice of algorithm, new abstraction introduced, API contract change, migration strategy. - **Notable Code**: Include only the most instructive or surprising snippets. Keep each snippet under 15 lines. Always include the file path above the code block. -- **Potential Concerns**: Only include if there are genuine risks — missing error handling, breaking changes, performance implications, security issues. Do not fabricate concerns. +- **Potential Concerns**: Only include genuine risks that warrant a change or a + deliberate accept/reject decision. Describe each concern in terms of observable + behavior for the affected persona, such as a sandbox creator, sandbox user, + operator, administrator, SDK consumer, or developer maintaining the system. + Always compare the previous behavior with the new concerning behavior and state + the resulting user-visible impact. Prefer the compact form: "Before this PR, + `` experienced ``. With this PR, ``, so + ``." Add only the minimum file and line references needed to substantiate + the finding. + - Use the PR base as the normal previous-behavior baseline. Review older history + only when the change is fixing or extending an earlier feature and that history + is necessary to explain the behavioral contract. In that case, describe the + relevant transitions explicitly: "Before ``, ... After ``, ... + With this PR, ...". + - Translate internal failure modes and race conditions into what the affected + person would observe. Internal implementation details belong in the trailing + file and line references, not in place of the behavior description. + - Do not assign P0/P1/P2 or similar priority labels. The behavioral comparison + and impact should give maintainers enough context to accept or reject the + suggested change. + - Do not fabricate concerns or claim a behavioral regression without evidence + for both the prior and proposed behavior. - **Agent infrastructure**: When the PR changes behavior, commands, or development workflows, use the `sync-agent-infra` maintenance map to check that related skills were updated. When it adds, removes, or renames skills or crates; changes workflow relationships or skill coverage; modifies issue or PR templates; or changes agent cross-references, apply the full consistency checklist. Report missing companion updates or drift under **Potential Concerns**. ## Step 5: Output