Skip to content

fix(all-npm): preserve caller environment when stopping the daemon - #5147

Merged
nicoloboschi merged 2 commits into
vectorize-io:mainfrom
rudycelekli:campaign/hindsight-node-stop-env-20261002
Oct 6, 2026
Merged

nicoloboschi merged 2 commits into
vectorize-io:mainfrom
rudycelekli:campaign/hindsight-node-stop-env-20261002

Conversation

@rudycelekli

Copy link
Copy Markdown
Contributor

Problem

HindsightServer.start() applies the caller's env overrides to profile creation and daemon startup, but stop() inherits only the parent environment. A caller-supplied CLI PATH or profile configuration location is consequently lost during shutdown, so the same wrapper may start a daemon successfully and fail to stop that daemon.

Change

Pass the existing buildEnv() result to the stop command, preserving the same overrides and filtering undefined values across all three lifecycle commands. No new option or subprocess mechanism is added.

Validation

  • The three-command environment regression fails before the fix: shutdown's spawn options have no environment, while both startup commands have the requested overrides.
  • All 11 existing/focused Node wrapper tests pass after the fix; focused strict TypeScript checking, project-config Prettier and git diff --check pass.
  • This regression checks actual lifecycle command construction with a stubbed child process and health response. A real Python daemon or custom installed uvx executable was not launched.
  • Required ./scripts/hooks/lint.sh was attempted offline but stops during uv sync because the sparse checkout omits the hindsight-all workspace. Full monorepo lint remains unverified locally. Reused Vitest 3.2.4 rather than the exact declared 4.1.11 runner.
  • Required code-review and independent patch review completed before publication; signed DCO commit.

AI assistance was used to investigate, implement and test this change.

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
@github-actions github-actions Bot added the core label Oct 2, 2026
…fecycle test

Review nit: the new test exercises start/stop, not construction, and sat
above the construction cases it is unrelated to.

Signed-off-by: Nicolò Boschi <boschi1997@gmail.com>
@nicoloboschi

Copy link
Copy Markdown
Collaborator

Thanks — reviewed and merging. The fix is right: stop() was the only lifecycle command inheriting process.env, so a caller's PATH or profile root was lost at shutdown.

One nit I pushed on top: the new regression test sat at the top of the HindsightServer construction block, above the construction cases it has nothing to do with — moved it next to the other lifecycle test. No behaviour change.

@nicoloboschi
nicoloboschi merged commit 26be363 into vectorize-io:main Oct 6, 2026
100 checks passed
@nicoloboschi nicoloboschi mentioned this pull request Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants