3.6 KiB
3.6 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | ||
|---|---|---|---|---|---|---|---|---|
| 03-runtime-rule-application | Apply matching workflow rules to the original session | done | 3 |
|
plan.md | ../../specs/tasks/requirements/workflow-session-settings.md |
Task 03: Apply Matching Workflow Rules to the Original Session
Acceptance
- Runtime matching uses the original session's immutable
agent_nameand applies at most one rule. - No match and
keepare silent no-ops; neither writes a runtime override. setchanges only named fields, whilerestore_originalattempts the captured model and every still-advertised select option.- Rules never create, switch, reactivate, or rename a session. A non-original active session is left untouched and receives a visible workflow warning.
- Running-session fields apply independently through ACP and successful values persist through the task service as explicit overrides.
- Start-step rules run through the layered initialization path after original capture and before the first prompt.
- Transition rules run after any context reset and before plan/mode setup and auto-start prompt dispatch.
- Unsupported/rejected fields and persistence failures produce one sanitized visible warning with retained values; successful fields remain applied and auto-start continues.
- Missing legacy snapshots and removed restore options warn and no-op/partially restore exactly as specified.
TDD sequence
- Add failing orchestrator tests for match, no-match, keep, set, restore, wrong active session, and start-step ordering.
- Add the narrow runtime setter/result and task-service override-writer seams, then wire them in
backendapp. - Implement best-effort field application and sanitized warning aggregation.
- Add failure, persistence, restart, reset-before-config, and auto-start-continuation tests.
Verification
cd apps/backend && go test ./internal/orchestrator/... ./internal/agent/runtime/... ./internal/task/service ./internal/backendapp/...
Files likely touched
apps/backend/internal/orchestrator/event_handlers_workflow.goapps/backend/internal/orchestrator/event_handlers_workflow_profile_test.goapps/backend/internal/orchestrator/service.goapps/backend/internal/orchestrator/executor/executor.goapps/backend/internal/orchestrator/executor/executor_execute.goapps/backend/internal/agent/runtime/runtime.goapps/backend/internal/agent/runtime/facade.goapps/backend/internal/agent/runtime/lifecycle/manager_interaction.goapps/backend/internal/task/service/service_turns.goapps/backend/internal/backendapp/adapters.goapps/backend/internal/backendapp/orchestrator.go- Related mocks and integration tests
Dependencies
Tasks 01 and 02.
Inputs
- Spec sections
State machine,Failure modes, andScenarios. - Existing
processOnEnter,StartCreatedSession, ACP model/config setters, runtime override persistence, routing-error sanitization, and session-message patterns.
Output contract
Implemented family matching against the immutable original session, launch-time durable layering, live ACP model/option updates, best-effort field persistence, and sanitized warning messages. keep and no-match are no-ops; restore uses the immutable snapshot; non-original and passthrough sessions are never switched. Start-step and on-enter ordering are covered by orchestrator tests, including persistence and restore behavior. No provider-specific branches were added; providers without the optional ACP option setter receive a visible warning for those fields.