Skip to content

bug(cli): digit-led project names can never deploy, --host rewrites .env even on --dry-run, and the Windows installer closes the session on error #4839

Closed

Description

@yannickmonney

Problem

Three operator-facing defects in the Tale CLI's install and deploy path. Each contradicts docs/en/self-hosted/install/cli-install.md and leaves the operator with a refusal or a changed system they didn't ask for. main acd5dbd10:

# Defect Code What the operator sees
1 A project whose folder name starts with a digit can't be deployed. tale init derives the ID from the folder name and allows a leading digit (tools/cli/src/lib/project/generate-project-id.ts:7, :16-36; lib/actions/init.ts:254). Every tale deploy checks the same ID against /^[a-z][a-z0-9-]{0,62}$/ (lib/deployment/tag-automation-protocol.ts:26-29, called at lib/actions/deploy.ts:226-229) For ~/2024-site, tale dev works, but every deploy, the first included, stops with "✗ Invalid deployment project." The message names neither the rule nor the fix (rename the project ID or the folder)
2 tale deploy --host <domain> rewrites .env permanently, --dry-run included. lib/actions/run-deploy.ts:95 calls ensureProductionDomain(projectDir, { host: options.host }) before anything checks dryRun. With a flag host it writes HOST, SITE_URL and TLS_MODE=letsencrypt (lib/config/ensure-env.ts:295-313; :130-136) The docs say --host overrides HOST "for one run" (cli-install.md:671) and --dry-run previews "without touching anything" (:133). Instead a preview switches a TLS_MODE=external site to Let's Encrypt in .env, and the change stays
3 The documented Windows install closes the operator's PowerShell on any error. The docs install with irm …/install-cli.ps1 | iex (cli-install.md:35). The script's Write-Err ends with exit 1 (scripts/install-cli.ps1:29), and under iex that exit ends the caller's session. The script also sets $ErrorActionPreference = "Stop" in the caller's scope (:17) On any installer error the console window closes, taking the red "Error: …" line and its recovery hints with it. After a successful install the user's session keeps ErrorActionPreference=Stop. The installer tests run the script with -File in a fresh process (tools/cli/scripts/install-cli.test.ts:271-280), so the iex path is never exercised

Expected

  1. Generate IDs that satisfy the deploy rule (prefix a letter when the folder starts with a digit), or accept the init pattern at deploy. Either way, the refusal should name the rule and the fix.
  2. Apply --host to the run only. Under --dry-run, write nothing, and report what .env would change.
  3. In the PowerShell installer, throw (or return from a main function) instead of exit, and don't change the caller's ErrorActionPreference. Add an installer test that runs it through iex in a child session.
  • Regression:

    • a deploy-path unit test with project ID 2024-site-abc123;
    • a run-deploy test asserting .env is unchanged after --dry-run --host;
    • a PowerShell test that the calling session survives an installer error.

    On acd5dbd10 all three fail.

Severity and owner

  • Severity: medium. (1) blocks deployment outright for affected projects, (2) silently changes production TLS configuration, and (3) hides the installer's own diagnostics.
  • Owner: CLI (deploy and installers).
  • Related: release: re-running the v0.5.78–v0.5.80 releases moved :latest images and GitHub Latest back to v0.5.79 #4740 (installer release fallback).
  • Found by: Review A (TALE-358), 2026-10-12 08:15 Zurich occurrence, oldest-due cli.install-deploy UX-CLARITY slice. Static reading at acd5dbd10, verified at the cited lines; nothing was run. The same sweep found 13 lower-priority message-clarity leads, which are listed in Review A's receipt and not filed here.

Activity

  1. yannickmonney commented on Oct 12, 2026

    @yannickmonney
    ContributorAuthor

    Addendum (Review A, TALE-358, 2026-10-12 16:15 Zurich occurrence): a fourth defect in the same path, at main 4cde0834a. Paths are under tools/cli/src/.

    # Defect Code What the operator sees
    4 tale deploy --override-all asks for consent only after the deploy, including the restart it forces. For the reseed's sake, --override-all implies --stop and force-recreates the services (lib/actions/run-deploy.ts:84-90, :138-140), so db and proxy restart too. First come the snapshot (lib/actions/deploy.ts:469), the rollout (:818) and the file sync (:823). Only then does reseedAllOrgsFromBuiltin (:835-840) check consent (lib/actions/reseed-all-orgs.ts:113-125) In CI without --yes, the job fails with "--override-all requires --yes (-y) when stdin is not a TTY (e.g. CI)." The new version and the db/proxy restart are already live, so the pipeline reports a failed deploy that actually happened. Interactively, an operator who reads the factory-reset warning and declines gets "Aborted by user." and then "Deployment complete! Version … is now live", after taking the downtime that only the reseed needed

    Expected: resolve the --override-all consent before anything changes, next to the existing --override/--override-all usage check (run-deploy.ts:54-62) and before ensureDocker. Declining, or a missing --yes without a TTY, must leave the running deployment untouched. --dry-run keeps its current early return.

    Regression: a run-deploy test with overrideAll, no TTY and no --yes throws before any docker call, and an interactive decline makes no deploy call. On 4cde0834a both reach deploy().

    Severity and owner: medium, CLI. This is static reading, verified at the cited lines. I didn't run it.

  2. yannickmonney commented on Oct 12, 2026

    @yannickmonney
    ContributorAuthor

    Addendum 2 (Review A, TALE-358, 2026-10-12 16:15 Zurich occurrence): the documented upgrade preview fails, at main 4cde0834a. Paths are under tools/cli/src/.

    # Defect Code What the operator sees
    5 tale deploy --dry-run inspects the target image it hasn't pulled. On an install already at automation writer protocol 2, the dry-run branch calls admitTagAutomationImage before anything is pulled (lib/actions/deploy.ts:358-363, while the images are only logged as "Would pull"). That runs docker image inspect on the target version's platform image (lib/deployment/tag-automation-protocol.ts:118-134). The real deploy only does this after its pull succeeds (deploy.ts:394-408) The documented upgrade preview (docs/en/self-hosted/operate/upgrades.md:22-37: tale update --version <target>, then tale deploy --dry-run) stops with "The installed automation writer protocol could not be read safely." and exit code 5, whenever the target images aren't on the host yet, which is normal before an upgrade. protocolRead reports any failed docker read with that one sentence (lib/deployment/automation-protocol.ts:49-67), so it blames the installed protocol, not the missing target image

    Expected:

    • In a dry-run, skip the image admission when the target image isn't local, and say what the real deploy would check after pulling. Alternatively, read the target's labels from the registry manifest.
    • Name the image and the failed read in the error.

    Regression: a deploy dry-run test on a protocol-2 install with the target image absent. It finishes the preview and names the pending check. On 4cde0834a it throws the sentence above. No test drives deploy() with dryRun and protocol 2 today: deploy-preflight.test.ts covers dry-run without the protocol, and there is no tag-automation-protocol test file.

    Severity and owner: medium, CLI. The preview step the upgrade guide prescribes fails for every protocol-2 upgrade, with a misleading cause. This is static reading, verified at the cited lines. I didn't run it.

  3. yannickmonney commented on Oct 12, 2026

    @yannickmonney
    ContributorAuthor

    Addendum 3 (Review A, TALE-358, 2026-10-13 00:15 Zurich occurrence): a prompt in a non-interactive shell prints only "Aborted.". main df7cd70f7, paths under tools/cli/src/.

    # Defect Code What the operator sees
    6 The reason a prompt couldn't be shown is thrown away. utils/prompt.ts:65-72 throws NonInteractiveError with a useful message: "Cannot prompt (…) — this is not an interactive terminal. Re-run with --yes to accept defaults, or run it in an interactive shell." But utils/run-command.ts:19 counts that error as a user abort, and handleError (:28-33) prints only errorLine('Aborted.') and exits 4 In CI or any piped shell, a command that needs a confirmation stops with "Aborted." alone. The operator didn't abort anything, and the hint to add --yes is never shown
    7 tale deploy provision without --yes can never be confirmed. It refuses a terminal on stdin (commands/deploy/provision.ts:223-226, "Provide private native instance JSON on stdin."), then asks confirm(…) unless --yes is set (:278-287). confirm needs stdin to be a terminal (utils/prompt.ts:61-63) The only valid way to run it prints "Aborted." The confirmation can't be answered, and nothing says --yes is required. Bundle deployment probably passes --yes, so this mainly hits operators running the documented backend-local phase (cli-install.md:313) by hand

    Expected: print the NonInteractiveError message, keeping exit code 4 if that's the contract, and reserve "Aborted." for Ctrl-C. For deploy provision, require --yes, or say so in the stdin message and the docs.

    Regression: a run-command test where a NonInteractiveError is thrown in non-JSON mode. The output contains "--yes". On df7cd70f7 it is just "Aborted.".

    Severity and owner: medium-low, CLI. This is static reading, verified at the cited lines. I didn't run it.

  4. yannickmonney commented on Oct 12, 2026

    @yannickmonney
    ContributorAuthor

    Addendum 4 (Review A, TALE-358, 2026-10-13 00:15 Zurich occurrence): four install and deployment errors that hide their cause. main df7cd70f7, paths under tools/cli/src/.

    # Defect Code What the operator sees
    8 A schema error names no field. operationalFailure turns every z.ZodError into the caller's fixed sentence (commands/operational-failure.ts:36). The managed deployment commands pass "Deployment input does not match its schema." (commands/deploy/managed.ts:30-35) A typo in a bundle or deployment spec gives one sentence, with no path, field or expected type. The operator has to diff the file against the docs by hand. The comment above the function hides messages so they can't leak secrets, but zod issue paths and expected types carry no values
    9 Configuration errors become a generic failure. lib/deployment/identity.ts:976-981 wraps options.provision(context) in a bare catch { throw externalDepError('Native configuration provisioning failed.'); } Every provisioning failure ends as "Native configuration provisioning failed." (external-dependency exit code), including authored ConfigError/CliError messages that operationalFailure deliberately keeps and a NonInteractiveError. The specific, safe reason is thrown away
    10 The acceptance health check gives every failure one cause. lib/deployment/acceptance-health.ts:158-161 turns any failure, whether DNS or TLS, a non-200 answer, an unexpected body or an older version still serving (throw new Error('health version'), :150-151), into "The declared origin did not prove the expected healthy serving version." An origin that doesn't resolve reads like a version mismatch. The operator can't tell whether to fix DNS or certificates, or to wait for the rollout
    11 The Unix installer reports API errors as a missing release. scripts/install-cli.sh:159-166 captures the HTTP status, but only an empty body, 403 or 429 falls back to the redirect (:178-183). A 401 (for example, an unrelated or expired GITHUB_TOKEN in a CI environment, which the script sends automatically), 404 or 5xx with a JSON body goes on to the asset scan and ends with "No release found with ${asset_name} binary" (:190) The operator is told there is no release for their platform, when the request was refused or failed. The fix, unsetting or fixing GITHUB_TOKEN or retrying later, is never suggested

    Expected:

    Regression: a deploy test with a bundle spec missing a required field shows that field's path. On df7cd70f7 it shows only the fixed sentence.

    This is static reading, verified at the cited lines. I didn't run it.

  5. yannickmonney commented on Oct 13, 2026

    @yannickmonney
    ContributorAuthor

    Addendum 5 (Review A, TALE-358, 2026-10-13 04:15 Zurich occurrence): four more dead ends. main 715dc15ad, paths under tools/cli/src/.

    # Defect Code What the operator sees
    12 A mistyped bundle directory or a missing deployment.json isn't named. lib/deployment/bundle.ts:120 and :123 call lstat on the directory and the manifest before any explicit check. For a path that doesn't exist, lstat throws Node's ENOENT, which isn't a CliError, ConfigError or ZodError. operationalFailure therefore replaces it with the caller's fixed summary (commands/operational-failure.ts:37) tale deploy --bundle ./bundel reports "Deployment failed. Review the source pins, paths, permissions and retained recovery receipts." The explicit checks right after ("Deployment bundle must be a regular directory.", "Deployment manifest is not a bounded regular file.") would have said what's wrong, but they never run
    13 The installer's build-from-source hint builds the wrong binary. For a platform without a release asset, scripts/install-cli.sh:46 says "Build from source instead: clone … and run 'bun run build' in tools/cli." tools/cli/package.json's build runs build:linux (--target=bun-linux-x64) and then build:mac (--target=bun-darwin-arm64), both with --outfile=dist/tale, so the second overwrites the first Someone on an unsupported platform, for example 32-bit ARM, follows the hint and gets a macOS arm64 dist/tale that can't run on their machine. Nothing says where the binary lands or how to put it on PATH, and the install guide doesn't mention building from source
    14 The global --yes doesn't reach the Docker install gate. The root -y, --yes promises to "assume 'yes' for all prompts (non-interactive)" (index.ts:47), and resolveConsent honours it elsewhere (utils/output-mode.ts:97-99). ensureDocker reads only its own opts.assumeYes (lib/docker/ensure-docker.ts:594-604), which run-deploy.ts:68 fills from the deploy subcommand's --yes alone On a fresh host, tale --yes deploy in CI is refused with "Docker is not installed and this is a non-interactive shell. Re-run with --yes …". The operator already passed --yes, just before the subcommand
    15 A configuration-only apply is refused in terms of credential export. tale deploy --bundle <dir> --configuration-only observes the ready runtime through observeReadyRuntime (lib/deployment/apply.ts:721-723, :751), and the configuration activation does the same (:872). Both run observeReadyState (lib/deployment/runtime-apply.ts:1284), whose custody refusals are all worded for client credential export: "Credential export requires the exact ready runtime receipt.", "Managed runtime file drift prevents credential export.", "Managed runtime origin differs from the credential export target." (:1303-1357) An operator updating configuration on a drifted or not-ready runtime is told credential export failed, an operation they didn't run. The message doesn't help them repair the runtime for the apply they started

    Expected:

    This is static reading, verified at the cited lines. I didn't run it.

  6. added
    agent-ready
    on Oct 29, 2026
  7. tale-code-bot commented on Oct 30, 2026

    @tale-code-bot
    Collaborator

    Split (task TALE-176). TALE-176 fixes defect 2: tale deploy --host rewriting .env, --dry-run included. Its commit carries Closes #4839 and closes this issue when it reaches main. The other defects are now issues of their own, each with the evidence and the regression test it needs:

    Defects What Issue
    1 Digit-led project IDs from tale init are refused by every deploy and rollback #5169
    3 Windows installer run through irm | iex closes the caller's PowerShell on error #5174
    4, 14 --override-all asks consent after the rollout; the Docker gate ignores the global --yes #5175
    5 deploy --dry-run inspects the unpulled target image on a protocol-2 install #5170
    6, 7 A prompt with no terminal prints only "Aborted."; deploy provision needs --yes #5171
    8, 12 Managed deployment errors don't name the bad field or the missing bundle path #5176
    9, 10, 15 Provisioning, acceptance and configuration-only failures hide their real cause #5172
    11, 13 Unix installer calls API errors a missing release, and its build hint is wrong #5173

    Defects 1 and 3 are this issue's table; 4 to 15 are addenda 1 to 5. Every part cites code at train 29e9445 (the cited paths are unchanged at train 1ae4a95 and feature-train 2334ceb).

    The fix for defect 2 is on branch fix/deploy-host-one-run, waiting for review in TALE-176. --host serves its host for that run only and never writes .env. --dry-run writes nothing to .env or tale.json and logs what a real run would write.

  8. added a commit that references this issue on Oct 30, 2026
    3024254
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions