fix(plugin): persist v4 runtime state and tolerate runner registration gaps (#2774)

Persist the v4 plugin runtime state so recreating the runtime container no
longer discards installed plugins' artifacts, dependency environments and
installation-private data, and stop a transient Runner registry miss during
steering from dropping the message.

- docker-compose: bind-mount ./data/plugin-runtime for the plugin runtime
  alongside ./data/plugins.
- kubernetes: add the langbot-plugin-runtime-state claim (5Gi) mounted at
  /app/data/plugin-runtime, kept separate from the plugin data claim so
  runtime state does not land inside the plugin directory.
- chat handler: treat RunnerNotFoundError while claiming steering as
  "steering unavailable" and continue with a normal run; every other error
  keeps propagating. The runner error imports move to module scope, which
  the new early reference requires.
- tests: cover the steering fallback, the claimed-steering interrupt, and
  the lasting-gap path that still reports runner-not-found.

The steering fallback buys one extra uncached registry lookup while a
runtime reconnects; it does not recover a gap that outlasts the message.
This commit is contained in:
Martin
2026-10-27 20:31:49 +08:00
committed by GitHub
parent 6990607c5c
commit 12debe2747
4 changed files with 220 additions and 10 deletions
+5
View File
@@ -9,6 +9,11 @@ services:
container_name: langbot_plugin_runtime
volumes:
- ./data/plugins:/app/data/plugins
# Persist the v4 plugin artifact cache, dependency environments, and
# per-installation data. Without this, recreating the container throws
# away every installed plugin's environment and private data while
# data/plugins survives.
- ./data/plugin-runtime:/app/data/plugin-runtime
ports:
- 5401:5401
restart: on-failure
+24
View File
@@ -81,6 +81,25 @@ spec:
# Uncomment and modify if you have a specific StorageClass
# storageClassName: your-storage-class
---
# PersistentVolumeClaim for the v4 Plugin Runtime state
# Holds the plugin artifact cache, per-plugin dependency environments, and
# per-installation data. It must survive Pod restarts: rebuilding it forces
# every installed plugin to be re-downloaded and its environment rebuilt.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: langbot-plugin-runtime-state
namespace: langbot
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
# Uncomment and modify if you have a specific StorageClass
# storageClassName: your-storage-class
---
# ConfigMap for environment configuration
apiVersion: v1
@@ -160,6 +179,8 @@ spec:
volumeMounts:
- name: plugin-data
mountPath: /app/data/plugins
- name: plugin-runtime-state
mountPath: /app/data/plugin-runtime
resources:
requests:
memory: "512Mi"
@@ -189,6 +210,9 @@ spec:
- name: plugin-data
persistentVolumeClaim:
claimName: langbot-plugin-runtime-data
- name: plugin-runtime-state
persistentVolumeClaim:
claimName: langbot-plugin-runtime-state
restartPolicy: Always
---