Skip to content

(CODUX-220) Settle preparation failures and recovery - #3032

Merged
numnx merged 1 commit into
feature/CODUX-220-reduce-invocation-visibility-latency-safelyfrom
task/feature-codux-22-t03-codex-959d9fba-mrjkhzjm
Jul 13, 2026
Merged

(CODUX-220) Settle preparation failures and recovery#3032
numnx merged 1 commit into
feature/CODUX-220-reduce-invocation-visibility-latency-safelyfrom
task/feature-codux-22-t03-codex-959d9fba-mrjkhzjm

Conversation

@numnx

@numnx numnx commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

🧩 Task: Settle preparation failures and recovery

Automated task PR opened by Code UX for T03.

📋 Summary

Sprint: Sprint 220 · Reduce invocation visibility latency safely · Task: T03

Make CLI task-coding execution invocations server-visible immediately after cancellation registration and before workspace preparation, while preserving truthful provider telemetry, recovery semantics, server-authoritative dashboards, and realtime Stats freshness.

🤖 Model & Provider

Provider Codex CLI
Model gpt-5.6-sol

⏱️ Timing

Started 2026-07-13 18:40:20 UTC
Finished 2026-07-13 18:52:25 UTC
Duration 12m 5s

📊 Token Usage

Metric Value
Input tokens 191,179
Cached input tokens 9,247,232
Output tokens 25,216
Total tokens 9,463,627
Invocations 1
Tool calls 89
Active time 11m 36s

Included usage estimate (subscription/local login): $6.34

✅ QA Review

⏳ QA review runs after this PR is opened. Check the task card in the dashboard for the outcome once it lands.

📝 Full Task Prompt
## Objective
Ensure every early-created CLI execution invocation reaches an honest terminal or intentional recovery state without duplicate updates or misleading running rows.

## Scope
- `src/services/cli-workflow-service.ts`, including `runTaskWorkflow`, `updateExecutionState`, and workflow cleanup paths
- `src/services/runtime-recovery/invocation-recovery.ts`, especially interrupted task-coding reconciliation
- `src/services/runtime-startup-recovery-service.ts`, where startup recovery delegates task-coding reconciliation
- `src/services/execution-invocation-control-service.ts`, where cancellation state is closed
- `tests/backend/services/cli-workflow-service.test.ts`
- `tests/backend/services/runtime-startup-recovery-service.test.ts`
- `tests/backend/services/execution-invocation-control-service.test.ts`

## Implementation Requirements
1. Add an idempotent CLI execution-invocation finalizer for successful completion, preparation/routing/agent/memory/workspace/Git/Docker failures, and cancellation; set `finishedAt`, diagnostic fields, and one concise system audit message only while the row is still active.
2. On cancellation after dispatch registration, abort the active workflow, close task-run and dispatch state consistently, mark the execution invocation cancelled once, and prevent late provider or workflow finalizers from overwriting it.
3. Preserve shutdown semantics by leaving intentionally active rows available for startup recovery, while teaching interrupted task-coding reconciliation to distinguish valid pre-provider recovery rows from stale no-provider rows and settle stale rows with useful audit evidence.
4. Make resumed-workspace provider-completion recovery finalize the current workflow truthfully without invoking the provider again, creating duplicate provider usage, or leaving a second execution row running; cover terminal task, sprint, dispatch, and provider evidence.
5. Add focused tests for preparation failure, cancellation during preparation, shutdown interruption, stale pre-provider recovery, recovered provider completion, and idempotent late updates.

## Constraints
- Keep provider claim timing and provider usage finalization owned by `ProviderExecutionService`.
- Do not overwrite rows intentionally preserved for startup recovery.
- Preserve existing task-state, dispatch, workspace-cleanup, retry, and sprint-cancellation behavior.
- Keep documentation changes in the dedicated documentation task.

## Verification
- Run `pnpm exec vitest run tests/backend/services/cli-workflow-service.test.ts tests/backend/services/runtime-startup-recovery-service.test.ts tests/backend/services/execution-invocation-control-service.test.ts`.
- Confirm every non-shutdown early failure has a terminal execution row with `finishedAt` and an audit message, while shutdown rows remain recoverable.
- Run `pnpm run lint`.
🌿 Branch Info

Base: feature/CODUX-220-reduce-invocation-visibility-latency-safely
Head: task/feature-codux-22-t03-codex-959d9fba-mrjkhzjm


🤖 Generated by Code UX

@numnx
numnx merged commit 31f21dd into feature/CODUX-220-reduce-invocation-visibility-latency-safely Jul 13, 2026
20 checks passed
@numnx
numnx deleted the task/feature-codux-22-t03-codex-959d9fba-mrjkhzjm branch July 13, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant