fix(env): add host-local command resolution#34
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d54a6ed335
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return selected; | ||
| } | ||
|
|
||
| const hostOverrides = opts.resolved.serviceEnv[PROJECT_ENV_HOST_SCOPE]; |
There was a problem hiding this comment.
Merge only host-scope values for host target
selectProjectEnvValuesForExecutionTarget pulls hostOverrides from resolved.serviceEnv["host"], but entries in serviceEnv already include all global keys. When hack env exec/shell is run with --service <name> (default --target host) and a host scope exists, spreading hostOverrides after the selected service env can overwrite service-specific overrides with global defaults for any shared key (for example, a service-specific PORT or DATABASE_URL gets reset even if host does not define it). This produces incorrect injected env values for host commands.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6aae1133d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const hostOverrides = opts.resolved.hostEnv; | ||
| if (!hostOverrides) { | ||
| return selected; | ||
| } | ||
| return { |
There was a problem hiding this comment.
Prevent
host scope from colliding with service scope
Merging resolved.hostEnv for every target: "host" execution makes values.host a global host-command override regardless of the requested service. In projects that already have a compose service named host, that service’s env scope now leaks into unrelated commands (for example, hack env exec --service api inherits values.host), which is a behavioral regression introduced by this commit. Please add collision handling (reserve host with validation/warning, or disambiguate service-vs-host scopes) so existing host services do not silently change env injection.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d1fe09e7b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const stackIsRunning = | ||
| (await readProjectRuntimeStateEntry({ | ||
| projectDir: project.projectDir, | ||
| composeProject: composeProjectName ?? baseProjectName, | ||
| })) !== null; |
There was a problem hiding this comment.
Check live stack state before setting --no-deps
handleRun treats the presence of a runtime-state entry as proof the stack is currently running and then sets noDeps, which makes composeRuntimeBackend.run append --no-deps (so dependencies are not started). Because runtime-state is only keyed by compose project and is persisted by any prior up call, this can be stale or incomplete (for example after starting only some profiles/services), causing hack run to skip needed dependency startup and fail at runtime when the target service expects those deps. Please gate noDeps on actual running state (or at least matching active services/profiles), not just the cached state file entry.
Useful? React with 👍 / 👎.
## <small>2.0.1 (2026-03-31)</small> * Merge branch 'main' into dimitri/web-local-dev-rough-edges ([a1419b2](a1419b2)), closes [dimitri/web-local-dev-rou#edges](https://github.com/dimitri/web-local-dev-rou/issues/edges) * Merge pull request #34 from hack-dance/dimitri/web-local-dev-rough-edges ([fe6c409](fe6c409)), closes [#34](#34) [hack-dance/dimitri/web-local-dev-rou#edges](https://github.com/hack-dance/dimitri/web-local-dev-rou/issues/edges) * fix(ci): stabilize secret scan and host env docs ([581ea34](581ea34)) * fix(env): add host-local command resolution ([d54a6ed](d54a6ed)) * fix(env): normalize encrypted backend key paths ([b65ee8e](b65ee8e)) * fix(env): preserve service overrides for host target ([6aae113](6aae113)) * fix(runtime): avoid run dependency collisions ([6d1fe09](6d1fe09)) * fix(runtime): gate run no-deps on live state ([94c9785](94c9785)) * fix(runtime): narrow run env selection type ([cc5d833](cc5d833)) * fix(web): allow routed local dev origins ([82e706f](82e706f)) * fix(web): stabilize local dev runtime ([28fe25b](28fe25b))
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc5d83393c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| opts.requestedEnvName !== null && | ||
| runtimeState?.envName !== null && | ||
| runtimeState?.envName !== opts.requestedEnvName |
There was a problem hiding this comment.
Treat null runtime env as mismatch for
hack run --env
resolveCanSkipRunDependencies only rejects env mismatches when runtimeState.envName is non-null, so hack run --env qa ... will still set noDeps if the currently running stack was recorded as base (envName: null) and the target service is up. That causes docker compose run --no-deps (documented as “Don’t start linked services”) to skip dependency startup even though the requested env differs, which can run against stale/missing dependencies. Compare the stored env and requested env directly (including null) before enabling --no-deps.
Useful? React with 👍 / 👎.
Summary
hack env execandhack env shellto a host-local env view, with--target composeto preserve the container view when neededhostscope in modern env configs and stop warning on sibling service scopes duringhack runVerification
bun test tests/env-exec-command.test.ts tests/project-run-command.test.ts tests/project-env-config.test.tsbun test tests/env-backend-command.test.tsbun run typecheckbun x ultracite check src/commands/env.ts src/commands/project.ts src/lib/project-env-config.ts tests/env-exec-command.test.ts tests/project-run-command.test.ts/Users/hack/dev/external/TeamSidewinder/event-agentusing the in-repo CLI entrypointenv execrewritesDATABASE_URLandREDISHOSTto host-local valuesrun core -- bun --versionno longer warns on valid compose servicesFollow-up
T-NZ7FAS3NRY(example-nativeinevent-agent)