> 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-session02-queue-terminal-execution/tasks.md).

# Task Checklist

**Session ID**: `phase20-session02-queue-terminal-execution` **Total Tasks**: 18 **Estimated Duration**: 3-4 hours **Created**: 2026-06-28

***

Legend: `[x]` completed; `[ ]` pending; `[P]` parallelizable; `[SNNMM]` session ref; `TNNN` task ID.

***

## Setup (2 tasks)

* [x] T001 \[S2002] Define the terminal execution acceptance fixture and fake PTY behavior for success, unavailable, timeout, kill, and duplicate dispatch (`apps/server/tests/taskExecutionCoordinator.test.ts`)
* [x] T002 \[S2002] Verify Phase 20 Session 01 completion evidence and current terminal route behavior before implementing queue dispatch (`.spec_system/specs/phase20-session01-truthful-capability-baseline/validation.md`)

***

## Foundation (5 tasks)

* [x] T003 \[S2002] \[P] Add terminal executable queue request, safe execution summary, and mutation response types in protocol with blocked raw-field handling (`packages/protocol/src/taskQueue.ts`)
* [x] T004 \[S2002] \[P] Extend protocol tests for executable queue payloads, safe event entries, queue-targeted execution runs, and raw command/output exclusion (`packages/protocol/tests/orchestration.test.ts`)
* [x] T005 \[S2002] Add terminal executable create, update, preview, and dispatch validators with schema-validated input and explicit error mapping (`apps/server/src/lib/orchestrationValidation.ts`)
* [x] T006 \[S2002] Add safe execution summary storage plus private executable payload accessors to the queue manager with idempotency protection and deterministic ordering (`apps/server/src/managers/taskQueue.ts`)
* [x] T007 \[S2002] Create `TaskExecutionCoordinator` for terminal queue dispatch, PTY probing, command-center execution runs, terminal attachments, queue state updates, and duplicate-trigger prevention (`apps/server/src/managers/taskExecutionCoordinator.ts`)

***

## Implementation (7 tasks)

* [x] T008 \[S2002] Wire orchestration routes so terminal dispatch uses the coordinator, metadata-only tracking moves to truthful start-tracking behavior, and queue plus execution events emit together (`apps/server/src/routes/orchestration.ts`)
* [x] T009 \[S2002] Inject the task execution coordinator from the server runtime using the existing task queue, command-center, terminal session, and broadcaster instances (`apps/server/src/server.ts`)
* [x] T010 \[S2002] Update server route and diagnostics tests for dispatch success, `pty_unavailable`, timeout/failure, kill result propagation, stale revision, duplicate dispatch, start-tracking compatibility, and compact diagnostics (`apps/server/tests/orchestration.test.ts`)
* [x] T011 \[S2002] Add terminal executable queue API helpers and response parsers with refresh behavior and broad-response privacy checks (`apps/web/src/lib/orchestrationApi.ts`)
* [x] T012 \[S2002] Add safe queue terminal view models and action labels for execution, retry, unavailable, result summary, and terminal session links (`apps/web/src/lib/orchestrationUi.ts`)
* [x] T013 \[S2002] Update queue UI and pane wiring for terminal task creation, dispatch, retry, terminal drawer links, accessibility labels, focus support, and duplicate-trigger disabled states (`apps/web/src/components/orchestration/QueueWorkbench.tsx`)
* [x] T014 \[S2002] Update store reconciliation for queue and execution WebSocket events so linked runs and terminal sessions clear in-flight state and revalidate stale selections (`apps/web/src/store/useGameStore.ts`)

***

## Testing (4 tasks)

* [x] T015 \[S2002] \[P] Add web tests for API parsing, safe view models, integrated queue terminal controls, terminal drawer output scoping, and event reconciliation (`apps/web/tests/CommandCenterPanes.test.tsx`)
* [x] T016 \[S2002] \[P] Add compact CLI diagnostics behavior and tests for terminal queue readiness/results without raw command text or terminal output (`apps/cli/src/lib/orchestrationDiagnostics.js`)
* [x] T017 \[S2002] Add browser e2e coverage for visible queue-to-terminal dispatch and terminal drawer flow with product-surface privacy checks (`tests/e2e/orchestration-command-center.e2e.ts`)
* [x] T018 \[S2002] Update API, event-contract, web, and CLI docs, then run focused protocol/server/web/CLI/e2e checks plus `git diff --check` and ASCII/LF validation (`docs/api/README_api.md`)

***

## Completion Checklist

* [x] All tasks marked `[x]`
* [x] All tests and checks passing
* [x] All files ASCII-encoded with LF line endings
* [x] implementation-notes.md updated
* [x] Ready for `creview` to review and repair uncommitted implementation changes

***

## Next Steps

Run the `creview` workflow step.


---

# 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-session02-queue-terminal-execution/tasks.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.
