feat(backend): make repository_url optional when launching agents

- Remove validation requiring repository_url in lifecycleAdapter.LaunchAgent
- Skip workspace mounts in lifecycle manager when no workspace path is provided
- Agents can now run without a pre-existing workspace directory
This commit is contained in:
jcfs
2026-01-12 02:25:49 +00:00
parent 14e57bd8e3
commit 0ad5082a09
2 changed files with 9 additions and 8 deletions
+3 -8
View File
@@ -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,
}
@@ -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,