Skip to content

Self-update triggered mid-session leaves kbagent completely uninstalled (worse than #771's stale-version case) #786

Description

@MichalProchazkaP3

Summary

kbagent's startup self-update check triggered in the middle of a session
where kbagent was being actively invoked repeatedly (an AI agent running
several kbagent data-app/kbagent storage commands back to back). The
update printed:

Updating kbagent v0.94.0 -> v0.95.0 in the background; it applies once every kbagent process has exited.

...and the next kbagent invocation (a few seconds later) failed outright:

kbagent: command not found

Unlike #771 (where a failed auto-update leaves the old version working),
here the tool disappeared entirely — not just stale, but gone.

Diagnostics performed (nothing found)

  • which kbagent / where.exe kbagent (both Git Bash and PowerShell): not found anywhere in PATH.
  • uv tool list: no kbagent/keboola-cli/keboola-agent-cli entry at all.
  • ls "$(uv tool dir)": no corresponding directory (only an unrelated, unaffected tool is present).
  • pip show kbagent / pipx list / python -m kbagent: nothing.
  • No ~/.kbagent or similar config/log directory found anywhere under the user profile or AppData.
  • No files found under AppData modified in the ~40-minute window around the failure (aside from Claude Code's own session files).

So the self-update appears to have removed the existing uv tool entry as
part of the upgrade attempt, then failed to complete installing the new
one — leaving nothing behind, with no error surfaced and no log to
diagnose from afterward.

Why this matters for agent use specifically

This CLI is explicitly designed to be driven by AI agents (per
for-agents docs). An agent mid-task has no way to notice "an update is
about to happen" ahead of time, no way to defer it, and — per this
report — no way to recover afterward except waiting and hoping, since
there's no local trace to act on. A background self-update firing between
two commands in the same session is a plausible way to hit this on any
long-running agent session, not just an edge case.

Suggested fixes

  1. Never trigger the self-update while kbagent is being actively
    invoked in a session
    (e.g. gate it to only check/apply on the first
    invocation after a period of inactivity, or require an explicit
    kbagent update, not an implicit one during normal command use).
  2. Make the update atomic: never remove/unlink the currently-working
    version until the new one is confirmed installed and runnable. Right
    now a failed update can apparently leave zero working versions, which
    is strictly worse than doing nothing.
  3. Log the update attempt somewhere durable (even just stdout/stderr
    of the update step itself, or a small log file) so a failure like this
    is diagnosable without needing to forensically search the filesystem.

Environment

  • Windows 11, Git Bash (MSYS) + PowerShell
  • kbagent v0.94.0 -> v0.95.0 (self-update)
  • Installed via uv tool install (inferred; no local trace survived to confirm the exact original install path)
  • Used inside an AI agent session (Claude Code) issuing repeated kbagent commands

Related but distinct: #771 (auto-update fails but stale version keeps
working). This report is the case where the update fails AND the working
version is also gone.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions