## Summary
Adds looped auto-fix support to `deep-review-workflow`, including
iteration budgeting, replay-safe workflow step IDs, validation gating,
branch/HEAD drift safety, and clearer workflow task actions that only
offer task-workspace navigation when the child workspace still exists.
## Background
`deep-review-workflow --fix` previously performed a single review/fix
pass. This change adds a `--loop` mode so the workflow can re-review
after applied fixes and stop when the code is clean, the fix budget is
exhausted, validation fails or is not run, no fix progress is made, or
the loop safety cap is reached. It also fixes a workflow-events UX issue
where stale task-workspace navigation could be shown after a child task
workspace had been deleted.
## Implementation
- Adds `--loop` / `--no-loop` parsing and `maxLoopIterations` handling.
- Splits the workflow into reusable single-pass and loop orchestration
paths with per-iteration step suffixes to avoid stale durable replay
results.
- Tracks `maxFixes` as a run-wide budget and performs a read-only
confirmation pass after budget exhaustion.
- Hardens auto-fix preflight for local clean worktrees, reviewed
branch/HEAD drift, detached HEAD, ambiguous hex-like refs, and durable
checkpoint retries after a patch advances `HEAD`.
- Requires post-fix validation to pass before continuing loop
iterations; `not-run` now stops with an incomplete loop result.
- Adapts scratch workflow ignore handling to the latest lazy
scratch-ignore behavior on `main`.
- Makes workflow task workspace/open affordances depend on live
workspace metadata, while keeping completed task reports accessible
after child workspaces are deleted.
## Validation
- `bun test
src/node/services/workflows/builtInWorkflowDefinitions.test.ts --timeout
20000`
- `bun test src/node/services/workflows/WorkflowDefinitionStore.test.ts
--timeout 20000`
- `bun test
src/node/services/workflows/builtInWorkflowDefinitions.test.ts`
- `bun test src/node/services/workflows/WorkflowDefinitionStore.test.ts`
- `bun test src/browser/features/Tools/WorkflowRunToolCall.test.tsx`
- `make typecheck`
- `make static-check`
## Risks
This touches durable workflow orchestration, parent-workspace patch
application safety, scratch workflow ignore behavior, and workflow-run
task actions. Regression coverage was added for loop exits, run-wide
budgets, replay after applied patches, detached/ambiguous refs,
validation not-run handling, scratch gitignore edge cases, and
stale/deleted task-workspace actions.
## Pains
The branch was rebased after `main` landed lazy scratch workflow ignore
handling and inline workflow task structured output, so the final branch
explicitly resolves those overlaps and was revalidated after the rebase.
---
_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` •
Cost: `$193.56`_
<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=193.56
-->
---------
Signed-off-by: Thomas Kosiewski <tk@coder.com>