Skip to content

Config-driven runtime selection doesn't validate against ValidRuntimes() before sandbox bootstrap #6471

Description

@waynesun09

Summary

internal/cli/run.go's resolveBackendFromConfigData() calls config.ParsePerRepoConfig/config.ParseOrgConfig (pure YAML unmarshal, no .Validate() call) and passes the result straight into agentruntime.ResolveFromConfig/ResolveFromPerRepoConfigResolve(), which switches on the runtime name with no check against config.ValidRuntimes().

This means runtime: opencode or runtime: pi in org/per-repo config resolves successfully (both are registered in Resolve()'s switch for dev/testing purposes) even though neither is in ValidRuntimes() and both are non-functional stubs. A config author who sets one of these runtimes will have the run proceed through sandbox creation, fetch-service setup, and bootstrap/env wiring before failing inside rt.Bootstrap() — burning real (if bounded) side effects before the failure surfaces, rather than failing fast at config-parse time.

Scope

This affects both stub runtimes identically:

Confirmed via git history that this is not specific to either PR — the gap has existed since opencode's registration and pi simply inherited it.

Suggested fix

Add a ValidRuntimes() guard directly inside agentruntime.Resolve() (or call .Validate() in resolveBackendFromConfigData before resolving), so config-driven runtime selection — org or per-repo — fails immediately, before any sandbox is created, for any runtime not in ValidRuntimes(). Keep runtime.Resolve("pi")/Resolve("opencode") working for explicit dev/testing call sites that don't go through config.

Update the tests in internal/runtime/registry_test.go that currently assert opencode/pi resolve successfully via ResolveFromPerRepoConfig — once the guard lands, that codepath should return an error instead.

References

Originally raised by an automated review bot on #6466 (review thread), confirmed and scoped via independent review-squad analysis (Claude + Grok) which traced the actual fullsend run side-effect ordering to establish this is bounded to sandbox/bootstrap overhead (no wasted inference calls, since Bootstrap() fails before Run() is ever reached).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcomponent/harnessAgent harness, config, and skills loadingcomponent/runnerAgent runner behavior and lifecyclepriority/mediumNormal priority, plan for next cycleready-to-codeTriggers code agent dispatchtype/bugConfirmed defect in existing behavior

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions