2.5 KiB
2.5 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec |
|---|---|---|---|---|---|---|
| task-01-profile-fields | Add fallback_model and auto_fallback to agent profiles | done | 1 | docs/plans/no-silent-model-fallback/plan.md | docs/specs/agents/requirements/no-silent-model-fallback.md |
Task 1 — Profile fields: fallback_model + auto_fallback
Change
Add two fields to agent_profiles and thread them end-to-end:
fallback_model TEXT NOT NULL DEFAULT ''— optional single ACP model ID.auto_fallback INTEGER NOT NULL DEFAULT 0— explicit opt-in to legacy automatic fallback.
Files:
apps/backend/internal/agent/settings/store/sqlite.go— migrationr.migrate.Apply("agent_profiles.fallback_model", ...)andagent_profiles.auto_fallbackfollowing the existing pattern (seeagent_profiles.command_prefix); scan + insert paths for the new columns.apps/backend/internal/agent/settings/models/models.go—AgentProfilegainsFallbackModel string+AutoFallback boolwith JSON/db tags mirroringModel.apps/backend/internal/agent/settings/dto/dto.go—AgentProfileDTOgainsfallback_model,omitempty+auto_fallback; the create/update request DTOs accept them.apps/backend/internal/agent/settings/controller/profile_crud.go—toProfileDTO/ create / update request→model mapping.apps/web/lib/types/agent-profile.ts—AgentProfile+AgentProfilePayloadgainfallbackModel/autoFallback.apps/web/lib/api/domains/agent-profile-normalize.ts—normalizeAgentProfile/toAgentProfilePayloadround-trip.
Runtime precedence rule: when auto_fallback is true, fallback_model is
ignored. Saving both is allowed (no cross-field rejection).
Acceptance
- A profile created via
POST /api/v1/agents/:id/profileswithfallback_modelandauto_fallbackround-trips throughGET /api/v1/agents(DTO includes both fields). PATCH /api/v1/agent-profiles/:idupdates both fields.- Store test: scan/insert preserves both fields; migration applies to an
existing DB (existing rows get
''/0). - Frontend normalize test: wire ↔ state round-trip.
Verification
make -C apps/backend test ./internal/agent/settings/...
cd apps/web && pnpm vitest run lib/api/domains/agent-profile-normalize.test.ts
cd apps/web && pnpm run typecheck
Risks
- Migration ordering: add the two
Applycalls near the otheragent_profiles.*migrations; existing rows default to strict mode. - The settings store uses manual scan structs — verify all SELECT column lists are updated.