fix: resolve OpenShell runner infinite recursion and enable local images#215
Closed
squizzi wants to merge 6 commits into
Closed
fix: resolve OpenShell runner infinite recursion and enable local images#215squizzi wants to merge 6 commits into
squizzi wants to merge 6 commits into
Conversation
The wrapper is installed as /usr/local/bin/claude, so when Claude Code spawns subagents that invoke `claude` by name, PATH resolves back to the wrapper causing infinite recursion. Add a re-entry guard that execs the real binary directly on subsequent invocations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…evention The env var approach doesn't work because the OpenShell sandbox supervisor spawns each command in a clean environment that does not inherit exports. Switch to a /tmp file guard that persists across invocations within the same sandbox instance. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY from the claude wrapper script into the reconciler's buildSandboxEnv so every tool in the sandbox gets them, not just processes launched through the wrapper. Remove HTTPS_PROXY, NO_PROXY, and NODE_EXTRA_CA_CERTS from the wrapper since those are already set by the reconciler and supervisor. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit addresses three related issues with the OpenShell runner in kind-local development: 1. **Fork bomb fix**: The openshell-claude-wrapper.sh script was recursively calling itself due to npm's global install creating a symlink at /usr/local/bin/claude. When the Dockerfile copied the wrapper to that location, it followed the symlink and overwrote claude.exe itself, causing infinite recursion. Fixed by removing the npm symlink before copying the wrapper, and updating the wrapper to call claude.exe directly. 2. **Local image support**: Added control-plane-local-images-patch.yaml to override RUNNER_IMAGE, OPENSHELL_RUNNER_IMAGE, and MCP_IMAGE env vars with localhost/ prefix for kind-local deployments. This triggers imagePullPolicy=IfNotPresent via existing logic in kube_reconciler.go. 3. **Gateway imagePullPolicy**: OpenShell gateway was hardcoded to imagePullPolicy=Always for sandbox pods, causing pull failures for localhost/ images. Added image_pull_policy = "IfNotPresent" to the gateway.toml configuration. 4. **kind-reload targets**: Refactored kind-rebuild to call individual kind-reload-* targets instead of build-all + blanket restart. Added new kind-reload-runner-openshell target for rapid iteration on the OpenShell runner during development. Changes: - Makefile: Refactored kind-rebuild, added kind-reload-runner-openshell - Dockerfile.openshell: Remove npm symlink before COPY wrapper - openshell-claude-wrapper.sh: Call claude.exe directly (not /opt/claude/bin/claude) - gateway/configmap.yaml: Set image_pull_policy = "IfNotPresent" - kind-local overlay: Add control-plane-local-images-patch.yaml Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Kyle Squizzato <kysquizz@redhat.com>
…ges in kind This commit addresses three related issues with the OpenShell runner in kind-local development: 1. **Infinite recursion fix**: The openshell-claude-wrapper.sh script was infinitely recursing, calling itself and accumulating --bare arguments until hitting ARG_MAX. This occurred because npm's global install created a symlink at /usr/local/bin/claude. When the Dockerfile copied the wrapper to that location, it followed the symlink and overwrote claude.exe itself. Fixed by removing the npm symlink before copying the wrapper, and updating the wrapper to call claude.exe directly. Also merged guard file protection from PR #214. 2. **Local image support**: Added control-plane-local-images-patch.yaml to override RUNNER_IMAGE, OPENSHELL_RUNNER_IMAGE, and MCP_IMAGE env vars with localhost/ prefix for kind-local deployments. This triggers imagePullPolicy=IfNotPresent via existing logic in kube_reconciler.go. 3. **Gateway imagePullPolicy**: OpenShell gateway was hardcoded to imagePullPolicy=Always for sandbox pods, causing pull failures for localhost/ images. Added image_pull_policy = "IfNotPresent" to the gateway.toml configuration. 4. **kind-reload targets**: Refactored kind-rebuild to call individual kind-reload-* targets instead of build-all + blanket restart. Added new kind-reload-runner-openshell target for rapid iteration on the OpenShell runner during development. Changes: - Makefile: Refactored kind-rebuild, added kind-reload-runner-openshell - Dockerfile.openshell: Remove npm symlink before COPY wrapper - openshell-claude-wrapper.sh: Call claude.exe directly (not /opt/claude/bin/claude) - gateway/configmap.yaml: Set image_pull_policy = "IfNotPresent" - kind-local overlay: Add control-plane-local-images-patch.yaml Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Kyle Squizzato <kysquizz@redhat.com>
723d5c6 to
4aa86a8
Compare
Contributor
|
| File | Component | Mode |
|---|---|---|
components/runners/ambient-runner/Dockerfile.openshell |
runner | warn |
components/runners/ambient-runner/openshell-claude-wrapper.sh |
runner | warn |
No action required — these components are in warn mode. Consider using the component's agent workflow for future changes.
📖 Specs: Runner Spec · Runner Constitution
Collaborator
Author
|
Closing in favor of merging with #214 |
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
Fixes three issues with OpenShell runner in kind-local development: infinite recursion bug, local image pull failures, and adds reload target for faster iteration. Merged with PR #214 for comprehensive recursion protection.
Changes
--barearguments until hitting ARG_MAX. Combined two fixes - removes npm symlink before copying wrapper, calls claude.exe directly, AND includes guard file protection from PR fix(runner): prevent infinite recursion in openshell claude wrapper and move inference env vars to sandbox level #214localhost/prefix for runner images in kind-local, enablingimagePullPolicy: IfNotPresentimage_pull_policy = "IfNotPresent"for sandbox podskind-rebuildto use individual reload targets, addedkind-reload-runner-openshellfor fast iterationTesting
make kind-reload-runner-openshell🤖 Generated with Claude Code