3.1 KiB
3.1 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 02-persist-model-warning | Persist model-selection warnings | done | 2 |
|
plan.md | ../../specs/agents/requirements/no-silent-model-fallback.md |
Task 02: Persist model-selection warnings
Acceptance
- Every default or explicit fallback emits structured requested, effective, agent, executor, and reason data.
- The orchestrator persists one warning status message for each session-start decision, and reload hydration returns it.
- Event replay or message failure does not create duplicates or stop the task launch.
TDD scenarios
- RED: Add lifecycle event tests for explicit fallback, provider default, unknown effective model, and unsupported selection.
- RED: Add orchestrator tests for status metadata, idempotency, replay, and persistence errors.
- RED: Add gateway tests for the provider-neutral live event and old-event compatibility.
- GREEN: Generalize the lifecycle event and persist the semantic warning message.
- REFACTOR: Keep the event payload, stored metadata, and WebSocket payload on one shared shape.
Verification
cd apps/backend && go test -tags fts5 -run 'Test.*ModelSelectionWarning|Test.*ModelFallback' ./internal/agent/runtime/lifecycle ./internal/orchestrator ./internal/gateway/websocketcd apps/backend && go test -tags fts5 ./internal/orchestrator ./internal/gateway/websocketgit diff --check
Files likely touched
apps/backend/internal/agentctl/types/streams/agent.goapps/backend/internal/agent/runtime/lifecycle/event_types.goapps/backend/internal/agent/runtime/lifecycle/events.goapps/backend/internal/agent/runtime/lifecycle/session.goapps/backend/internal/events/types.goapps/backend/internal/orchestrator/event_handlers_streaming.goapps/backend/internal/orchestrator/event_handlers_streaming_test.goapps/backend/internal/orchestrator/service.goapps/backend/internal/gateway/websocket/session_notifications.goapps/backend/internal/gateway/websocket/session_notifications_test.goapps/backend/pkg/websocket/actions.go
Dependencies
- Task 01 supplies the typed model decision.
Parallelism
Sequential after Task 01. This task defines the persisted and live warning contracts.
Inputs
- The typed decision from Task 01.
- The current
session_model_fallbackevent. - The existing
CreateSessionMessagewarning path. - The existing task message repository and hydration flow.
Output contract
Report the event shape, message metadata, idempotency method, RED evidence, GREEN evidence, and test results.
Risks
- The lifecycle event can arrive before the session identity is linked.
- A blank turn ID must use the existing session-status message convention.
- Compatibility consumers can still depend on
session.model_fallback.
Results
Implemented structured warning events, idempotent best-effort persistence, provider-neutral WebSocket notification, and durable metadata hydration. The orchestrator and gateway suites passed with 2,270 tests; the combined backend targeted suite passed with 7,299 tests.