Skip to content

Deferred Windows self-update is intermittent: reports (scheduled), then silently never applies #571

Description

@padak

Split out of #528. That issue was about the self-update corrupting the uv tool environment, which is fixed. This one is the symptom that remains: on Windows the update is scheduled, announced, and then silently never applied.

It fails safe — nothing is damaged, the install stays usable — but the user stays on an old version while being told an update is on its way.

Reproduced

Windows 11 (26200), kbagent installed with uv tool install, sleep disabled, nothing else running.

Each trial: fresh uv tool install --force of 0.80.0 → delete every pending_update.*kbagent update → hold the session open 100 s with no kbagent process alive → check.

trial before after pending_update.exit
1 v0.80.0 v0.80.0 not written
2 v0.80.0 v0.80.0 not written
3 v0.80.0 v0.80.0 not written

kbagent update reports:

kbagent v0.80.0 -> v0.80.1 (scheduled) | keboola-mcp-server v1.74.6 (already up to date)
kbagent v0.80.1 will be installed as soon as every kbagent process has exited

pending_update.json is written every time. No exit file and no install log ever appear, so the helper is not reaching either branch of its try/catch — not the install, and not the "gave up because kbagent is still running" path.

It is intermittent, which is the hard part

Earlier the same day, on the same machine, the same flow succeeded three times in a row (0.79.0 → 0.80.0, with marker, exit file and a full install log). I have not found the variable that flips it. Both of my earlier confident explanations were wrong, so this issue deliberately carries no proposed cause — only measurements.

Impact

  • Windows users on a uv install can sit on an old version indefinitely. The single-flight marker then suppresses retries for DEFERRED_UPDATE_STALE_SECONDS (24 h) while every launch still prints "Updating in the background".
  • Independently reported: "we never saw the deferred update actually arrive" — @papousek-radan in fix(windows): idempotency store, sliced download, and doctor permission check #566. That steady-state observation is what prompted the retest.
  • v0.80.1 contains four Windows fixes that affected users will not receive automatically.

Workaround (verified)

uv tool install --force --reinstall "keboola-cli @ https://github.com/keboola/cli/releases/download/v0.80.1/keboola_cli-0.80.1-py3-none-any.whl"

One lead, explicitly not a conclusion

An isolated probe spawning powershell.exe with DETACHED_PROCESS (the flag request_deferred_update uses) reliably exits 0 within a second having executed nothing, while CREATE_NO_WINDOW runs the same script correctly. Reproduced under a real console, so it is not an SSH artefact.

That looks like the answer and I already shipped it once as a fix before retracting it — the real helper demonstrably does run sometimes, which the probe cannot explain. Treat it as an unexplained data point, not a diagnosis.

Suggested next step

Instrument rather than theorise: have the helper write its marker file as its very first statement, so a run that starts and a run that never starts stop being indistinguishable. Right now "helper died instantly" and "helper never spawned" leave identical evidence, which is why three rounds of investigation have not separated them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions