> 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/phase19-session06-executor-registry/code-review.md).

# Code Review and Repair Report

**Session ID**: `phase19-session06-executor-registry` **Package**: cross-cutting (`apps/server`, `apps/web`) **Reviewed**: 2026-06-26 **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/phase19-session06-executor-registry/spec.md` - untracked
* `.spec_system/specs/phase19-session06-executor-registry/tasks.md` - untracked
* `.spec_system/specs/phase19-session06-executor-registry/implementation-notes.md` - untracked
* `.spec_system/specs/phase19-session06-executor-registry/code-review.md` - untracked review artifact
* `apps/server/README_server.md` - tracked-modified
* `apps/server/src/lib/commandCenterValidation.ts` - tracked-modified
* `apps/server/src/lib/orchestrationDiagnostics.ts` - tracked-modified
* `apps/server/src/managers/executorRegistry.ts` - untracked
* `apps/server/src/managers/guardedActions.ts` - tracked-modified
* `apps/server/src/managers/orchestrationCommandCenter.ts` - tracked-modified
* `apps/server/src/routes/commandCenter.ts` - tracked-modified
* `apps/server/src/routes/guardedActions.ts` - tracked-modified
* `apps/server/src/server.ts` - tracked-modified
* `apps/server/src/ws/handlers.ts` - tracked-modified
* `apps/server/tests/commandCenterManager.test.ts` - tracked-modified
* `apps/server/tests/commandCenterRoutes.test.ts` - tracked-modified
* `apps/server/tests/executorRegistry.test.ts` - untracked
* `apps/server/tests/guardedActions.test.ts` - tracked-modified
* `apps/server/tests/orchestrationDiagnostics.test.ts` - tracked-modified
* `apps/server/tests/websocket.test.ts` - tracked-modified
* `apps/web/README_web.md` - tracked-modified
* `apps/web/src/components/orchestration/CommandCenterPanes.tsx` - tracked-modified
* `apps/web/src/components/orchestration/ExecutorFamiliesPanel.tsx` - untracked
* `apps/web/src/components/orchestration/ExecutorRunHistoryDrawer.tsx` - untracked
* `apps/web/src/components/orchestration/OrchestrationDrawer.tsx` - tracked-modified
* `apps/web/src/components/orchestration/OrchestrationShell.tsx` - tracked-modified
* `apps/web/src/components/orchestration/OrchestrationTabs.tsx` - tracked-modified
* `apps/web/src/components/orchestration/index.ts` - tracked-modified
* `apps/web/src/lib/commandCenterUi.ts` - tracked-modified
* `apps/web/src/lib/orchestrationApi.ts` - tracked-modified
* `apps/web/tests/ExecutorFamiliesPanel.test.tsx` - untracked
* `apps/web/tests/OrchestrationPanel.test.tsx` - tracked-modified
* `apps/web/tests/commandCenterStore.test.ts` - 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
* `docs/api/event-api-hook-contracts.md` - tracked-modified

**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/executorRegistry.ts:272` - A registry probe hook that threw would reject `probe`, `probeAll`, or approval evaluation instead of returning compact failed capability posture. This could leave REST or WebSocket approval/probe callers without the controlled failure state required by the session. | Fix: wrapped probe execution, converted failures to a bounded `failed` capability and failed guarded-action/execution result mapping, and added focused registry coverage. | Status: FIXED
* `apps/server/src/managers/executorRegistry.ts:240` - A cleanup hook that threw after a ready adapter returned could reject the approval path after execution had already completed, bypassing command-center completion and compact guarded-action failure reporting. | Fix: contained cleanup exceptions and converted a successful adapter result into a compact failed cleanup result when cleanup fails; added focused registry coverage. | Status: FIXED
* `apps/server/src/routes/guardedActions.ts:150` and `apps/server/src/ws/handlers.ts:357` - Non-ready approval paths ignored `createGuardedExecutionRun` failures. At execution-history capacity, a guarded action could complete as unavailable while no command-center run history existed. | Fix: REST and WebSocket approval completion now fail the guarded action with `capacity_exceeded` when execution-run storage rejects the run; added a route-level capacity test. | Status: FIXED

### Low

* `.spec_system/specs/phase19-session06-executor-registry/implementation-notes.md:14` and `.spec_system/specs/phase19-session06-executor-registry/tasks.md:67` - Session metadata still reported `20 / 22` tasks and handed off to `implement` after all tasks were marked complete. | Fix: updated implementation progress to `22 / 22`, zero remaining hours, and task handoff to `validate` after code review. | Status: FIXED

## Assumptions and Deliberate Non-Fixes

* The default production registry remains fail-closed by design. File, git, terminal, container, remote, Worker, hosted, channel, mission, handoff, and subagent families are not treated as real executors unless an explicit entry reports `executor_ready`.
* The command-center execution collection remains in-memory and bounded by existing manager limits. Disk-backed run persistence is out of scope for this session per `spec.md`.
* WebSocket event frames intentionally stay compact and omit result summaries in broad hydration/update frames; REST detail routes and web helper normalization own bounded result detail display.

## Behavior Changes

* Registry probe exceptions now surface as failed capability posture and failed guarded-action/execution results instead of escaping the route or socket path.
* Cleanup exceptions after an otherwise successful ready adapter now produce a compact failed execution result.
* Guarded-action approvals now fail with `capacity_exceeded` when command-center execution history cannot be created, instead of completing without a corresponding run record.
* Session task metadata now points forward to `validate`.

## Verification

* Tests: `npm test -- apps/server/tests/executorRegistry.test.ts apps/server/tests/guardedActions.test.ts` - PASS - 2 files, 11 tests passed.
* Tests: `npm test -- apps/server/tests/commandCenterManager.test.ts apps/server/tests/commandCenterRoutes.test.ts apps/server/tests/websocket.test.ts apps/server/tests/orchestrationDiagnostics.test.ts` - PASS - 4 files, 29 tests passed.
* Tests: `npm test -- apps/web/tests/ExecutorFamiliesPanel.test.tsx apps/web/tests/orchestrationApi.test.ts apps/web/tests/commandCenterUi.test.ts apps/web/tests/commandCenterStore.test.ts apps/web/tests/OrchestrationPanel.test.tsx` - PASS - 5 files, 43 tests passed.
* Tests: `npm test` - PASS - 224 files passed, 1 skipped; 2750 tests passed, 1 skipped.
* Type checker: `npm --workspace apps/server run typecheck` - PASS.
* Type checker: `npm --workspace apps/web run typecheck` - PASS.
* Type checker: `npm run typecheck --workspaces --if-present` - PASS across adapters, server, warroom, web, protocol, and public-website.
* Linter: `npm run lint` - PASS - Biome checked 675 files with no fixes applied.
* Formatter: `npm run format:check` - PASS - Biome checked 673 files with no fixes applied.
* Whitespace: `git diff --check` - PASS.
* ASCII/LF: tracked and untracked review-scope file check - PASS.
* Final diff re-read: no remaining issues found in the repaired hunks, web executor UI helpers, docs, or spec metadata.

## Summary

1. Reviewed 38 uncommitted files across spec artifacts, server registry/routes/managers/WebSocket handlers, web API/UI/store helpers, tests, and docs.
2. Findings: 0 critical, 0 high, 3 medium, 1 low; all resolved.
3. No repo-fixable findings were deliberately left unfixed.
4. Focused and full test/type/lint/format/whitespace/encoding gates 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/phase19-session06-executor-registry/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.
