feat: persist concurrent agents slider at project level

Add `default_concurrency` column to the projects table in the registry
database, allowing each project to remember its preferred concurrency
setting (1-5 agents). The value persists across page refreshes and
app restarts.

Backend changes:
- Add `default_concurrency` column to Project model in registry.py
- Add database migration for existing databases (ALTER TABLE)
- Add get/set_project_concurrency() CRUD functions
- Add ProjectSettingsUpdate schema with validation
- Add PATCH /{name}/settings endpoint in projects router
- Include default_concurrency in ProjectSummary/ProjectDetail responses

Frontend changes:
- Add default_concurrency to ProjectSummary TypeScript interface
- Add ProjectSettingsUpdate type and updateProjectSettings API function
- Add useUpdateProjectSettings React Query mutation hook
- Update AgentControl to accept defaultConcurrency prop
- Sync local state when project changes via useEffect
- Debounce slider changes (500ms) before saving to backend
- Pass defaultConcurrency from selectedProjectData in App.tsx

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Auto
2026-01-29 09:08:17 +02:00
parent a12e4aa3b8
commit f6ddffa6e2
9 changed files with 243 additions and 21 deletions

View File

@@ -6,6 +6,7 @@ import type {
ProjectSummary,
ProjectDetail,
ProjectPrompts,
ProjectSettingsUpdate,
FeatureListResponse,
Feature,
FeatureCreate,
@@ -100,6 +101,16 @@ export async function updateProjectPrompts(
})
}
export async function updateProjectSettings(
name: string,
settings: ProjectSettingsUpdate
): Promise<ProjectDetail> {
return fetchJSON(`/projects/${encodeURIComponent(name)}/settings`, {
method: 'PATCH',
body: JSON.stringify(settings),
})
}
// ============================================================================
// Features API
// ============================================================================

View File

@@ -15,6 +15,7 @@ export interface ProjectSummary {
path: string
has_spec: boolean
stats: ProjectStats
default_concurrency: number
}
export interface ProjectDetail extends ProjectSummary {
@@ -536,6 +537,10 @@ export interface SettingsUpdate {
testing_agent_ratio?: number
}
export interface ProjectSettingsUpdate {
default_concurrency?: number
}
// ============================================================================
// Schedule Types
// ============================================================================