> 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-session03-queue-git-execution/code-review.md).

# Code Review and Repair Report

**Session ID**: `phase20-session03-queue-git-execution` **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-session03-queue-git-execution/code-review.md` - untracked
* `.spec_system/specs/phase20-session03-queue-git-execution/implementation-notes.md` - untracked
* `.spec_system/specs/phase20-session03-queue-git-execution/spec.md` - untracked
* `.spec_system/specs/phase20-session03-queue-git-execution/tasks.md` - untracked
* `apps/cli/src/lib/orchestrationDiagnostics.js` - tracked-modified
* `apps/cli/tests/orchestrationDiagnostics.test.js` - tracked-modified
* `apps/server/src/lib/orchestrationDiagnostics.ts` - tracked-modified
* `apps/server/src/lib/orchestrationValidation.ts` - tracked-modified
* `apps/server/src/managers/gitWorkbenchManager.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/orchestration.test.ts` - tracked-modified
* `apps/server/tests/orchestrationDiagnostics.test.ts` - tracked-modified
* `apps/server/tests/taskExecutionCoordinator.test.ts` - tracked-modified
* `apps/web/src/components/orchestration/CommandCenterPanes.tsx` - tracked-modified
* `apps/web/src/components/orchestration/FileGitWorkbench.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
* `apps/web/tests/CommandCenterPanes.test.tsx` - tracked-modified
* `apps/web/tests/commandCenterStore.test.ts` - tracked-modified
* `apps/web/tests/orchestrationApi.test.ts` - tracked-modified
* `apps/web/tests/orchestrationUi.test.ts` - tracked-modified
* `docs/api/README_api.md` - 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

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

## Findings by Severity

### Critical

* No findings.

### High

* `apps/server/src/managers/taskExecutionCoordinator.ts:243` - Queue Git dispatch delegated every parsed Git operation to `GitWorkbenchManager`, while `apps/web/src/components/orchestration/FileGitWorkbench.tsx:181` could create queue tasks from commit, stash, revert, and branch-switch drafts. That exceeded this session's status/stage/unstage queue scope and could run broader mutating Git operations through queue dispatch. | Fix: Added a pre-preview unsupported-operation gate that returns `unsupported_family` unavailable without invoking the Git runner, made those unavailable states non-retryable, disabled File/Git queue creation for unsupported operations, and documented the boundary. | Status: FIXED

### Medium

* `packages/protocol/src/taskQueue.ts:487` - The execution summary parser accepted cross-family fields: Git summaries could include `terminalSessionId`, and terminal summaries could include Git-only compact fields. That allowed broad queue payload drift and could make a malformed Git queue row expose a terminal-session link. | Fix: Rejected `terminalSessionId` on Git summaries and rejected Git operation/count/recovery fields on terminal summaries; added protocol regression coverage. | Status: FIXED

### Low

* No findings.

## Assumptions and Deliberate Non-Fixes

* Direct File/Git workbench preview/execute behavior was left unchanged. The reviewed defect was specific to queue dispatch scope; the existing direct workbench remains a separate surface from prior sessions.
* Git push remains accepted as a queue operation that resolves to policy-blocked unavailable, because the session explicitly requires policy-blocked push evidence.

## Behavior Changes

* Queue Git dispatch now executes only status, stage, and unstage. Push still returns policy-blocked unavailable. Commit, stash, revert, and branch-switch queue dispatches now return unavailable without running Git.
* File/Git workbench queue creation is available only for status, stage, unstage, and push drafts.
* Task queue execution summary parsing now enforces terminal/Git field separation.

## Verification

* Tests: `npx vitest run packages/protocol/tests/orchestration.test.ts` - PASS - 15 tests passed.
* Tests: `npx vitest run apps/server/tests/taskExecutionCoordinator.test.ts` - PASS - 10 tests passed.
* Tests: `npx vitest run apps/web/tests/orchestrationUi.test.ts apps/web/tests/CommandCenterPanes.test.tsx` - PASS - 13 tests passed.
* Tests: `npm test` - PASS - 264 test files passed, 1 skipped; 3015 tests passed, 1 skipped.
* Browser: `npx playwright test tests/e2e/orchestration-command-center.e2e.ts --project=app-desktop --project=app-mobile` - PASS - 6 tests passed.
* Formatter: `npm run format` - PASS - Biome formatted 757 files and fixed 2 files.
* Formatter: `npm run format:check` - PASS - 757 files checked.
* Linter: `npm run lint` - PASS - 759 files checked.
* Type checker: `npm run typecheck` - PASS - workspace typecheck passed.
* Whitespace: `git diff --check` - PASS - no output.
* Encoding: changed-file CRLF and non-ASCII scan - PASS - no output.
* Final diff re-read: no remaining issues found.

## Summary

1. Reviewed 34 uncommitted files across protocol, server, web, CLI diagnostics, docs, e2e coverage, and session artifacts.
2. Fixed 1 high-severity queue Git execution scope bug and 1 medium-severity protocol contract validation gap.
3. No deliberately unfixed findings remain; direct Git workbench execution was intentionally left as its existing separate surface.
4. Format, lint, typecheck, full Vitest, focused Playwright, whitespace, and encoding checks passed.


---

# 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-session03-queue-git-execution/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.
