> 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-session09-container-dispatch-decision/code-review.md).

# Code Review and Repair Report

**Session ID**: `phase20-session09-container-dispatch-decision` **Package**: null **Reviewed**: 2026-06-28 **Scope**: All uncommitted changes in the working tree **Result**: RESOLVED

## Review Surface

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

* `.spec_system/state.json` - tracked-modified
* `.spec_system/specs/phase20-session09-container-dispatch-decision/spec.md` - untracked
* `.spec_system/specs/phase20-session09-container-dispatch-decision/tasks.md` - untracked
* `.spec_system/specs/phase20-session09-container-dispatch-decision/implementation-notes.md` - untracked
* `.spec_system/specs/phase20-session09-container-dispatch-decision/code-review.md` - untracked, generated by creview
* `apps/server/README_server.md` - tracked-modified
* `apps/server/src/managers/containerRuntimeManager.ts` - tracked-modified
* `apps/server/src/managers/planCampaignManager.ts` - tracked-modified
* `apps/server/src/managers/taskExecutionCoordinator.ts` - tracked-modified
* `apps/server/src/managers/taskQueue.ts` - tracked-modified
* `apps/server/src/routes/orchestration.ts` - tracked-modified
* `apps/server/src/server.ts` - tracked-modified
* `apps/server/tests/containerRuntimeManager.test.ts` - tracked-modified
* `apps/server/tests/orchestration.test.ts` - tracked-modified
* `apps/server/tests/taskExecutionCoordinator.container.test.ts` - untracked
* `apps/web/README_web.md` - tracked-modified
* `apps/web/src/components/orchestration/CampaignWorkbench.tsx` - tracked-modified
* `apps/web/src/components/orchestration/OrchestrationShell.tsx` - tracked-modified
* `apps/web/src/components/orchestration/QueueWorkbench.tsx` - tracked-modified
* `apps/web/src/lib/commandCenterUi.ts` - tracked-modified
* `apps/web/src/lib/orchestrationApi.ts` - tracked-modified
* `apps/web/src/lib/orchestrationUi.ts` - tracked-modified
* `apps/web/src/store/useGameStore.ts` - tracked-modified during creview repair
* `apps/web/src/store/useWsClient.ts` - tracked-modified during creview repair
* `apps/web/tests/OrchestrationPanel.test.tsx` - tracked-modified
* `apps/web/tests/CampaignWorkbench.test.tsx` - untracked
* `apps/web/tests/QueueWorkbench.test.tsx` - untracked
* `apps/web/tests/commandCenterStore.test.ts` - tracked-modified during creview repair
* `apps/web/tests/commandCenterUi.test.ts` - tracked-modified
* `apps/web/tests/orchestrationApi.test.ts` - tracked-modified
* `apps/web/tests/orchestrationUi.test.ts` - tracked-modified
* `docs/ARCHITECTURE.md` - tracked-modified
* `docs/api/README_api.md` - tracked-modified
* `docs/isolation-and-sandbox.md` - tracked-modified
* `packages/protocol/src/orchestrationCommandCenter.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
* `packages/protocol/tests/taskQueue.test.ts` - tracked-modified
* `tests/e2e/orchestration-command-center.e2e.ts` - tracked-modified

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

## Findings by Severity

### Critical

* No findings.

### High

* No findings.

### Medium

* `apps/web/src/store/useWsClient.ts:253` - `task_queue_update` WebSocket sanitization dropped the allowed `execution` summary from queue event entries. For the new container dispatch path, that could replace a populated queue row with an event row that no longer exposed `container_run` state, runtime, cleanup posture, unavailable reason, or retry metadata. Fix: preserved only protocol-validated `TaskQueueExecutionSummary` values in the sanitizer, added container queue execution reconciliation in `apps/web/src/store/useGameStore.ts`, and added a regression test in `apps/web/tests/commandCenterStore.test.ts`. Status: FIXED.

### Low

* No findings.

## Assumptions and Deliberate Non-Fixes

* The review surface is cross-package because the active session has `Package: null` and touches protocol, server, web, docs, and e2e files.
* Live Docker availability is not required for correctness. The session spec accepts truthful unavailable states, and all container execution verification uses fake runtime runners or browser fixtures.
* Existing queue event entries intentionally omit full title and summary fields. I did not broaden those event rows; the repair only preserves the already allowed, parser-validated `execution` summary needed by the new container dispatch surface.

## Behavior Changes

* WebSocket task queue updates now retain safe execution summaries instead of dropping them.
* Queue-targeted container execution updates can reconcile web queue rows while preserving compact container metadata.

## Verification

* Tests: `. "$HOME/.nvm/nvm.sh" && nvm use >/dev/null && npx vitest run packages/protocol/tests/orchestrationCommandCenter.test.ts packages/protocol/tests/taskQueue.test.ts packages/protocol/tests/orchestration.test.ts apps/server/tests/taskExecutionCoordinator.container.test.ts apps/server/tests/orchestration.test.ts apps/server/tests/containerRuntimeManager.test.ts apps/web/tests/orchestrationApi.test.ts apps/web/tests/commandCenterUi.test.ts apps/web/tests/orchestrationUi.test.ts apps/web/tests/QueueWorkbench.test.tsx apps/web/tests/CampaignWorkbench.test.tsx apps/web/tests/OrchestrationPanel.test.tsx apps/web/tests/commandCenterStore.test.ts` - PASS - 13 files, 171 tests passed.
* Tests: `. "$HOME/.nvm/nvm.sh" && nvm use >/dev/null && npm test` - PASS - 273 files passed, 1 skipped; 3096 tests passed, 1 skipped.
* Browser e2e: `. "$HOME/.nvm/nvm.sh" && nvm use >/dev/null && npm run test:e2e -- --project=app-desktop tests/e2e/orchestration-command-center.e2e.ts` - PASS - 7 app-desktop tests passed.
* Formatter: `. "$HOME/.nvm/nvm.sh" && nvm use >/dev/null && npm run format:check` - PASS - 768 files checked.
* Linter: `. "$HOME/.nvm/nvm.sh" && nvm use >/dev/null && npm run lint` - PASS - 770 files checked.
* Type checker: `. "$HOME/.nvm/nvm.sh" && nvm use >/dev/null && npm --workspace packages/protocol run typecheck` - PASS.
* Type checker: `. "$HOME/.nvm/nvm.sh" && nvm use >/dev/null && npm --workspace apps/server run typecheck` - PASS.
* Type checker: `. "$HOME/.nvm/nvm.sh" && nvm use >/dev/null && npm --workspace apps/web run typecheck` - PASS.
* Type checker: `. "$HOME/.nvm/nvm.sh" && nvm use >/dev/null && npm run typecheck --workspaces --if-present` - PASS - adapters, server, warroom, web, protocol, and public-website completed.
* Whitespace: `git diff --check` - PASS.
* Encoding: `rg -n "[^\x00-\x7F]" <all touched files>` - PASS - no matches.
* Line endings: `rg -n $'\r' <all touched files>` - PASS - no matches.
* Final diff re-read: no remaining issues.

## Summary

1. Reviewed 40 files: 33 tracked modified files, 6 untracked implementation/test/spec files, plus this generated review report.
2. Findings: 0 critical, 0 high, 1 medium, 0 low; the medium finding was fixed.
3. No unresolved findings or external blockers remain.
4. Verification passed across focused tests, full Vitest, focused Playwright e2e, formatter, linter, workspace typechecks, whitespace, ASCII, and CRLF 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-session09-container-dispatch-decision/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.
