daemon: drop worker models.json bind (host-path bind of container path was invalid; image bakes it)

This commit is contained in:
Raphael Westphal
2026-08-18 15:49:37 +02:00
parent b5d267e61e
commit 7a7a130a1a
3 changed files with 0 additions and 39 deletions
-8
View File
@@ -43,7 +43,6 @@ const (
volumeSessions string = "lvmh-sessions"
workspaceMount string = "/workspace"
sessionsMount string = "/pi-sessions"
modelsMountTarget string = "/root/.pi/agent/models.json"
envWorkerDockerfile string = "LVMH_WORKER_DOCKERFILE"
defaultDockerfile string = "/app/build/docker/worker.Dockerfile"
@@ -54,8 +53,6 @@ const (
defaultContainerURL string = "ws://lvmh:8686/agent/ws"
envContainerNetwork string = "LVMH_CONTAINER_NETWORK"
defaultNetwork string = "lvmh-net"
envWorkerModels string = "LVMH_WORKER_MODELS"
defaultWorkerModels string = "/app/build/docker/worker-models.json"
envProviderAPIKey string = "ZAI_RENAUD_API_KEY"
envLVMHSessionID string = "LVMH_SESSION_ID"
envLVMHAgent string = "LVMH_AGENT"
@@ -123,7 +120,6 @@ type Spawner struct {
buildContext string
containerURL string
network string
modelsPath string
mu sync.Mutex
jobs map[string]*SpawnJob // keyed by sessionId
@@ -146,7 +142,6 @@ func NewSpawner(store *Store, hub *Hub, baseURL string) (*Spawner, error) {
buildContext: envOr(envWorkerContext, filepath.Dir(filepath.Dir(dockerfile))),
containerURL: envOr(envContainerLVMHURL, defaultContainerURL),
network: envOr(envContainerNetwork, defaultNetwork),
modelsPath: envOr(envWorkerModels, defaultWorkerModels),
jobs: make(map[string]*SpawnJob),
slugLocks: make(map[string]*sync.Mutex),
}, nil
@@ -389,9 +384,6 @@ func (s *Spawner) createAndStart(ctx context.Context, repo, slug, sessionID stri
}
binds := []string{repoVolume + ":" + workspaceMount, volumeSessions + ":" + sessionsMount}
if _, err := os.Stat(s.modelsPath); err == nil {
binds = append(binds, s.modelsPath+":"+modelsMountTarget+":ro")
}
cfg := &container.Config{
Image: imageRefWorker,
Env: []string{
-1
View File
@@ -322,7 +322,6 @@ func newTestSpawner(t *testing.T, f *fakeDocker) (*Spawner, *Store) {
t.Setenv(envWorkerContext, buildCtx)
t.Setenv(envRepoDir, t.TempDir())
t.Setenv(envProviderAPIKey, "key-123")
t.Setenv(envWorkerModels, "") // fall back to default path (absent) → no models bind
daemonToken = testToken
store := openTestStore(t)
-30
View File
@@ -276,36 +276,6 @@ func TestSpawnerCloneURLInjectsPAT(t *testing.T) {
}
}
func TestSpawnerModelsBindWhenPresent(t *testing.T) {
useFakeGit(t, fakeGitModeOK)
f := newFakeDocker()
sp, _ := newTestSpawner(t, f)
models := filepath.Join(t.TempDir(), "models.json")
if err := os.WriteFile(models, []byte("{}"), 0o644); err != nil {
t.Fatalf("write models: %v", err)
}
sp.modelsPath = models
res, err := sp.Start(context.Background(), "group/project", "")
if err != nil {
t.Fatalf("Start: %v", err)
}
waitJobState(t, sp, res.SessionID, stateRunning)
creates := f.createsByName("lvmh-agent-")
if len(creates) != 1 {
t.Fatalf("creates = %d", len(creates))
}
roFound := false
for _, b := range creates[0].HostConfig.Binds {
if b == models+":"+modelsMountTarget+":ro" {
roFound = true
}
}
if !roFound {
t.Fatalf("models read-only bind missing: %v", creates[0].HostConfig.Binds)
}
}
func TestSpawnerRemoveSession(t *testing.T) {
useFakeGit(t, fakeGitModeOK)
f := newFakeDocker()