fix(runner): strip NODE_ENV from agent env; install gh; silence keyring warning - #26
Draft
DaveHanns wants to merge 1 commit into
Draft
fix(runner): strip NODE_ENV from agent env; install gh; silence keyring warning#26DaveHanns wants to merge 1 commit into
DaveHanns wants to merge 1 commit into
Conversation
…lence keyring warning Three small hygiene fixes to the runner container / child-env plumbing that each cause noisy or hard failures for scenarios that scaffold an Actor via `apify create` and then run it. 1. `shared/src/agents/apify-env.ts` — add `NODE_ENV` to the list of env vars stripped from the agent subprocess env. The `apify/actor-node` base image sets `NODE_ENV=production` so the runner's own `npm install` (executed at image build) skips devDependencies. When that value leaks into the agent's shell, any scaffolded project it runs inherits it too — so `apify create foo -t ts-empty && cd foo && apify run` fails with `sh: tsx: not found` because `npm install --omit=dev` drops `tsx` even though the template lists it as a devDependency it needs at runtime. Test added alongside the existing stripped-keys coverage. 2. `actors/runner/Dockerfile` — install `github-cli` via apk and add it to the CLI verify step. Also add `ENV APIFY_DISABLE_KEYRING=1` so the apify-cli stops printing `OS keyring unavailable; set APIFY_DISABLE_KEYRING=1 to silence` on every login inside the container (Alpine has no gnome-keyring / kwallet, so it falls back to a file store anyway — the warning is pure noise here). 3. `shared/src/init-presets.ts` — the `which gh` diagnostic in three presets suggested `brew install gh` even though the runner runs on Alpine. Expand the hint to list `apk add github-cli / apt-get install gh / brew install gh` so it's correct on the actual host (and stays useful if the runner ever moves to a Debian-based base image). Surfaced during an evaluation of Apify surfaces for agent-driven Actor development. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
DaveHanns
marked this pull request as draft
July 5, 2026 11:21
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.
Summary
Three small hygiene fixes to the runner container and the child-env plumbing. Each currently produces noise or a hard failure for scenarios that scaffold an Actor with
apify createand then run it, or that callgh, or that log in withapify login.Problem 1 —
NODE_ENV=productionleaks into the agent's shellThe runner Actor is built on
apify/actor-node:24, which setsNODE_ENV=productionso the runner's ownnpm installat image build skips devDependencies. That is correct for the runner itself.The problem is that
NODE_ENV=productionis currently inherited by the agent subprocess. So when an agent scaffolds a TypeScript template and runs it:Because
tsxis a devDependency of the template and theapify runprestart step effectively performsnpm install --omit=devunderNODE_ENV=production.tsxis required at runtime by the template'sstartscript, so the project can't run.Fix: add
NODE_ENVto the existingAPIFY_RUNTIME_KEYS_TO_STRIPlist inshared/src/agents/apify-env.ts.buildChildEnvis already used everywhere the runner spawns the agent / check subprocesses, so this is a one-line change plus a covering test.Problem 2 —
OS keyring unavailableon every apify loginapify-cliprints:on every login in the container. Alpine has no gnome-keyring / kwallet, so the CLI falls back to the file-backed store anyway — the warning is pure noise here.
Fix: add
ENV APIFY_DISABLE_KEYRING=1in the runnerDockerfile.Problem 3 —
gh not found (install with: brew install gh)Three
runInitPresetpresets (cli_native,cli_only,none) diagnose the presence ofghand printinstall with: brew install ghwhen it's missing. The runner runs on Alpine, where the correct hint isapk add github-cli. On top of that,ghis genuinely useful — several checks and templates shell out to it — but it isn't currently installed.Fix:
actors/runner/Dockerfile— installgithub-cliviaapk add, and add it to the--versionverify step.shared/src/init-presets.ts— expand the hint to listapk add github-cli / apt-get install gh / brew install ghso it stays correct if the base image ever moves.Evidence (verbatim)
Test plan
npx tsc -p shared/tsconfig.jsoncleannpx tsc -p actors/runner/tsconfig.jsoncleannpx vitest run shared/src/__tests__/apify-env.test.ts— 9/9 pass (added case:NODE_ENVis stripped from child env)gh --versionworks inside the containerOS keyring unavailableinapify loginoutputapify create foo -t ts-empty && cd foo && apify runexits 0Notes
Each of the three fixes stands on its own and could be split into three PRs if reviewers prefer — grouped here because they all fall under "runner env hygiene" and share the same root context.
Surfaced during an evaluation of Apify surfaces for agent-driven Actor development.