Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(harness): auto-configure launches from --env alone - #202

Merged
outofcoffee merged 3 commits into
mainfrom
fix-harness-remote
Sep 13, 2026
Merged

feat(harness): auto-configure launches from --env alone#202
outofcoffee merged 3 commits into
mainfrom
fix-harness-remote

Conversation

@outofcoffee

Copy link
Copy Markdown
Collaborator

spinloop harness --env <name> now configures and launches the harness from what is actually deployed to that environment when no Spinloop is applied, and its flag parsing no longer depends on argument order.

Summary

  • Auto-configure from a deployed environment: spinloop harness --env <name> with no Spinloop applied fetches the environment's live deploy-config (runner, served model, context size — read from the same SSM state deploy already writes) and configures the harness from it, exactly as an equivalent Spinloop would. This means a second machine only needs the environment registered locally (remote.json), not a copy of the Spinloop that was deployed — and a later redeploy is picked up automatically on the next launch rather than requiring anyone to re-copy anything.
  • An environment with nothing deployed, or whose env Lambda predates this change, fails the launch before writing any config, naming the fix (spinloop remote deploy ... --env <name>, or spinloop remote bootstrap to update the control plane).
  • Applying a Spinloop alongside --env is unaffected — its PROVIDER/ALIAS/MODEL/CONTEXT still win over the environment's deploy-config.
  • Fixes spinloop harness's flag parsing: previously, --env (and the command's other flags) had to appear before a leading Spinloop alias/path to be recognised — spinloop harness dev-3 --env dev-1 ... silently forwarded --env dev-1 to the harness instead of consuming it, with no error. Worse, an unrecognised flag (e.g. --prompt) appearing before the Spinloop name caused a hard unknown flag failure. Flags are now recognised wherever they sit relative to the Spinloop name.

Implementation details

  • The env Lambda (remote/lambda/env/index.ts) now best-effort reads the environment's deploy-config from SSM (the same helper start/stats already use) and includes deployed/runner/modelId/servedName/contextSize in its reply when one is registered and parses; a missing or unparsable deploy-config just omits the fields rather than failing the call. Existing deployed accounts need spinloop remote bootstrap re-run to pick up the updated Lambda.
  • cmd/spinloop/remote.go gains providerForRunner, the reverse of the existing runnerFor mapping (llamacpp/vllm are both identity mappings, so nothing else can ever reach a deploy-config).
  • applyRoutedSpinloop gains an autoConfigure path that synthesises a spinloop.Selection from the fetched environment's deploy-config immediately before the existing applySelection call, so the auto-configured path and the Spinloop-driven path write config through the exact same code.
  • The flag-parsing fix replaces harnessCmd's single fs.Parse call (which stopped recognising flags at the first positional, per SetInterspersed(false)) with a hand-rolled scanner (splitHarnessArgs) that recognises the command's own flags and at most one Spinloop-naming positional in any order, and treats the first genuinely unrecognised token as the start of the harness's own arguments rather than erroring.
  • Full design rationale and spec deltas are in openspec/changes/harness-env-autoconfig/ (not yet archived).

spinloop harness --env <name> now configures and launches the harness
from what is actually deployed to that environment when no Spinloop is
applied: the env Lambda reports the runner, served model and context
size alongside base_url/api_key, so a second machine only needs the
environment registered (not a copy of the Spinloop) to launch against
it. Nothing deployed, or a control plane predating this, fails loudly
with the fix (deploy, or `remote bootstrap`) rather than launching
unconfigured.

Alongside this, fix spinloop harness's own flag parsing: --env (and
its other flags) previously had to appear before a leading alias or
path to be recognised, and an unrecognised flag anywhere before that
point caused a hard "unknown flag" failure. Flags are now recognised
wherever they sit relative to the Spinloop name.
The env Lambda's role was never given ssm:GetParameter on the
deploy-config parameter, so its new deploy-config read (added for
spinloop harness --env's auto-configure) always threw AccessDenied.
That was caught by the read's own best-effort handling — the same
path that covers "nothing deployed yet" — so a running, deployed
environment was silently reported as having nothing deployed to
configure the harness with.

Found via a live run against a deployed fleet node.
@outofcoffee

Copy link
Copy Markdown
Collaborator Author

Found and fixed a real bug during live testing against a deployed environment: the env Lambda's IAM role was never granted ssm:GetParameter on the deploy-config parameter, so its new deploy-config read always threw AccessDenied — caught by the same best-effort handling that covers "nothing deployed yet," so a running, deployed environment was silently reported as having nothing to auto-configure from. Fixed in remote/lib/llm-stack.ts (grants the same read-only readEnvParamsStatement stopFn already has), with a CDK-template regression test in remote/test/stack.test.ts.

This does mean the fix needs spinloop remote bootstrap re-run against the account before spinloop harness --env <name> with no Spinloop will work — that was already true for picking up the new Lambda code at all, this just makes the redeploy actually functional once it happens.

Merges the harness-remote-env and remote-env deltas into the main
specs, and moves the change to archive/2026-09-13-harness-env-autoconfig.
@outofcoffee
outofcoffee marked this pull request as ready for review September 13, 2026 15:30
@outofcoffee
outofcoffee merged commit 6f15c38 into main Sep 13, 2026
4 checks passed
@outofcoffee
outofcoffee deleted the fix-harness-remote branch September 13, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant