fix(test-as-self): harness never ran — wrong init invocation + teardown env#662
Open
JKHeadley wants to merge 1 commit into
Open
fix(test-as-self): harness never ran — wrong init invocation + teardown env#662JKHeadley wants to merge 1 commit into
JKHeadley wants to merge 1 commit into
Conversation
…wn env The Track-F throwaway-deploy harness was shipped but never executed end-to-end, so it failed at step 3 every run: it called `init --standalone --dir <target>`, but `init --standalone` requires a positional NAME and routes to ~/.instar/agents/<name> (ignores --dir). And teardown's `server stop` inherited INSTAR_SESSION_ID → tripped the "don't manage the server from inside a managed session" guard. Fix: two pure unit-tested helpers — buildInitArgs(target)=['init','--dir',target] (non-standalone init honors --dir, allocates a port; verified live) and sanitizedSpawnEnv(env) (strips INSTAR_SESSION_ID/INSTAR_JOB_SLUG), used by the step-4 spawn AND the teardown server-stop. No flags changed; init/server untouched. Spec: MULTI-MACHINE-BOOTSTRAP-ROBUSTNESS Track F. Tests: testAsSelfInit.test.ts (5); tsc clean. (orphan-deferral override: the gate flagged a pre-existing, non-prescriptive "deferred" at spec line 27 describing the already-resolved Playwright→Bot-API substitution — not introduced by this change.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
instar test-as-selfthrowaway-deploy harness (Track F) was shipped but never actually run end-to-end — so it failed at step 3 on every invocation. Found by running the never-executed "feature alive" validation. Two bugs insrc/commands/test-as-self.ts:init --standalone --dir <target>, butinit --standalonerequires a positional name and routes to~/.instar/agents/<name>(ignoring--dir). Result:initexited with "A name is required for standalone agents" →VERDICT: FAIL (step 3)every run.server stoprefused — it inherited the caller'sINSTAR_SESSION_ID, tripping the "don't start/stop/restart the server from inside a managed session" guard. Step 4's spawn already stripped those markers; teardown didn't.Fix
Two pure, exported, unit-tested helpers:
buildInitArgs(target)→['init', '--dir', target]— non-standalone init honors--dir, allocates a port, writes<target>/.instar/config.json. Verified live:init --dir /tmp/freshcreated a runnable home with port 4041.sanitizedSpawnEnv(env)→ env minusINSTAR_SESSION_ID/INSTAR_JOB_SLUG. Used by the step-4 spawn (replacing the inline delete) AND the teardown'sserver stop.No flags added/removed;
init/serveruntouched — only how the harness invokes them.Tests
tests/unit/testAsSelfInit.test.ts(5):buildInitArgsusesinit --dirand never--standalone;sanitizedSpawnEnvstrips both markers, preserves all other vars, doesn't mutate input.tsc --noEmitclean; full pre-commit + pre-push ship-gate green.Scope
Independent of #661 (touches only
test-as-self.ts); keeps #661 single-purpose. This makes the Track-F harness actually work — a prerequisite for the Track-E two-machine bring-up. Step-4 server-start remains subject to the usual node-ABI matching (a runtime property, orthogonal to this fix). Opened for review (not auto-merged).🤖 Generated with Claude Code