feat(admin): runtime install of subscription CLIs from the admin UI - #816
Merged
Conversation
The public image deliberately does not bundle the vendor CLIs (INSTALL_SUBSCRIPTION_CLIS=false - redistribution needs legal review), so a missing CLI dead-ended in manual shell steps on the Subscription-CLIs page. Adds an operator-triggered npm install from the public registry into CLI_TOOLS_DIR on the persisted volume, surfaced as an Install button. - middleware: cliInstallService (fixed package allowlist, strict semver gate, execFile without shell, bounded time/output, host-global single-flight reserved before any await), routes POST /api/v1/admin/cli-backends/:id/install (202/409/400) and GET /:id/install/status; detector + auth service resolve the binary via CLI_TOOLS_DIR/bin before PATH; CLI_TOOLS_DIR + CODEX_HOME documented in .env.example - web-ui: InstallBox with progress polling (bail-out after repeated poll failures, dedicated 409 conflict message), i18n en+de, panel split to stay under the 500-line rule - tests: middleware service + route suites (incl. TOCTOU regression for the single-flight slot), component tests for the install flow Enabler for #294 (Sign in with ChatGPT / codex device auth); extends #309.
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
Enabler for #294, extends the #309 Subscription-CLIs subsystem.
The public image deliberately does not bundle the vendor CLIs (
INSTALL_SUBSCRIPTION_CLIS=false— redistributing proprietary CLIs needs legal review), so a missing CLI dead-ended in manual shell steps on the Subscription-CLIs admin page. This PR adds an operator-triggered runtime install ("nachinstallieren"):npm installfrom the public npm registry intoCLI_TOOLS_DIRon the persisted volume, surfaced as an Install now button with progress polling.Middleware
cliInstallService: fixed package allowlist (claude → @anthropic-ai/claude-code,codex → @openai/codex,gemini → @google/gemini-cli), optional version behind a strict semver gate,execFilewithout a shell, bounded time/output, host-global single-flight (slot reserved before any await — TOCTOU-safe).POST /api/v1/admin/cli-backends/:id/install(202 started / 200 already installed / 409 conflict / 400 bad id or version) andGET /:id/install/status.CLI_TOOLS_DIR/binbefore PATH, so a volume install is visible to detection and the in-app login without PATH mutation.CLI_TOOLS_DIR+CODEX_HOMEdocumented inmiddleware/.env.example; CHANGELOG entry added.Web-UI
InstallBox(new component) with progress polling, poll bail-out after repeated failures, dedicated 409 message; manual steps stay one click away. i18n en+de. Panel split to stay under the 500-line rule.Verification
npm install -g --prefix … @openai/codexsmoke-tested innode:22.23.2-slim(exit 0,codex-cli 0.149.0runs)./dataand drops tonodevia gosu.Test plan
test/cliInstallService.test.ts14/14 (allowlist/semver injection rejection, single-flight incl. TOCTOU regression, failure log tail, route 202/409/400) + detector suite 10/10i18n:check, vitest 15/15 (panel + i18n parity)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.