> For the complete documentation index, see [llms.txt](https://faction-os.gitbook.io/faction-os-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase20-session04-campaign-executable-dispatch/code-review.md).

# Code Review and Repair Report

**Session ID**: `phase20-session04-campaign-executable-dispatch` **Package**: cross-package (`packages/protocol`, `apps/server`, `apps/web`) **Reviewed**: 2026-06-28 **Scope**: All uncommitted changes in the working tree **Result**: RESOLVED

## Review Surface

**Files reviewed** (all uncommitted implementation changes):

* `.spec_system/state.json` - tracked-modified
* `.spec_system/specs/phase20-session04-campaign-executable-dispatch/spec.md` - untracked
* `.spec_system/specs/phase20-session04-campaign-executable-dispatch/tasks.md` - untracked
* `.spec_system/specs/phase20-session04-campaign-executable-dispatch/implementation-notes.md` - untracked
* `apps/server/README_server.md` - tracked-modified
* `apps/server/src/lib/commandCenterValidation.ts` - tracked-modified
* `apps/server/src/managers/planCampaignManager.ts` - tracked-modified
* `apps/server/src/routes/commandCenter.ts` - tracked-modified
* `apps/server/src/server.ts` - tracked-modified
* `apps/server/tests/commandCenterRoutes.test.ts` - tracked-modified
* `apps/server/tests/planCampaignManager.test.ts` - tracked-modified
* `apps/server/tests/planCampaignExecutableDispatch.test.ts` - untracked
* `apps/web/README_web.md` - tracked-modified
* `apps/web/src/components/orchestration/CampaignWorkbench.tsx` - tracked-modified
* `apps/web/src/components/orchestration/CommandCenterPanes.tsx` - tracked-modified
* `apps/web/src/components/orchestration/OrchestrationShell.tsx` - tracked-modified
* `apps/web/src/lib/commandCenterUi.ts` - tracked-modified
* `apps/web/src/lib/orchestrationApi.ts` - tracked-modified
* `apps/web/tests/CommandCenterPanes.test.tsx` - tracked-modified
* `apps/web/tests/OrchestrationPanel.test.tsx` - tracked-modified
* `apps/web/tests/commandCenterUi.test.ts` - tracked-modified
* `apps/web/tests/orchestrationApi.test.ts` - tracked-modified
* `docs/api/README_api.md` - tracked-modified
* `packages/protocol/src/orchestrationCommandCenter.ts` - tracked-modified
* `packages/protocol/src/rest.ts` - tracked-modified
* `packages/protocol/src/taskQueue.ts` - tracked-modified
* `packages/protocol/tests/orchestration.test.ts` - tracked-modified
* `packages/protocol/tests/orchestrationCommandCenter.test.ts` - tracked-modified
* `tests/e2e/orchestration-command-center.e2e.ts` - tracked-modified
* `.spec_system/specs/phase20-session04-campaign-executable-dispatch/code-review.md` - untracked, generated review report

**Inventory commands**: `git status`, `git diff HEAD`, `git diff --cached`, `git ls-files --others --exclude-standard`

## Findings by Severity

### Critical

* None.

### High

* None.

### Medium

* `apps/server/src/managers/planCampaignManager.ts:330` - Retrying or refining a failed/blocked executable campaign task reset the task to `pending` but could keep stale `executionSummary`, `queueId`, and `executionRunId` from the previous unavailable/failed execution. That made a pending or refined task appear to still have current execution evidence. | Fix: added retry/refine execution-state reset helpers, recomputed safe readiness from the private executable payload, cleared stale execution summaries, and compared execution summaries in task change detection. Added regression coverage in `apps/server/tests/planCampaignManager.test.ts:416`. | Status: FIXED

### Low

* None.

## Assumptions and Deliberate Non-Fixes

None.

## Behavior Changes

* Retrying or refining failed/blocked executable campaign tasks now clears stale public execution evidence and returns a fresh executable/planning-only pending state until the task is dispatched again.

## Verification

* Tests: `. "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx vitest run packages/protocol/tests/orchestrationCommandCenter.test.ts packages/protocol/tests/orchestration.test.ts apps/server/tests/planCampaignExecutableDispatch.test.ts apps/server/tests/planCampaignManager.test.ts apps/server/tests/commandCenterRoutes.test.ts apps/web/tests/commandCenterUi.test.ts apps/web/tests/CommandCenterPanes.test.tsx apps/web/tests/orchestrationApi.test.ts apps/web/tests/OrchestrationPanel.test.tsx` - PASS - 9 files, 136 tests
* Tests: `. "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm test` - PASS - 265 files passed, 3022 tests passed, 1 skipped
* Tests: `. "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx playwright test tests/e2e/orchestration-command-center.e2e.ts --project=app-desktop --project=app-mobile` - PASS - 6 tests
* Linter: `. "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm run lint` - PASS - Biome checked 760 files
* Formatter: `. "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm run format:check` - PASS - Biome checked 758 files
* Type checker: `. "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm run typecheck --workspaces --if-present` - PASS - workspace typechecks completed
* Whitespace: `git diff --check` - PASS
* ASCII/LF: changed tracked files plus untracked files scanned for CRLF and non-ASCII - PASS
* Final diff re-read: no remaining issues found in the reviewed changes

## Summary

1. Reviewed 29 implementation/session files across protocol, server, web, docs, e2e, and spec-system state; generated this report as the review artifact.
2. Findings: 0 critical, 0 high, 1 medium, 0 low; the medium stale execution evidence finding was fixed.
3. No deliberate non-fixes or external blockers remain.
4. Verification passed for focused Vitest, full Vitest, Playwright desktop/mobile, formatter, linter, workspace typecheck, whitespace, and ASCII/LF checks.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase20-session04-campaign-executable-dispatch/code-review.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
