WeKnora/frontend
lyingbug 68e6c03dc4
fix(skills): upgrade outdated sandbox skills without rolling back the catalog or taking them offline (#3406)
* fix(skills): keep retries and catalog installs from rewriting the skill definition

Every install path wrote its archive back to the workspace catalog. After a
skill was re-registered as v2, sandboxes still on v1 are pinned to v1's
archive, so retrying one of them (a failed retry, or a ready skill retried
with guidance) reinstalled v1 and also moved the catalog definition back to
v1 and deleted v2's archive.

Installs now carry where their archive came from. Only an upload or a source
pull is a new definition; a retry or a catalog install uses bytes the
workspace already stores and never rewrites the definition. A retry of a
pinned install keeps its pin and replays its own version, and bytes that
neither the definition nor the row holds are refused with a conflict.

The catalog listing also reports each installation's version so the UI can
show what an upgrade moves from and to.

* feat(frontend): upgrade outdated skill installs from the catalog, sandbox drawer and agent editor

An install whose archive differs from the catalog was flagged as outdated,
but nothing could move it to the catalog version: the install drawer hid
ready installs, and the manage drawer only offered a retry, which replays
the sandbox's own archive.

- Skill settings: cards with outdated installs show an upgrade button that
  opens the install drawer with every outdated sandbox preselected. The
  add wizard and install drawer also let outdated ready installs be picked,
  labelled with the version they move from and to.
- Sandbox skill drawer: an outdated skill shows a "new version" row whose
  upgrade button installs the catalog onto that one sandbox.
- Agent editor: skills on the chosen sandbox that are outdated show the
  version change and an upgrade button, both for admins only, matching the
  admin-only catalog install. The install progress entry, which opens a
  drawer backed by admin-only endpoints, is now admin-only too.
- A skill that is being upgraded is no longer pruned from the agent's
  selected skills while it is briefly not ready.

The outdated check is shared in utils/skillUpgrade.ts.

* feat(skills): keep the previous version serving while an upgrade runs or after it fails

An install rewrote the row to the new version and marked it installing as
soon as it started, and the agent is only offered ready rows. So an upgrade
took the skill away from every sandbox for its whole run, and a failed
upgrade kept it away, even though the image pointer only moves on success
and the previous version was in the image the whole time.

The row now records what it described when it was last ready (served:
version, description, instructions, digest, the archive its files come from,
and the snapshot that installed it). The agent's usable set, member env
acceptance and the @-mention list read TenantSkillEntity.ServedView, which
is that version marked ready while the row is installing or failed. A
successful install clears it and releases its archive; a failure or a stop
keeps it.

Keeping that consistent:
- The served archive counts as a reader when a bundle is released or
  replaced by a re-registered catalog, so v1's files stay readable while v2
  installs.
- The reaper and a failed removal put the served version back when the image
  never moved past it, instead of labelling v1's files with the upgrade's
  metadata. A stuck upgrade whose chain cannot be read is left alone, since
  v1 keeps serving meanwhile.
- The env declaration is stored after the pointer moves rather than before
  the snapshot, so an upgrade that fails late cannot drop the admin value of
  a variable the previous version still reads.

Migration 000104 adds tenant_skills.served. The console says "upgrading,
still running 1.1.0" or "upgrade failed, still running 1.1.0", the agent
editor keeps such skills selectable, and the upgrade texts no longer warn
that the skill goes offline.

* fix(skills): offer only the upgrade to installs the catalog has moved past

Review follow-up on the upgrade flow.

- An install that differs from the catalog, ready or failed, is now offered
  the upgrade and not the retries. The retry icon and the retry-with-guidance
  box both replay the archive the install is pinned to, so next to an
  Upgrade button they reinstalled the version the operator came to leave
  behind. A failed first install of v1 whose catalog has since moved to v2
  used to retry v1 from the drawer while the agent editor's Install went to
  v2; every entry now goes to v2, and the agent editor labels it "Upgrade".
  The drawer explains that the failed install is replaced by the catalog
  version.
- A catalog install or a retry reuses the definition that already holds its
  bytes instead of re-running the catalog upsert, which rewrote the row and
  bumped its updated_at every time the skill was installed somewhere. The
  upsert still runs for a definition that does not exist yet or whose object
  was lost.
2026-09-18 20:27:43 +08:00
..
public feat(i18n): add Japanese (ja-JP) locale support (#3080) 2026-09-07 19:20:41 +08:00
scripts feat(browser): add picture-in-picture task preview 2026-09-12 11:11:36 +08:00
src fix(skills): upgrade outdated sandbox skills without rolling back the catalog or taking them offline (#3406) 2026-09-18 20:27:43 +08:00
.dockerignore feat(ui): multi-stage Docker frontend build (no host npm) (#3074) 2026-09-07 19:33:57 +08:00
.gitignore init commit 2025-08-05 15:08:07 +08:00
Dockerfile chore: remove vendored archives and unused Python helpers 2026-09-16 15:49:36 +08:00
docker-entrypoint.sh feat(i18n): add Japanese (ja-JP) locale support (#3080) 2026-09-07 19:20:41 +08:00
embed.html feat(embed): add widget, visitor chat, and management UI (#1657) 2026-06-12 23:10:39 +08:00
env.d.ts feat(frontend): inject commit ID into frontend build for version tracking 2026-06-09 18:08:57 +08:00
index.html fix(frontend): bundle tdesign-icons sprite locally for offline deploys 2026-04-23 18:21:49 +08:00
nginx-api-proxy.conf fix(embed): enforce host origin allowlists on framed pages 2026-09-14 18:03:57 +08:00
nginx-http.conf feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
nginx.conf feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
package-lock.json chore: remove vendored archives and unused Python helpers 2026-09-16 15:49:36 +08:00
package.json chore: remove vendored archives and unused Python helpers 2026-09-16 15:49:36 +08:00
package.json.md5 fix: update environment configuration for debugging and logging, enhance SQLite FTS5 table management, and improve API base URL handling 2026-04-11 18:51:16 +08:00
pnpm-workspace.yaml fix(frontend): configure pnpm v11 build approvals in workspace file 2026-05-08 16:34:33 +08:00
tsconfig.app.json fix lint and test failures 2026-07-01 17:31:42 +08:00
tsconfig.json init commit 2025-08-05 15:08:07 +08:00
tsconfig.node.json init commit 2025-08-05 15:08:07 +08:00
vite.config.ts feat(session): fork conversations from a historical user message (#3304) 2026-09-17 14:20:18 +08:00