Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

fix(runner): disable SSH usage collection by default (#3235)

zombee03ffcf385d7f2
diff --git a/apps/runner/README.md b/apps/runner/README.md
index 14098f4bf..5042eaa63 100644
--- a/apps/runner/README.md
+++ b/apps/runner/README.md
@@ -1295,7 +1295,10 @@ Upgrade all Runners and matching native libraries before enabling fractional cre
## Cloud feature usage
-Runner drains accepted SSH authentication evidence only from running Cloud Boxes, using an independent native handle per read.
+SSH usage collection is disabled by default. Set `BOXLITE_SSH_USAGE_ENABLED=true` to enable
+collection and reporting at Runner startup. The setting applies only to usage telemetry.
+
+When enabled, Runner drains accepted SSH authentication evidence only from running Cloud Boxes, using an independent native handle per read.
Its background collector polls every five seconds, reads at most 64 Boxes per round with four workers,
and applies a one-second deadline to each read. Larger inventories rotate between rounds.
No read starts a VM. Older Guests are skipped with a diagnostic; the local SDK never uploads analytics automatically.
diff --git a/apps/runner/cmd/runner/config/config.go b/apps/runner/cmd/runner/config/config.go
index 6b6b30d83..a007d02b7 100644
--- a/apps/runner/cmd/runner/config/config.go
+++ b/apps/runner/cmd/runner/config/config.go
@@ -24,6 +24,7 @@ type Config struct {
EnableTLS bool `envconfig:"ENABLE_TLS"`
OtelLoggingEnabled bool `envconfig:"OTEL_LOGGING_ENABLED"`
OtelTracingEnabled bool `envconfig:"OTEL_TRACING_ENABLED"`
+ SSHUsageEnabled bool `envconfig:"BOXLITE_SSH_USAGE_ENABLED" default:"false"`
OtelEndpoint string `envconfig:"OTEL_EXPORTER_OTLP_ENDPOINT"`
OtelHeaders string `envconfig:"OTEL_EXPORTER_OTLP_HEADERS"`
Environment string `envconfig:"ENVIRONMENT"`
diff --git a/apps/runner/cmd/runner/main.go b/apps/runner/cmd/runner/main.go
index 46cf4a105..5d835206b 100644
--- a/apps/runner/cmd/runner/main.go
+++ b/apps/runner/cmd/runner/main.go
@@ -333,6 +333,10 @@ func run() int {
// Stop both workers before the Runner closes the native BoxLite client.
func startSSHUsage(ctx context.Context, cfg *config.Config, source sshusage.Source, logger *slog.Logger) func() {
+ if !cfg.SSHUsageEnabled {
+ logger.Info("SSH usage collection disabled")
+ return func() {}
+ }
if cfg.BoxliteApiUrl == "" || cfg.ApiToken == "" {
return func() {}
}
diff --git a/apps/runner/cmd/runner/ssh_usage_test.go b/apps/runner/cmd/runner/ssh_usage_test.go
index b1d148022..e40a7c91c 100644
--- a/apps/runner/cmd/runner/ssh_usage_test.go
+++ b/apps/runner/cmd/runner/ssh_usage_test.go
@@ -18,9 +18,18 @@ import (
"github.com/boxlite-ai/runner/cmd/runner/config"
)
-type sshEvidence struct{}
+type sshEvidence struct {
+ inventoryRead chan struct{}
+}
-func (sshEvidence) ListInfo(context.Context) ([]boxlite.BoxInfo, error) {
+func (s sshEvidence) ListInfo(context.Context) ([]boxlite.BoxInfo, error) {
+ if s.inventoryRead != nil {
+ select {
+ case s.inventoryRead <- struct{}{}:
+ default:
+ }
+ return nil, nil
+ }
return []boxlite.BoxInfo{{ID: "native", Name: "CloudBox1234", Running: true}}, nil
}
func (sshEvidence) TakeSSHUsage(context.Context, string) (*boxlite.SSHUsageBatch, error) {
@@ -42,7 +51,7 @@ func TestSSHUsageStartupDeliversEvidenceThroughReporter(t *testing.T) {
}))
defer server.Close()
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
- stop := startSSHUsage(context.Background(), &config.Config{BoxliteApiUrl: server.URL, ApiToken: "test-token"}, sshEvidence{}, logger)
+ stop := startSSHUsage(context.Background(), &config.Config{BoxliteApiUrl: server.URL, ApiToken: "test-token", SSHUsageEnabled: true}, sshEvidence{}, logger)
defer stop()
select {
case events := <-received:
@@ -55,8 +64,24 @@ func TestSSHUsageStartupDeliversEvidenceThroughReporter(t *testing.T) {
}
func TestSSHUsageStartupDisablesInvalidOrAbsentConfiguration(t *testing.T) {
- for _, cfg := range []config.Config{{}, {BoxliteApiUrl: "invalid", ApiToken: "test-token"}} {
+ for _, cfg := range []config.Config{
+ {SSHUsageEnabled: true},
+ {BoxliteApiUrl: "invalid", ApiToken: "test-token", SSHUsageEnabled: true},
+ } {
stop := startSSHUsage(context.Background(), &cfg, nil, slog.Default())
stop()
}
}
+
+func TestSSHUsageStartupSkipsCollectionByDefault(t *testing.T) {
+ inventoryRead := make(chan struct{}, 1)
+ cfg := &config.Config{BoxliteApiUrl: "http://127.0.0.1", ApiToken: "test-token"}
+ stop := startSSHUsage(t.Context(), cfg, sshEvidence{inventoryRead: inventoryRead}, slog.Default())
+ defer stop()
+
+ select {
+ case <-inventoryRead:
+ t.Fatal("SSH usage collector read Box inventory without an explicit opt-in")
+ case <-time.After(time.Second):
+ }
+}