# Open Source Contribution — CNCF Automation (cncf/automation) — PR #769

> Author: Lokesh Ram Chand, software engineer in Hyderabad. Portfolio: https://lokeshrc.me
> Public write-up (preferred for citation): https://lokeshrc.me/blog/cncf-kubevirt-runner-empty-jitconfig

## Overview

| Field | Details |
| --- | --- |
| Project | CNCF Automation |
| Repository | automation |
| Repository URL | https://github.com/cncf/automation |
| Organization | Cloud Native Computing Foundation (CNCF) |
| Contribution Type | Correctness bug fix (functional regression) + testability refactor, in Go infrastructure code |
| Role | External contributor (community member), reporter and author |
| Start Date | 2026-10-20 |
| End Date | 2026-10-20 |
| Status | Merged |
| Primary Language(s) | Go |
| Technologies / Frameworks | Go, `golang.org/x/crypto/ssh`, KubeVirt (`kubevirt.io/v1` VirtualMachine resources via the Kubernetes dynamic client), `k8s.io/client-go`, Cobra CLI framework, Go table-driven unit testing (`t.Setenv`), GitHub Actions self-hosted runner JIT provisioning, Prow (`cncf/prow-github-actions`), DCO-based Git workflow |
| Area | `ci/cloudrunners` — self-hosted CI runner infrastructure, specifically the KubeVirt-on-Kubernetes ephemeral-runner provider |

---

## Project Context

### What the Project Is

`cncf/automation` is a polyglot infrastructure monorepo maintained by the Cloud Native Computing Foundation to automate the operational work of running CNCF itself: self-hosted GitHub Actions CI capacity, maintainer and project-lifecycle tooling, community ambassador-program scripts, and landscape-data tooling. It is live production infrastructure — code that runs inside CNCF's own Kubernetes clusters, provisions real compute, and handles real GitHub Actions runner registration credentials — not a documentation or demo repository.

The repository has no root build and no shared package manager; each of its pillars is independent and is expected to be worked on from inside its own subdirectory:

- **`ci/`** — self-hosted GitHub Actions runner infrastructure: Go programs that talk to cloud and cluster APIs (Oracle Cloud Infrastructure, KubeVirt-on-Kubernetes, and a manually-run GCP path) to launch an ephemeral compute resource on demand, SSH into it, bootstrap and start a GitHub Actions "just-in-time" (JIT) runner on it, hand off exactly one CI job to it, and tear it down — plus the Terraform/OpenTofu and Packer tooling that manages the underlying Kubernetes clusters and VM images, and the Helm/ArgoCD manifests that deploy all of it.
- **`utilities/`** — standalone Go and Python tools (a CNCF Landscape sync tool, a Landscape MCP server, a "dot-project" metadata validator/bootstrapper).
- **`Ambassadors/`** and **`Kubestronaut/`** — Python automation for CNCF's community programs (Google Sheets–driven ambassador tracking; Shopify coupon/kit operations for the Kubestronaut certification program).
- **`tests/syntax_check.py`** — a lightweight CI gate that `py_compile`s every tracked Python file in the repository; it is a syntax check, not a functional test suite, and intentionally runs without credentials.

There are six independent Go modules in the repository, each with its own `go.mod`, build, and test command, with no Go workspace (`go.work`) tying them together: `ci/cloudrunners`, `ci/gha-runner-vm`, `ci/gha-runner-vm-oci`, `utilities/dot-project`, `utilities/landscape-mcp-server`, and `utilities/landscape-sync`. This is a deliberate architectural choice: nothing in the Go module graph forces consistency between, say, the OCI cloudrunner provider and the KubeVirt cloudrunner provider, even though they live in the same directory tree and solve the same problem for two different compute backends. The repository enforces one cross-cutting consistency rule strictly — a Go-version guard, driven by `.go-version` as the single source of truth and checked in CI by `.github/scripts/check-go-version.sh` against every `go.mod`, every `FROM golang:` Dockerfile line, every Go tarball download URL, and every hardcoded `go-version:` field in a workflow — but nothing analogous exists for *logic* consistency between sibling implementations; that has to be maintained by hand, by whoever happens to be looking.

Governance follows the Kubernetes/CNCF community-tooling norm: Prow-style slash commands (`/kind`, `/area`, `/priority`, `/status`, `/lgtm`, `/approve`, `/hold`) are wired through `cncf/prow-github-actions` via `.github/workflows/prow.yml`, routed by `.github/prow.yaml` and per-directory `OWNERS` files declaring reviewers/approvers. Every commit requires DCO sign-off (`git commit -s`, producing a `Signed-off-by:` trailer). GitHub Actions workflows are expected to be SHA-pinned, checked by the Kusari Inspector via `kusari.yaml`.

### My Contribution Context

This contribution sits in the same `ci/cloudrunners` subsystem as, and is a direct continuation of, an earlier contribution of mine two days prior: PR #763 (closing issue #762), which removed a `bash -x` shell-tracing flag from the Oracle Cloud Infrastructure (OCI) cloudrunner provider because it caused a GitHub Actions JIT runner credential to be echoed into pod logs. That fix matched an existing, already-merged precedent in the sibling KubeVirt provider: commit `9b361771` ("prevent secret exposure," merged 2026-03-12 by maintainer Koray Oksay with Copilot co-authorship), which had fixed the identical `bash -x` leak in `ci/cloudrunners/kubevirt/main.go` five months earlier.

In the course of basing #763 on that precedent, I read `9b361771`'s diff closely enough to model my own fix on it — and in doing so, noticed that the precedent commit itself contained a second change, bundled into the same "prevent secret exposure" commit, that looked logically inverted from what it was clearly trying to do. That second change is what this contribution (issue #768, fixed by PR #769) addresses: not a secret-exposure problem this time, but a complete functional regression in the KubeVirt provider's ability to start a working runner at all, introduced as an unintended side effect of the very commit that was supposed to be a pure security hardening.

### Relevant Component

- `ci/cloudrunners/kubevirt/main.go` — the KubeVirt-on-Kubernetes provider; specifically the command-execution loop inside its `run` function (the analog of the OCI provider's `runOnMachine`), which SSHes into a freshly created `kubevirt.io/v1` `VirtualMachine` and runs the same kind of fixed provisioning/runner-startup command sequence as the OCI provider, ending in the command that starts the actual GitHub Actions runner process with a JIT config.
- `ci/cloudrunners/kubevirt/main_test.go` — a new file this contribution adds, the first unit test in this particular binary's package, covering the extracted `expandCommand` helper.
- `ci/cloudrunners/pkg/remote/client.go` — the shared SSH client wrapper (`DialWithRetry`, `SSHClient.RunCommand`) used identically by the OCI and KubeVirt providers; its behavior (SSH sessions do not forward the invoking process's environment variables to the remote shell) is the specific, non-obvious fact that turns an inverted conditional into a complete runtime failure rather than merely a latent/inert one.
- `ci/cloudrunners/kubevirt/pkg/kubevirt` — the package wrapping the Kubernetes dynamic client calls that create, watch, and delete the `VirtualMachine` resource (`NewEphemeralMachine`, `WaitForInstanceReady`, `IP`, `Delete`); read for context but not modified by this PR.
- Commit `9b361771` (`ci/cloudrunners/kubevirt/main.go`, 2026-03-12) — the precedent commit this contribution corrects; not modified directly (it's already merged history) but effectively superseded in part by this PR's diff.

---

# Contributions

## Contribution 1 — Fix an inverted substitution guard in the KubeVirt cloudrunner that silently sent GitHub Actions runners an empty JIT config, and extract the logic into a unit-tested helper

**Type:** Correctness bug fix (functional regression, zero confidentiality component) + refactor-for-testability
**Status:** Merged (PR #769), closing issue #768
**Date:** Reported and fixed 2026-10-20

### Problem

`ci/cloudrunners/kubevirt/main.go`'s command-execution loop, after commit `9b361771` ("prevent secret exposure," 2026-03-12), looked like this:

```go
for _, cmd := range commands {
	log.Println("running ssh command", "command", cmd)

	sensitive := strings.Contains(cmd, "ACTIONS_RUNNER_INPUT_JITCONFIG")
	expanded := cmd
	if !sensitive {
		expanded = strings.ReplaceAll(cmd, "${ACTIONS_RUNNER_INPUT_JITCONFIG}", os.Getenv("ACTIONS_RUNNER_INPUT_JITCONFIG"))
	}

	output, err := sshClient.RunCommand(ctx, expanded)
	if err != nil {
		if sensitive {
			log.Println(err, "running ssh command", "command", cmd)
		} else {
			log.Println(err, "running ssh command", "command", cmd, "output", string(output[:]))
		}
		return fmt.Errorf("running command %q: %w", cmd, err)
	}
	if sensitive {
		log.Println("command succeeded", "command", cmd)
	} else {
		log.Println("command succeeded", "command", cmd, "output", string(output))
	}
}
```

The `sensitive` flag is computed once and then used for **two different purposes** in this function, and only one of those two uses is correct. The *second* use — gating whether the log lines include `output` at all — is exactly what `9b361771` intended and is correct: for the one command that mentions the JIT config, don't log its (potentially secret-bearing) output. The *first* use, however, is the bug: `expanded` is only computed by substituting the real secret in when `!sensitive` — meaning for the one command that actually contains the placeholder (the final `bash /home/ubuntu/run.sh --jitconfig "${ACTIONS_RUNNER_INPUT_JITCONFIG}"` line), the substitution is **skipped entirely**, and `expanded` is left equal to `cmd` — the literal, unexpanded string, placeholder and all.

That alone wouldn't necessarily be fatal if the remote shell had some other way to resolve `${ACTIONS_RUNNER_INPUT_JITCONFIG}` to the real value — for instance, if the SSH session forwarded the calling process's environment. It doesn't: `ci/cloudrunners/pkg/remote`'s `SSHClient.RunCommand` opens a plain `ssh.Session` and calls `CombinedOutput(cmd)` on it with no environment-forwarding step, and standard SSH semantics don't forward the client process's environment to the remote shell unless explicitly configured to (which this code never does). So when the un-substituted command string reaches the VM, the remote bash shell sees a shell variable named `ACTIONS_RUNNER_INPUT_JITCONFIG` that was simply never set in its environment, and `${ACTIONS_RUNNER_INPUT_JITCONFIG}` expands to an empty string under ordinary POSIX parameter-expansion rules. The runner is started as:

```
bash /home/ubuntu/run.sh --jitconfig ""
```

GitHub's runner bootstrap script requires a real, valid JIT config to register and authenticate with GitHub's Actions service; started with an empty string instead, the runner process cannot register at all. Practically, every KubeVirt-launched VM would come up, connect over SSH successfully, run every provisioning step successfully, and then fail (or hang, depending on how `run.sh` itself handles an empty `--jitconfig`) at the one step that actually matters — starting a working CI runner. The cloudrunner's SSH command itself might report success (if `run.sh` exits 0 despite the empty argument) or failure (if it validates the argument and exits non-zero) depending on exactly how the vendored runner script handles that case, but either way the CI job this VM was launched to run would never actually execute on it.

This bug was introduced *by* the same commit, `9b361771`, that was fixing the unrelated `bash -x` secret-leak issue — it's a case of a correctness regression riding in on a security fix, in the same hunk of the same diff, presumably because the `sensitive` flag's two responsibilities (what to send vs. what to log) were conflated into a single `if !sensitive { ... }` branch that only actually needed to gate the logging, not the substitution.

### My Work

I found this not by independently hunting for new bugs, but by holding the precedent commit I was about to *copy* to the same scrutiny I'd apply to any other code before basing new work on it. Having used `9b361771`'s "drop `bash -x`" change as the explicit template for PR #763 two days earlier, I read the rest of that commit's diff — the part beyond the one line I was mirroring — closely enough to understand *why* it was shaped the way it was, and in doing so noticed that the `if !sensitive { expand }` guard didn't match its own evident intent. The intent, stated in the commit's own structure (expand-then-log, with logging gated on sensitivity), was clearly "always compute the real command to send, but don't put the sensitive command's output in the logs." What the code actually did was "if this command is the sensitive one, send the *unexpanded placeholder* instead of the real command" — an easy one-line logic inversion to introduce when adding a conditional to an existing assignment, and exactly the kind of bug that's invisible from the diff's intent (which reads correctly) and only visible from tracing what the resulting code actually computes.

To build concrete, verifiable confidence in the bug — not just a plausible-sounding read of the logic — I extracted the relevant logic verbatim and ran it standalone:

```go
os.Setenv("ACTIONS_RUNNER_INPUT_JITCONFIG", "SECRET-JIT")
cmd := `bash /home/ubuntu/run.sh --jitconfig "${ACTIONS_RUNNER_INPUT_JITCONFIG}"`
sensitive := strings.Contains(cmd, "ACTIONS_RUNNER_INPUT_JITCONFIG")
expanded := cmd
if !sensitive {
	expanded = strings.ReplaceAll(cmd, "${ACTIONS_RUNNER_INPUT_JITCONFIG}", os.Getenv("ACTIONS_RUNNER_INPUT_JITCONFIG"))
}
fmt.Println(expanded)
// bash /home/ubuntu/run.sh --jitconfig "${ACTIONS_RUNNER_INPUT_JITCONFIG}"
```

This reproduced the exact failure mode in isolation, with no SSH, no Kubernetes, and no real credentials involved: `expanded` prints as the untouched placeholder string, confirming that the one command that matters is never substituted by this code path, regardless of environment.

I then went a step further than I had for the earlier OCI leak report and validated the *second* half of the claim — that an unexpanded placeholder sent over a real SSH session actually resolves to an empty string on the far end, rather than, say, some SSH client/server configuration passing environment variables through in a way I hadn't accounted for — by testing against a real SSH server (not a live KubeVirt cluster, but a genuine SSH session rather than a purely in-process string simulation). That test confirmed the old code's behavior sends an empty token where the fixed code sends the real one, which is the piece of evidence I would go on to need almost immediately once the finding was questioned (see **Review / Discussion**, below).

I filed this as issue #768 with the full before/after logic, an explicit statement of the mechanism (SSH sessions don't forward environment variables — the specific domain fact that turns "a placeholder is left in a string" into "the remote shell resolves that placeholder to nothing"), an explicit callback to `9b361771` as the regression's origin and date, and an explicit note that I had verified the logic in isolation but had *not* run it against a live KubeVirt cluster, followed by a stated proposed fix (always expand; keep `sensitive` only for the already-correct log-suppression behavior) ahead of opening any code.

### Technical Implementation

The PR's diff does three things: fixes the inverted guard, extracts the fixed logic into a small, independently testable pure function, and adds a unit test for that function.

```diff
 	for _, cmd := range commands {
 		log.Println("running ssh command", "command", cmd)

-		sensitive := strings.Contains(cmd, "ACTIONS_RUNNER_INPUT_JITCONFIG")
-		expanded := cmd
-		if !sensitive {
-			expanded = strings.ReplaceAll(cmd, "${ACTIONS_RUNNER_INPUT_JITCONFIG}", os.Getenv("ACTIONS_RUNNER_INPUT_JITCONFIG"))
-		}
+		expanded, sensitive := expandCommand(cmd)

 		output, err := sshClient.RunCommand(ctx, expanded)
 		if err != nil {
 			...
```

and, further down in the file:

```go
const jitConfigPlaceholder = "${ACTIONS_RUNNER_INPUT_JITCONFIG}"

// expandCommand substitutes the JIT config placeholder in cmd with the real value
// and reports whether cmd carries the secret, so callers can keep the expanded
// command and its output out of the logs. The unexpanded cmd is always safe to log.
func expandCommand(cmd string) (expanded string, sensitive bool) {
	sensitive = strings.Contains(cmd, jitConfigPlaceholder)
	return strings.ReplaceAll(cmd, jitConfigPlaceholder, os.Getenv("ACTIONS_RUNNER_INPUT_JITCONFIG")), sensitive
}
```

Three deliberate properties of this implementation are worth calling out:

1. **The substitution is now unconditional.** `strings.ReplaceAll` is called on every command, every time, with no `if` guarding whether it runs. For the overwhelming majority of commands in the list (the ones with no `${ACTIONS_RUNNER_INPUT_JITCONFIG}` substring at all), `ReplaceAll` is simply a safe no-op — it finds nothing to replace and returns the input unchanged — so unconditionally calling it carries no behavioral risk for any other command in the list; it only matters for the one command that actually contains the placeholder, which is exactly the one command that was previously (and wrongly) skipped.
2. **`sensitive` is now purely a downstream signal, not a gate on `expanded`.** It's computed from the same `strings.Contains` check as before and returned alongside `expanded`, so every call site that previously used `sensitive` to decide what to log still works exactly as before (that logic was never touched, because it was never wrong) — only its *source* changed, from an inline block duplicated in the loop to a single function call.
3. **The placeholder string itself was promoted to a named constant** (`jitConfigPlaceholder`), eliminating a previously-duplicated magic string (`"${ACTIONS_RUNNER_INPUT_JITCONFIG}"` had appeared both in the `strings.Contains` check and in the `strings.ReplaceAll` call, as two independently-typed literals that happened to need to stay identical) — a small, naturally-occurring cleanup that falls directly out of consolidating the logic into one function, not a separate, unrelated change bundled in.

The accompanying test, in a brand-new `ci/cloudrunners/kubevirt/main_test.go` (the first test file in this binary's package):

```go
package main

import "testing"

func TestExpandCommand(t *testing.T) {
	t.Setenv("ACTIONS_RUNNER_INPUT_JITCONFIG", "s3cr3t")

	tests := []struct {
		name          string
		cmd           string
		wantExpanded  string
		wantSensitive bool
	}{
		{
			name:          "jitconfig is substituted and flagged sensitive",
			cmd:           `bash run.sh --jitconfig "${ACTIONS_RUNNER_INPUT_JITCONFIG}"`,
			wantExpanded:  `bash run.sh --jitconfig "s3cr3t"`,
			wantSensitive: true,
		},
		{
			name:         "plain command is untouched",
			cmd:          "sudo sysctl fs.inotify.max_user_instances=1280",
			wantExpanded: "sudo sysctl fs.inotify.max_user_instances=1280",
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			expanded, sensitive := expandCommand(tt.cmd)
			if expanded != tt.wantExpanded {
				t.Errorf("expanded = %q, want %q", expanded, tt.wantExpanded)
			}
			if sensitive != tt.wantSensitive {
				t.Errorf("sensitive = %v, want %v", sensitive, tt.wantSensitive)
			}
		})
	}
}
```

uses Go's `t.Setenv` (which scopes the environment variable to the test and automatically restores it afterward, and automatically fails the test if run with `t.Parallel()` alongside other env-mutating tests — not used here, correctly, since this test doesn't need to run in parallel with anything) to set a known, fake JIT value, then exercises both branches: the one command that should be substituted-and-flagged, and a representative plain command that should pass through untouched and unflagged. This is exactly the kind of regression this bug *was* — a condition that's right for most commands and wrong for exactly one specific one — so a test that explicitly covers both the "ordinary command" and "the one special command" cases is the correct shape of test to prevent this exact class of regression from recurring silently in the future, which the original, unextracted, untested inline code had no way to guard against at all.

### Technologies / Concepts

- **Go** — pulling inline, duplicated conditional logic out into a small pure function with named return values (`expanded string, sensitive bool`), which simultaneously fixes a bug and makes the logic unit-testable without any SSH or Kubernetes dependency.
- **POSIX shell parameter expansion** — specifically, that an unset shell variable referenced as `${VAR}` expands to an empty string rather than erroring (by default, without `set -u`), which is the precise mechanism that turns "the placeholder didn't get substituted" into "the runner got a silently empty, not obviously-wrong-looking argument" rather than some louder, more visible failure.
- **SSH session environment semantics** — that `ssh`/`golang.org/x/crypto/ssh` sessions do not forward the client process's environment variables to the remote shell by default, which is the domain fact that makes the Go-side placeholder substitution load-bearing in the first place (if the environment *were* forwarded, the unsubstituted placeholder would have resolved correctly on the remote end anyway, and the bug would never have manifested).
- **Go testing idioms** — table-driven tests, `t.Run` subtests, `t.Setenv` for environment-scoped test state.
- **Regression analysis of a previously "fixed" commit** — treating an already-merged security fix as something to verify rather than something to trust by default, specifically because it was about to be used as a template for other work.

### Result

The PR was opened, reviewed, and merged within roughly 41 minutes, but — unlike PR #763's essentially frictionless same-day approval — this one involved a real moment of maintainer skepticism about whether the bug was genuine, which I had to address with concrete evidence rather than further code-reading alone (see **Review / Discussion**). The maintainer ultimately recalled independently verifying the underlying behavior "long time ago for PoC," merged the PR, and thanked me for the fix.

### Impact

- Restores the KubeVirt cloudrunner provider's ability to actually start a working, registered GitHub Actions runner at all — this was not a partial degradation or an edge case; with the prior code, **every** KubeVirt-launched VM would have received an empty `--jitconfig` on every run, a complete functional break of the provider's entire purpose.
- Adds the KubeVirt binary's first unit test, and in doing so establishes a pattern (extract security/correctness-sensitive string logic into a small pure function, test it directly) that the module previously had no example of at all.
- Surfaces, and gets explicit maintainer acknowledgment of, the fact that the KubeVirt provider is **not currently used in production** CNCF CI ("We don't use kubevirt runners at the moment, so it does not effect anything") — valuable operational context that de-risks the bug's real-world blast radius today while still being worth fixing correctly before the provider is ever turned on for real traffic.
- Closes out, two days after the fact, a second and independently-discovered defect in the exact commit (`9b361771`) that had been held up as the trusted precedent for PR #763 — a concrete demonstration that "match the existing, already-reviewed fix" is a good default but not a substitute for verifying that the thing being matched was actually fully correct.

### Pull Request

https://github.com/cncf/automation/pull/769 — "fix(cloudrunners/kubevirt): expand JIT config before running the runner"

### Issue

https://github.com/cncf/automation/issues/768 — "fix(cloudrunners/kubevirt): JIT config placeholder is never expanded, runner starts with empty --jitconfig"

### Commit(s)

- `a5e74eaace913e493885ff5cffc8f5c624cffda4` — `fix(cloudrunners/kubevirt): expand JIT config before running the runner` (the feature-branch commit), DCO-signed.
- `0b119e9d3ac24ecce928594d0fc2f00bef4ab7d7` — the corresponding commit as it landed on `main` (PR #769), identical message and content, DCO-signed (`Signed-off-by: lokeshramchand-ctrl`).

### Review / Discussion

This review thread is the most substantively interesting part of this contribution, because it didn't go through cleanly on the first pass — the maintainer initially doubted the bug was real, and the thread records exactly how that got resolved:

1. I opened the PR and immediately commented `/assign @koksay`, routing review to the same maintainer who had authored the original `9b361771` commit this issue was a regression within — again, the person with the most relevant context to evaluate it quickly.
2. Prow's `github-actions` bot posted the standard `[APPROVALNOTIFIER]` comment noting that `OWNERS`-file approval from `koksay` in `ci/cloudrunners/OWNERS` was the outstanding requirement.
3. `koksay` responded with direct, reasonable skepticism rather than an immediate approval: *"@lokeshramchand-ctrl Did you actually test this out? I'm quite sure it worked well when I tried it out back then. (We don't use kubevirt runners at the moment, so it does not effect anything)"* — pushing back on the premise (maybe it already worked, from the original author's own recollection of testing it) and separately noting that even if true, current operational impact was zero, since the provider isn't live.
4. I responded with the specific, concrete evidence I had already gathered before opening the PR, rather than re-arguing from the code alone: *"@koksay, I tested it on a real SSH server and the old code sends an empty token to the runner, the fix sends the real one. I'm happy to close this, if it doesn't effect anything."* This did two things at once: it supplied falsifiable, empirical evidence (a real SSH session, not just a read of the source) directly addressing the "did you actually test this" question, and it explicitly signaled I wasn't attached to the finding being acted on if the maintainer, with better context on the provider's actual usage, judged it not worth merging — a genuinely low-ego framing given that I had, by that point, already done real verification work.
5. `koksay` then updated based on that evidence, connected it to their own memory of the original work, and merged: *"Ok, I tested this long time ago for PoC. Merged the changes, thanks for the PR."* — and followed up minutes later with `/lgtm` and `/approve` to formally clear the `OWNERS` gate. I closed the thread with a short, appreciative reply acknowledging the context about the provider's current non-use: *"Thanks for the review and the merge! That makes sense. Appreciate you taking the fix even though kubevirt runners aren't in use right now."*

This is a meaningfully different, and more demanding, review dynamic than PR #763's: there, the precedent and the evidence were strong enough that the maintainer never needed to ask a clarifying question at all. Here, a maintainer with direct, specific personal history on exactly this code ("I'm quite sure it worked well when I tried it out back then") raised a substantive challenge to the finding itself, and the contribution only lands because the underlying verification work (the real-SSH-server test, done *before* opening the PR, not improvised in response to the question) was solid enough to answer it immediately and specifically.

---

# Technical Depth

## Architecture / System Understanding

The KubeVirt provider is the Kubernetes-native sibling to the OCI and GCP cloud-VM providers in `ci/cloudrunners`: instead of calling a cloud provider's compute API, it creates a `kubevirt.io/v1` `VirtualMachine` custom resource directly through the Kubernetes dynamic client (`k8s.io/client-go/dynamic`), embedding a `dataVolumeTemplates` entry that provisions the VM's root disk from a pre-populated CDI (Containerized Data Importer) `DataSource`, and a `cloudInitNoCloud` volume carrying a `#cloud-config` payload whose only real job is to inject the ephemeral SSH public key generated fresh for this run and disable password-based SSH. This is the same "launch a throwaway VM, SSH into it, provision and run a single CI job on it, destroy it" lifecycle as the OCI provider, but implemented against Kubernetes/KubeVirt's resource model instead of a cloud SDK — meaning "the VM" is, underneath, a `VirtualMachine` object whose actual `VirtualMachineInstance` (VMI) KubeVirt's own controllers reconcile into a running `virt-launcher` pod wrapping a real QEMU/KVM process, entirely inside the Kubernetes cluster rather than against an external cloud API.

This matters for understanding why this specific bug mattered as much as it did despite the provider being unused in production: KubeVirt-as-a-runner-backend is CNCF's path toward running ephemeral CI compute *without* depending on an external cloud's VM API or capacity at all — using whatever bare-metal/virtualization capacity the existing Kubernetes cluster already has. That's architecturally attractive specifically because it removes a third-party dependency the OCI and GCP providers both have (region/shape/capacity availability on an external cloud), but it also means this is very plausibly the provider CNCF would lean on more heavily in the future if it wants to reduce dependence on donated cloud capacity — which is exactly why "it's currently unused, so impact is zero" (true today, per `koksay`'s own comment) doesn't make a complete-functional-break bug in it unimportant to actually fix.

## Important Components

- **`run` (`kubevirt/main.go`)** — builds the `VirtualMachine` resource as a large nested `map[string]interface{}` (since it's constructed and submitted via the untyped `unstructured.Unstructured` Kubernetes API rather than a generated, strongly-typed KubeVirt client), creates it via `kubevirtpkg.NewEphemeralMachine`, waits for VMI readiness, dials SSH, and runs the same category of provisioning/runner-start command sequence as the OCI provider's `runOnMachine` — the function this PR's bug and fix both live inside.
- **`expandCommand` (new, this PR)** — the extracted, now-unit-tested pure function responsible for correctly substituting the JIT config placeholder and reporting whether a given command is the sensitive one, replacing what had been inline, untested, and subtly wrong logic duplicated across each loop iteration.
- **`kubevirtpkg.NewEphemeralMachine` / `WaitForInstanceReady` / `IP` / `Delete`** (`ci/cloudrunners/kubevirt/pkg/kubevirt`) — the Kubernetes-resource-lifecycle counterpart to the OCI provider's `oci.EphemeralMachine`; read for context (to confirm the VM really is torn down the same way regardless of this bug) but not modified.
- **`pkg/remote.SSHClient`** — identical shared SSH wrapper used by both the OCI and KubeVirt providers; its lack of environment forwarding is the load-bearing fact that makes this bug a *complete* failure rather than a harmless no-op.
- **`main_test.go` (new, this PR)** — the first test file for this binary, establishing that at least the string-manipulation logic in this package can be verified without any SSH or Kubernetes dependency at all.

## APIs / Interfaces

- **Kubernetes dynamic client / unstructured API** (`k8s.io/apimachinery/pkg/apis/meta/v1/unstructured`, `k8s.io/client-go/dynamic`) — used to create the `VirtualMachine` custom resource without requiring a generated, strongly-typed KubeVirt Go client as a dependency; read as surrounding context for this fix, not modified by it.
- **`k8s.io/client-go/rest` / `k8s.io/client-go/tools/clientcmd`** — `buildRestConfig`'s three-tier fallback (explicit `--kubeconfig` path, in-cluster service account config, default kubeconfig/`KUBECONFIG`), the standard Kubernetes client-config resolution pattern, letting the same binary run both inside a cluster (as the actual deployed cloudrunner pod would) and from a developer's workstation against an arbitrary cluster for manual testing.
- **`golang.org/x/crypto/ssh`** — identical usage pattern to the OCI provider: `ssh.ClientConfig` with `InsecureIgnoreHostKey()` (reasonable here for the same reason as in OCI: the only trust anchor is the freshly generated keypair injected via cloud-init, not a pre-known host key for a never-before-contacted VM) and `Session.CombinedOutput` via the shared `pkg/remote` wrapper.
- **Go's `testing` package / `t.Setenv`** — the interface this PR's new test exercises; `t.Setenv` specifically because the function under test reads `os.Getenv` directly rather than taking the secret as an explicit parameter, so the test has to simulate the real process-environment dependency rather than just passing a value in.

## Data Structures / Algorithms

The `VirtualMachine` object is built as a deeply nested, untyped `map[string]interface{}` literal mirroring the KubeVirt CRD's YAML shape field-for-field in Go syntax — a common, if verbose, pattern when working against the Kubernetes dynamic client instead of a strongly-typed generated client, since it avoids a dependency on KubeVirt's own (often large and fast-moving) generated Go types at the cost of losing compile-time field-name checking. This structure is read as context but entirely untouched by this fix.

The actual logic this PR changes is a small, purely string-based algorithm: a single substring containment check (`strings.Contains`) to classify a command as sensitive-or-not, and a single global string replacement (`strings.ReplaceAll`) to substitute a placeholder token for a real value. The *bug* was not in either primitive operation (both are used correctly in isolation) but in the control flow wrapping them — gating the replacement on the wrong condition relative to what the replacement was supposed to accomplish. This is a useful, concrete illustration of a general lesson: correctness bugs in infrastructure code are very often not in the primitives (string replace, environment lookup) but in the conditional wiring connecting several individually-correct primitives together for a combined purpose that itself needs separate verification.

## Distributed Systems Concepts

- **Single-use credential delivery over a non-persistent channel** — the same JIT-config delivery mechanism discussed for the OCI provider in the companion contribution (PR #763): a short-lived, single-use credential handed to a freshly launched, soon-to-be-destroyed compute resource, here via SSH command execution rather than cloud-init metadata, with the specific wrinkle that SSH's non-forwarding of environment variables is a deliberate, well-known security property of the protocol (not forwarding the *client's* ambient environment to a remote shell is generally desirable, precisely to avoid leaking local secrets/config into a remote session) that, in this one specific spot, had to be actively worked around (via explicit string substitution) rather than relied upon — and the regression happened exactly where that active workaround was itself broken.
- **Divergent backend implementations for a nominally unified capability** — this bug is a second, independent illustration (alongside PR #763's `bash -x` finding) of the operational cost of the repository's deliberate choice to keep the OCI, KubeVirt, and GCP cloudrunner implementations fully independent, with no shared code path enforcing that a fix (or, in this case, a correctness property) in one backend's command-execution loop is mirrored correctly in another's.
- **Operational risk shaped by actual traffic, not just code presence** — `koksay`'s framing ("we don't use kubevirt runners at the moment, so it does not effect anything") is itself a distributed-systems-operations point worth internalizing: a correctness bug's real-world severity is a function of *code plus traffic*, and a complete, 100%-reproducible functional break in a code path that currently serves zero production traffic is a very different operational risk than the same bug would be in a path serving live CI jobs — worth fixing promptly either way, but not worth treating as an incident.

## Performance Considerations

No measurable performance impact. `strings.ReplaceAll` is now called unconditionally on every command in the provisioning list rather than conditionally on most of them — a handful of additional calls to a function that, for every non-matching command, degenerates to effectively a single substring scan with no match found and returns the input unchanged. On the order of ten short strings, this is immeasurably cheap relative to everything else happening in this function (an SSH round-trip per command, each of which is itself dwarfed by the VM boot and readiness-wait time preceding the whole loop). The meaningful "cost" change, if anything, is purely positive: the KubeVirt provider now actually accomplishes the one thing — starting a registered runner — that all of its preceding, successfully-executing provisioning steps exist to set up.

## Testing

- **Added `TestExpandCommand`** in the new `ci/cloudrunners/kubevirt/main_test.go` — two table-driven subtests: the JIT-config-bearing command (verifying both correct substitution *and* the correct `sensitive=true` classification) and a representative plain command (verifying it passes through untouched and is correctly classified `sensitive=false`). This is, as noted above, exactly the pair of cases that needed to be distinguished correctly for the original bug to not exist, which is what makes it a meaningfully protective regression test rather than an incidental one.
- **`go build ./...`, `go vet ./...`, and `go test ./...`**, run inside `ci/cloudrunners` per the module's standard test command, stated as passing in the PR body.
- **`.github/scripts/check-go-version.sh`**, confirmed passing against the pinned Go 1.27.1 — relevant because this PR touches a `go.mod`-governed module and the repository's CI enforces this check on every PR regardless of whether a change plausibly affects the Go version at all.
- **Manual verification against a real SSH server** (not a simulated/in-process string check) specifically to confirm the empty-token-vs-real-token behavioral difference end-to-end over an actual SSH session — the evidence that ultimately resolved the maintainer's skepticism in review.
- **Explicitly not tested against a live KubeVirt cluster** — stated plainly in the PR body ("Not run against a live KubeVirt cluster"), consistent with the same calibrated-confidence approach taken in the companion OCI contribution: claim exactly what was verified, and no more, especially for infrastructure that's expensive or operationally sensitive to exercise directly.

---

# Engineering Decisions

## Decision 1 — Extract the fix into a small, pure, directly-testable function rather than patching the inline conditional in place

A minimal patch to the bug as originally written would have been a one-character-class change in place — moving or removing the `!` in `if !sensitive`. I chose instead to pull the whole computation out into a standalone `expandCommand(cmd string) (expanded string, sensitive bool)` function and add a dedicated unit test for it.

The reasoning: the bug existed in the first place specifically *because* this logic lived inline inside a loop, with no test coverage and no way to exercise it except by actually running the full provisioning sequence against a real VM. A future edit to this same loop (adding another sensitive-ish command, say, or adjusting the log format again) would have exactly the same blind spot the original `9b361771` commit did unless the logic is both isolated enough to test on its own and actually has a test guarding it. Extracting it costs very little (it's a handful of lines) and converts "a human has to re-derive by reading that this is still correct every time this function is touched" into "a fast, deterministic unit test fails immediately if this regresses again" — directly addressing the actual root cause of how this bug was introduced and sat unnoticed for seven months, not just its symptom.

## Decision 2 — Preserve the original log-redaction mechanism and intent exactly, rather than redesigning it

`9b361771`'s log-suppression behavior (skip logging `output` for the sensitive command, on both the success and failure branches) was correct and is left completely untouched by this PR — only the *substitution* half of that commit's logic is corrected. I did not, for instance, replace the `sensitive`-flag mechanism with something else, or add additional redaction for other potentially-sensitive commands not already flagged, even though I was already in this exact code making a security-adjacent fix.

This mirrors the same restraint applied in the companion PR #763 (documented there as Decision 1): fix precisely the demonstrated defect, leave correct, already-reviewed logic alone, and don't expand scope just because the surrounding code is already open in an editor. It also kept the diff reviewable at a glance against the specific, narrow claim in the issue and PR description — a maintainer checking "does this fix match what was reported, and nothing more" could confirm it in seconds.

## Decision 3 — Answer maintainer skepticism with pre-gathered empirical evidence rather than re-arguing from the code, and explicitly offer to drop the fix if it turns out not to matter

When `koksay` questioned whether the bug was real, I did not respond by re-explaining the code logic in more detail or asserting confidence more strongly — I had already tested the actual behavioral claim (real SSH server, empty token vs. real token) *before* opening the PR, specifically because I'd learned from the OCI contribution two days earlier that a claim about this exact credential-handling code path benefits from being backed by something more concrete than a static read. I supplied that evidence directly, and paired it with an explicit, genuine offer to close the issue if the maintainer's operational context (the provider being unused) meant it truly didn't matter.

This was a deliberate choice about how to handle pushback on a finding: lead with evidence, not insistence, and decouple "I am confident this is a real bug" (which I was, and said so with the specific evidence that justified it) from "I need this specific PR merged" (which I explicitly wasn't attached to, independent of whether the bug was real) — a distinction that, in this case, let the maintainer update quickly and in good faith rather than the exchange turning into a disagreement about whether the reporter was being defensive.

---

# Challenges

## Challenge 1 — Verifying a bug in environment-dependent, SSH-mediated behavior without a live KubeVirt cluster

The specific mechanism here — an unset remote shell variable expanding to empty rather than erroring, and SSH not forwarding the client's environment — is the kind of behavior that's easy to get subtly wrong by reasoning about it abstractly (it's tempting to assume "maybe some SSH config somewhere forwards environment variables" without checking) and that really benefits from being demonstrated rather than merely argued.

### How I Solved It

I split the claim into its two independently-verifiable halves, exactly as with the OCI contribution: first, a pure in-process reproduction of the Go-side logic (showing `expanded` literally equals the untouched placeholder string for the one command that matters) — fully conclusive on its own terms, no infrastructure needed; second, a real SSH session (not a live KubeVirt VM specifically, but a genuine remote-shell test over the real SSH protocol) confirming that an unsubstituted placeholder really does resolve to an empty argument on the far end rather than something else. Chaining those two independently-solid pieces of evidence together fully substantiates the end-to-end claim without requiring the one piece of infrastructure (a live KubeVirt cluster) that would have been expensive and slow to stand up purely to validate a string-substitution bug.

### What I Learned

Having already internalized, from the OCI contribution two days earlier, the value of stating exactly what was and wasn't verified, I went one step further here and pre-emptively did the one additional piece of real-world verification (a genuine SSH session, not just an in-process string check) that I correctly anticipated would matter most if the finding were challenged — which it was, almost immediately. Anticipating *which* piece of evidence a skeptical, highly-contextual reviewer is most likely to ask for, and having it ready before they ask, turns a potentially multi-round review cycle into a single exchange.

## Challenge 2 — Responding to direct skepticism from the maintainer who wrote the original, regressed code — and who had personally tested it before

`koksay`'s pushback wasn't a vague "are you sure?" — it was specific and carried real authority: they had written the commit in question, and said plainly that they recalled it working when they tried it. That's a materially harder objection to answer than a generic request for more detail, because it's backed by the original author's own direct memory of the system behaving correctly.

### How I Solved It

I didn't try to argue that the maintainer's memory was wrong or litigate why their earlier test might have differed from what the current code does — I simply presented the concrete evidence I had (a real SSH-server test showing the specific before/after difference) and let it speak for itself, while explicitly leaving the final call on whether to act on it with the maintainer, given they had better visibility into whether it mattered operationally right now. The resolution — `koksay` recalling that *their* earlier test was "long time ago for PoC," which is consistent with a regression having been introduced later (by the same `9b361771` commit, months after that original PoC) — wasn't something I could have asserted myself with any confidence, since I had no visibility into when `koksay`'s original testing happened relative to the regression; it only came out because I supplied the specific, dated evidence and let the maintainer connect it to their own history rather than trying to win the point unilaterally.

### What I Learned

When a finding is challenged by someone with more direct, personal history with the exact code than I have, the productive move is to supply the most specific evidence available and stay genuinely open to being wrong or to the finding not mattering — not to double down on the original analysis. The maintainer's own prior-knowledge update ("I tested this long time ago for PoC") was the thing that actually resolved the thread, and it only happened because the exchange stayed collaborative and evidence-first rather than becoming a disagreement about who was right.

---

# Collaboration

## Maintainer / Contributor Interaction

Direct back-and-forth with `koksay`, the same `ci/cloudrunners`-area `OWNERS` approver and author of the original `9b361771` commit this issue regressed within. Unlike the companion PR #763, this interaction included a substantive, specific challenge to the finding from the maintainer, which I addressed directly with evidence rather than deflecting or over-explaining, and which resolved with the maintainer updating their own understanding and thanking me for the fix.

## Code Review

Formal review consisted of `koksay`'s `/lgtm` + `/approve`, satisfying the `OWNERS`-file gate — but the substantive review content happened in the issue thread (#768) immediately before the approval, where the maintainer's skepticism and my evidence-backed response constituted the actual review exchange that determined whether this merged.

## Design Discussions

As with PR #763, there was no separate design-discussion thread about the *shape* of the fix (always-expand, keep the sensitive-flag-based log suppression) — that was stated plainly in the issue's "Proposed fix" section before any code was written, and the PR implemented exactly that. The only point actually contested in review was whether the underlying bug was real at all, not how to fix it.

## Collaboration Skills Demonstrated

- Treating an already-merged, maintainer-authored commit as something to verify rather than defer to, specifically at the moment it was about to be relied on as a template for other work — and following through on what that scrutiny surfaced even though it meant filing a second issue against the same commit within days of the first.
- Responding to direct, specific skepticism from the original author of the regressed code with calibrated, pre-gathered evidence rather than defensiveness or escalation.
- Explicitly decoupling "I'm confident this is correct" from "I need this merged regardless," which let a legitimately uncertain maintainer update quickly and in good faith.
- Closing the loop graciously once resolved, acknowledging the maintainer's operational context (the provider's current non-use) rather than treating the merge as simply a win to move past.

---

# Outcomes

## Code

`ci/cloudrunners/kubevirt/main.go`: `+11/-5` across the fixed loop and the new `expandCommand` helper plus its `jitConfigPlaceholder` constant. A new file, `ci/cloudrunners/kubevirt/main_test.go`: `+38`, adding `TestExpandCommand`. Total `+49/-5` across two files. Landed on `main` as commit `0b119e9d3ac24ecce928594d0fc2f00bef4ab7d7`.

## Project Impact

Restores actual, working functionality to the KubeVirt cloudrunner provider's core purpose (starting a registered, usable GitHub Actions runner), which had been completely broken — silently, with no error signal distinguishing it from a healthy run unless someone specifically checked whether the resulting runner ever registered — since the `9b361771` commit seven months earlier. Gives the module its first unit test and establishes a directly reusable pattern (small pure function, table-driven test) for any future sensitive-value-handling logic added to either cloudrunner provider. Surfaces explicit, maintainer-confirmed operational context (KubeVirt runners aren't currently in production use) that's valuable institutional knowledge for anyone else who touches this provider next.

## User / Developer Impact

Directly benefits whoever eventually turns the KubeVirt provider on for real CNCF CI traffic — without this fix, that would have meant debugging a confusing total failure (runners that never register, for reasons that wouldn't be obvious from the cloudrunner's own logs, which show the command string, not the fact that `${ACTIONS_RUNNER_INPUT_JITCONFIG}` resolved to nothing on the far end) at exactly the point someone was trying to validate a new, Kubernetes-native CI backend. Indirectly reinforces the trustworthiness of the OCI fix (PR #763) by demonstrating the precedent it was based on has now itself been fully corrected.

## Recognition

Reviewed and merged by maintainer `koksay`, who, after initial skepticism resolved by direct evidence, explicitly thanked the contribution ("Merged the changes, thanks for the PR") and engaged further in a brief, appreciative closing exchange.

---

# Skills Demonstrated

## Programming

Go (extracting inline logic into small, named-return-value pure functions; table-driven unit testing with `t.Setenv`; careful, line-by-line tracing of control flow to find a conditional that's inverted relative to its own evident intent).

## Software Engineering

Regression analysis of previously-merged code; converting untested, inline, loop-embedded logic into an isolated, directly-testable unit; calibrated evidence-gathering proportional to the specificity of an anticipated objection; responding productively and non-defensively to direct technical pushback from the original code's author.

## Systems

POSIX shell parameter-expansion semantics for unset variables; SSH session environment-forwarding behavior (or lack thereof) and its specific interaction with secret-substitution logic performed on the client side before a command is ever sent remotely.

## Distributed Systems

Single-use-credential delivery over a session that deliberately does not share ambient process state (environment variables) between client and remote shell; reasoning about a bug's real-world severity as a function of both code correctness and actual production traffic, not code correctness alone.

## Infrastructure / Cloud

KubeVirt `VirtualMachine`/VMI resource model via the Kubernetes dynamic/unstructured client; `cloudInitNoCloud` ephemeral-SSH-key injection; CDI `DataSource`-backed root-disk provisioning; the broader multi-backend (OCI/KubeVirt/GCP) self-hosted-runner architecture this fix operates within.

## Open Source

Working within an OWNERS/Prow governance model under genuine, substantive maintainer pushback rather than only in the easy case of frictionless approval; routing review to the contextually-correct person; responding to a direct, author-level challenge to a finding with evidence rather than argument; DCO sign-off discipline; closing the loop with appropriate thanks and acknowledgment once resolved.

---

# Evidence

| Evidence | URL / Reference | Description |
| --- | --- | --- |
| Repository | https://github.com/cncf/automation | CNCF's internal automation monorepo (CI infra, utilities, community-program scripts) |
| Pull Request | https://github.com/cncf/automation/pull/769 | "fix(cloudrunners/kubevirt): expand JIT config before running the runner" — merged |
| Issue | https://github.com/cncf/automation/issues/768 | "fix(cloudrunners/kubevirt): JIT config placeholder is never expanded, runner starts with empty --jitconfig" — closed by the PR, includes the maintainer skepticism/evidence exchange |
| Commit (branch) | `a5e74eaace913e493885ff5cffc8f5c624cffda4` | Feature-branch commit implementing the fix and the new test, DCO-signed |
| Merge commit | `0b119e9d3ac24ecce928594d0fc2f00bef4ab7d7` | Same change as it landed on `main`, 2026-10-20T11:27:59Z |
| Regressed precedent commit | `9b361771` | "prevent secret exposure" — the earlier commit this PR corrects a hidden defect within |
| Related PR | https://github.com/cncf/automation/pull/763 | The companion OCI-provider fix that was explicitly modeled on `9b361771`, and whose review of that precedent surfaced this issue |

---

# Key Technical Keywords

Go, KubeVirt, Kubernetes dynamic client, `VirtualMachine`/VMI, cloud-init, CDI DataSource, GitHub Actions, self-hosted runners, JIT (just-in-time) runner registration, SSH (`golang.org/x/crypto/ssh`), environment-variable forwarding semantics, POSIX parameter expansion, logic-inversion regression, pure-function extraction, table-driven unit testing, `t.Setenv`, Cobra CLI, DCO sign-off, Prow (`cncf/prow-github-actions`), OWNERS-based code review, CNCF, root-cause/regression analysis, evidence-based technical communication under review pushback.

---

# Related Work

This contribution is the direct continuation of a short, related sequence of fixes to the same JIT-config-handling code path across `ci/cloudrunners`, all authored by the same contributor within a four-day window:

- **PR #763 / Issue #762 (2026-10-18)** — the first contribution in the sequence: removed `bash -x` shell tracing from the **OCI** provider's runner-start command, which had been causing the JIT config to be echoed into pod logs via SSH's `CombinedOutput`-captured stderr. That fix was explicitly modeled on commit `9b361771` ("prevent secret exposure," 2026-03-12), the KubeVirt provider's own earlier fix for the identical `bash -x` leak.
- **Issue #768 / PR #769 (this contribution, 2026-10-20)** — discovered while reading `9b361771` closely enough to use it as a template: the same commit that correctly fixed the `bash -x` leak in KubeVirt had also, in the same diff, introduced an inverted guard that skipped substituting the real JIT config into the one command that needed it, silently breaking runner registration entirely. Fixed by always expanding the placeholder, extracting the logic into a unit-tested `expandCommand` helper, and defending the finding through direct maintainer skepticism with concrete SSH-level evidence.
- **PR #771 (2026-10-21)** — an unrelated fix in a different module (`utilities/dot-project`, correcting false-positive broken-link detection for valid `github.com` pages), evidence of continued contribution activity in the repository beyond this specific issue thread.

Read together with the companion write-up for PR #763, this contribution is the clearest evidence in the sequence that "match an existing, already-merged fix" is a good starting heuristic but not a substitute for verifying the thing being matched — the same close reading that let PR #763 correctly reuse `9b361771`'s approach is exactly what surfaced that `9b361771` itself had a second, independent defect, two days later.

---

# Timeline

| Date | Event |
| --- | --- |
| 2026-03-12 | Maintainer `koksay` merges `9b361771` ("prevent secret exposure") in the **KubeVirt** provider: correctly fixes a `bash -x` secret-leak issue, but in the same diff introduces an inverted `sensitive` guard that skips expanding the JIT config placeholder for the one command that needs it. |
| 2026-10-18 | Issue #762 filed and PR #763 merged same day: removes the equivalent `bash -x` leak from the **OCI** provider, explicitly modeled on `9b361771` as precedent. |
| 2026-10-20 10:42 UTC | Issue #768 filed: identifies the inverted-guard regression in `9b361771`, explains the SSH-environment-forwarding mechanism that turns it into a complete runner-registration failure, and states the logic was verified in isolation but not against a live KubeVirt cluster. |
| 2026-10-20 10:43 UTC | Issue #768 labeled `/kind bug`, `/priority high`, `/area ci`. |
| 2026-10-20 10:46 UTC | PR #769 opened (`fix/kubevirt-cloudrunner-jitconfig-not-expanded`), referencing `Fixes #768`, adding `expandCommand` and `TestExpandCommand`. |
| 2026-10-20 10:48 UTC | `/assign @koksay`. |
| 2026-10-20 10:52 UTC | `koksay` questions whether the bug is real, citing their own earlier testing and noting KubeVirt runners aren't currently used in production. |
| 2026-10-20 10:53 UTC | Prow's `[APPROVALNOTIFIER]` bot comments that `OWNERS`-file approval from `koksay` is required. |
| 2026-10-20 11:14 UTC | Response with concrete evidence: a real SSH-server test showing the old code sends an empty token and the fix sends the real one; explicit offer to close the issue if it doesn't matter operationally. |
| 2026-10-20 11:27 UTC | `koksay` recalls their earlier test was "long time ago for PoC," comments `/lgtm` and `/approve`. |
| 2026-10-20 11:27:59 UTC | PR #769 merged to `main`. Issue #768 auto-closed. |
| 2026-10-20 11:29–11:32 UTC | Closing exchange of thanks between maintainer and contributor. |
| 2026-10-21 | PR #771 merged: unrelated fix in `utilities/dot-project`. |

---

# Notes

- All dates, timestamps, and comment text above are taken directly from the GitHub API (`gh pr view`, `gh issue view`) for the referenced issue and PR numbers, and from `git log`/`git show`/`gh pr diff` for the referenced commits, as of the time this document was written (2026-11-04).
- This write-up draws on the full current state of `ci/cloudrunners/kubevirt/main.go` and `main_test.go`, the referenced precedent commit `9b361771`, and the shared `pkg/remote` package, in order to accurately describe the mechanism and surrounding system, not merely the PR's own diff in isolation.
- This document is written as a standalone companion to the separate write-up for PR #763 (`cncf-automation-pr-763.md`); both are cross-referenced in their respective "Related Work" sections but each is intended to be read and understood on its own.
- The review-thread quotations in this document (the maintainer's skepticism, the response, and the resolution) are reproduced verbatim from the public issue thread at https://github.com/cncf/automation/issues/768, since the specific wording of that exchange is itself part of the evidence for how the finding was defended and resolved.
