4.5 KiB
4.5 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec |
|---|---|---|---|---|---|---|
| 01-clear-deleted-session-error | Clear the deleted session error | done | 1 | plan.md | ../../specs/platform/requirements/bounded-task-status-delivery.md |
Task 01: Clear the Deleted Session Error
Intent
Remove a deleted session's error from the task status summary immediately after session deletion.
Acceptance
- A successful
Service.DeleteSessionpublishes one inactive error occurrence for the removed session. - The persisted task summary has no error from the removed session after the projector processes the occurrence.
- If another session has a recoverable error, deleting the current summary winner leaves the retained session's error projected.
- Recoverable error persistence and publication serialize with session deletion for the same session.
- A transient non-not-found session read error does not skip recovery state reconciliation, messaging, or execution cleanup.
- Concurrent deletions of sessions in one task cannot restore an error for a session that was already deleted.
- The projector restart regression stops the old projector synchronously before cold-start hydration.
- Existing queue cleanup, workspace retention, and primary-session promotion behavior remains unchanged.
Files Likely Touched
apps/backend/internal/orchestrator/task_operations.goapps/backend/internal/orchestrator/queue_purge_status_test.goapps/backend/internal/orchestrator/event_handlers_agent.goapps/backend/internal/orchestrator/service.goapps/backend/internal/orchestrator/task_session_error_fixup_test.go
Dependencies
None.
Parallelism
sequential
Inputs
- The
active_errorderivation and deletion scenario in the bounded task-status delivery spec. - The existing inactive
TaskSessionErrorChangedcontract instatussummary.Projector. - The queue-status publication pattern in
Service.DeleteSession.
Implementation
- Add a regression test that starts the status-summary projector on the service event bus.
- Publish an active error for a completed session and make sure that the stored summary contains it.
- Delete the session and make sure that the stored summary removes the error.
- Publish an inactive session-error occurrence after the repository removes the session row.
- Use
context.WithoutCancelfor the post-commit publication and log publication errors. - Re-publish the newest retained session error after deletion to repair a summary hydrated before the deletion.
- Serialize recoverable-error side effects with the session deletion guard.
- Continue recoverable-error handling after transient session reads, while suppressing it only for
models.ErrTaskSessionNotFound. - Serialize deletion and retained-error repair by task, with a barrier regression for concurrent deletions.
- Stop the old status-summary projector synchronously in the restart regression.
Verification
Run this command from the repository root:
cd apps/backend && go test -tags fts5 -run 'TestDeleteSessionClearsProjectedAgentError|TestDeleteSessionCancelsQueuedPromptsAndPublishesStatus' ./internal/orchestrator -count=1
Output Contract
Report the source and test files that changed. Report the exact command and its result. Update this task status, this task's results, the plan checkbox, and the plan verification results. Report blockers and remaining risks.
Results
Completed.
- Changed
apps/backend/internal/orchestrator/task_operations.goto publish an inactiveTaskSessionErrorChangedoccurrence after session deletion commits. - Added
TestDeleteSessionClearsProjectedAgentErrortoapps/backend/internal/orchestrator/queue_purge_status_test.go. - Added restart and guard regressions in
apps/backend/internal/orchestrator/queue_purge_status_test.go. - Verification passed: the original 2-test command passed, and the 4-test focused fixup command passed.
- Re-published the newest retained session error after deletion and serialized recoverable-error publication with the session deletion guard.
- Added a transient-read fault-injection regression and restored the existing recovery/state/cleanup path for non-not-found read errors.
- Added task-level serialization and a barrier-based concurrent-deletion regression.
- The restart regression now closes the old projector before starting the replacement.
- Verification passed: 3 focused tests, 6 focused race tests, and 1,812 orchestrator package tests.
- No blockers. Event publication remains best effort, and a later authoritative rebuild can repair a summary if publication fails.