diff --git a/apps/backend/cmd/kandev/main.go b/apps/backend/cmd/kandev/main.go index 4622d5e608..e1d678b0ad 100644 --- a/apps/backend/cmd/kandev/main.go +++ b/apps/backend/cmd/kandev/main.go @@ -519,17 +519,12 @@ func newLifecycleAdapter(mgr *lifecycle.Manager, reg *registry.Registry, log *lo // LaunchAgent starts a new agent container for a task func (a *lifecycleAdapter) LaunchAgent(ctx context.Context, req *executor.LaunchAgentRequest) (*executor.LaunchAgentResponse, error) { - // The RepositoryURL field should contain a local filesystem path for the workspace - // If it's empty, we cannot mount the workspace into the container - workspacePath := req.RepositoryURL - if workspacePath == "" { - return nil, fmt.Errorf("task has no repository_url configured - please set a local repository path on the task") - } - + // The RepositoryURL field contains a local filesystem path for the workspace + // If empty, the agent will run without a mounted workspace launchReq := &lifecycle.LaunchRequest{ TaskID: req.TaskID, AgentType: req.AgentType, - WorkspacePath: workspacePath, + WorkspacePath: req.RepositoryURL, // May be empty - lifecycle manager handles this TaskDescription: req.TaskDescription, Metadata: req.Metadata, } diff --git a/apps/backend/internal/agent/lifecycle/manager.go b/apps/backend/internal/agent/lifecycle/manager.go index 7b48970f89..66ef817257 100644 --- a/apps/backend/internal/agent/lifecycle/manager.go +++ b/apps/backend/internal/agent/lifecycle/manager.go @@ -789,6 +789,12 @@ func (m *Manager) buildContainerConfig(instanceID string, req *LaunchRequest, ag // Expand mount templates mounts := make([]docker.MountConfig, 0, len(agentConfig.Mounts)) for _, mt := range agentConfig.Mounts { + // Skip workspace mounts if no workspace path is provided + if strings.Contains(mt.Source, "{workspace}") && req.WorkspacePath == "" { + m.logger.Debug("skipping workspace mount - no workspace path provided", + zap.String("target", mt.Target)) + continue + } source := m.expandMountTemplate(mt.Source, req.WorkspacePath, req.TaskID) mounts = append(mounts, docker.MountConfig{ Source: source,