3.3 KiB
3.3 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 02-original-session-initialization | Capture the original session configuration before workflow overrides | done | 2 |
|
plan.md | ../../specs/workflow-session-settings/spec.md |
Task 02: Capture the Original Session Configuration Before Workflow Overrides
Acceptance
- The first task session receives immutable original-session provenance; later primary/session switches cannot change that identity.
- A conservative legacy resolver identifies an original only when the earliest non-workflow-switch session is unambiguous.
- The original effective model and every advertised select option are persisted once after profile settings settle and before any workflow/runtime override layer applies.
- The new snapshot remains distinct from
acp_config_baseline,runtime_config,runtime_config_overrides, and mutableAgentProfileSnapshotfields. - ACP initialization accepts separate profile and runtime/workflow layers, preserves existing override/resume behavior, records the original snapshot synchronously, and applies later layers before the first prompt.
- Process recreation, reset, and backend restart never replace the snapshot.
TDD sequence
- Add failing metadata helper, executor provenance, legacy-resolution, and write-once tests.
- Add failing lifecycle tests that assert provider default -> profile -> original capture -> override -> prompt ordering.
- Split the initialization inputs into typed layers and add a narrow recorder callback/interface.
- Re-run existing model-selection, config-option, reset, and resume tests to catch ordering regressions.
Verification
cd apps/backend && go test ./internal/task/models ./internal/task/service ./internal/orchestrator/executor ./internal/agent/runtime/...
Files likely touched
apps/backend/internal/task/models/models.goapps/backend/internal/task/models/models_test.goapps/backend/internal/task/service/service_turns.goapps/backend/internal/orchestrator/executor/executor_execute.goapps/backend/internal/agent/runtime/lifecycle/manager_profile.goapps/backend/internal/agent/runtime/lifecycle/session.goapps/backend/internal/agent/runtime/lifecycle/event_types.goapps/backend/internal/orchestrator/event_handlers_streaming.goapps/backend/internal/backendapp/orchestrator.go- Related lifecycle, executor, service, and streaming tests
Dependencies
Task 01.
Inputs
- ADR
2026-08-01-workflow-session-original-configuration. - Existing provider baseline and runtime override metadata helpers.
- Existing
PrepareSession,effectiveSessionRuntimeConfig,InitializeAndPrompt, andpublishSettledConfigOptionsflow.
Output contract
Implemented with origin=task_initial provenance and the write-once original_effective_config snapshot. The first task session is identified by creation order rather than mutable primary ownership; legacy sessions use the earliest unambiguous non-workflow-switch row. ACP initialization now applies profile settings, emits the profile-settled original snapshot, then applies runtime overrides before the first prompt. Snapshot persistence is compare-and-set and survives later provider events and restarts. Focused lifecycle, executor, streaming, and orchestrator tests passed.