Skip to content

Fix Windows clean-install managed runtime smoke for ktx sl query #219

Open

Description

@andreybavt

Problem

PR #215 fixed the Windows pnpm/package-artifact invocation path enough for the artifact unit tests and clean npm package install to get much further, but the Windows clean-install smoke still fails when the installed CLI first uses the managed Python runtime.

On a fresh Windows Server 2022 environment with Git available, this passed:

  • node --test scripts/package-artifacts.test.mjs (18 tests, 0 failures)
  • npm tarball build/package/install
  • pnpm exec ktx --version
  • ktx setup --no-input ...
  • ktx wiki ...
  • ktx sl ... search

The remaining failure is on the first query that needs the managed runtime:

pnpm exec ktx sl query --connection-id warehouse --measure orders.order_count --format json --yes --project-dir <temp-project>
AssertionError [ERR_ASSERTION]: ktx sl query first managed runtime install failed with code 1

The stderr output only showed the managed Python runtime install starting with uv before the process exited with code 1.

Expected

A clean installed ktx npm package on Windows should be able to install/use the managed Python runtime and complete the ktx sl query smoke.

Suggested Follow-Up

Investigate why the managed runtime install exits 1 on Windows during the clean-install smoke, then add or update Windows coverage so scripts/package-artifacts.mjs check can validate this path end to end.

Activity

  1. added
    needs-triage
    on May 26, 2026
  2. andreybavt commented on May 26, 2026

    @andreybavt
    ContributorAuthor

    @Aryan1718 would you like to look into it?

  3. Aryan1718 commented on May 26, 2026

    @Aryan1718
    Contributor

    Hello @andreybavt , I will look into it and let you know.

  4. Aryan1718 commented on May 26, 2026

    @Aryan1718
    Contributor

    Hello @andreybavt ,

    What I tested

    From the repo root:

    node scripts/package-artifacts.mjs check

    This completed successfully, including the same first managed-runtime install path that was reported as failing:

    $ cmd.exe /d /s /c pnpm exec ktx sl query --connection-id warehouse --measure orders.order_count --format json --yes --project-dir ...
    
    $ cmd.exe /d /s /c pnpm exec ktx admin runtime status --json
    
    ktx managed runtime lazy install verified
    

    I also reran the same flow with a fresh local environment to reduce the chance of reusing an existing runtime or uv cache:

    $runRoot = Join-Path $env:TEMP ("ktx-fresh-run-" + [guid]::NewGuid().ToString())
    $uvCache = Join-Path $runRoot "uv-cache"
    $ktxHome = Join-Path $runRoot "ktx-home"
    
    New-Item -ItemType Directory -Path $uvCache -Force | Out-Null
    New-Item -ItemType Directory -Path $ktxHome -Force | Out-Null
    
    $env:UV_CACHE_DIR = $uvCache
    $env:HOME = $ktxHome
    $env:USERPROFILE = $ktxHome
    $env:KTX_RUNTIME_ROOT = Join-Path $ktxHome ".ktx\runtime"
    
    node scripts/package-artifacts.mjs check

    That fresh run also completed successfully on my machine.

    What I investigated next

    Since I could not reproduce the failure with the normal 30_000ms timeout, I tested whether this was a timeout/cold-start issue.

    I built the normal package artifacts:

    node scripts/package-artifacts.mjs build

    Then I created a throwaway packed-package smoke workspace from the generated tarball, modified only the generated temp verify-installed-cli.mjs timeout, and reran the installed-CLI smoke with fresh runtime/cache state.

    Timeout hypothesis results

    • With the timeout reduced to 5_000ms, the smoke failed too early at ktx setup, so that value was too aggressive to be useful.
    • With the timeout reduced to 20_000ms, the smoke failed at the exact reported step:
    ktx sl query first managed runtime install failed with code 1
    

    The stderr for that failure showed the managed runtime install starting and finishing:

    Installing KTX Python runtime (core) with uv...
    KTX Python runtime ready: ...
    

    Current conclusion

    Based on local testing, I could not reproduce this with the normal artifact smoke flow, even with a fresh runtime root and fresh uv cache.

    However, reducing the allowed timeout in the generated installed-CLI smoke reproduced the same failing step on Windows. That strongly suggests this is likely a timeout/cold-start issue in the clean-install smoke path, rather than a general functional failure of managed runtime installation on Windows.

    The first ktx sl query --yes path has to do the initial managed Python runtime install with uv, and that appears to be sensitive to the available time budget on fresh/slower Windows environments.

  5. Aryan1718 commented on May 27, 2026

    @Aryan1718
    Contributor

    Hey @andreybavt , do you want me to update this and create a PR so you can test it out?

  6. luca-martial commented on Jul 3, 2026

    @luca-martial
    Contributor

    Hey @Aryan1718 sorry we missed your message. Were you able to investigate further?

  7. Aryan1718 commented on Jul 3, 2026

    @Aryan1718
    Contributor

    Hey @luca-martial , I was waiting for the confirmation. If you would like, I can investigate further. I was also able to find some more edge cases regarding Windows machines, but I am not sure yet. Once I test them properly, I will let you know as well.

  8. luca-martial commented on Jul 4, 2026

    @luca-martial
    Contributor

    Yes feel free to take them, thanks for your contributions so far Aryan!

  9. KeymelGaston commented on Jul 26, 2026

    @KeymelGaston

    Hi @luca-martial @Aryan1718 — checking in on this one, it's been quiet
    for a few weeks. Aryan, are you still working through this, or would
    it be okay if I picked it up from where you left off (the timeout/
    cold-start hypothesis)? Happy to build on your investigation either way.

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

    needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions