> 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/phase10-session03-server-ingest-codex-lifecycle/tasks.md).

# Task Checklist

**Session ID**: `phase10-session03-server-ingest-codex-lifecycle` **Total Tasks**: 22 **Estimated Duration**: 3-4 hours **Created**: 2026-05-31

***

## Legend

* `[x]` = Completed
* `[ ]` = Pending
* `[P]` = Parallelizable (can run with other \[P] tasks)
* `[S1003]` = Session reference (10=phase number, 03=session number)
* `TNNN` = Task ID

***

## Progress Summary

| Category       | Total  | Done   | Remaining |
| -------------- | ------ | ------ | --------- |
| Setup          | 3      | 3      | 0         |
| Foundation     | 5      | 5      | 0         |
| Implementation | 10     | 10     | 0         |
| Testing        | 4      | 4      | 0         |
| **Total**      | **22** | **22** | **0**     |

***

## Setup (3 tasks)

Initial state confirmation and source review.

### Cross-package

* [x] T001 \[S1003] Verify Phase 10 Session 03 prerequisites, completed-session state, and package scope (`.spec_system/PRD/phase_10/session_03_server_ingest_codex_lifecycle.md`)
* [x] T002 \[S1003] Review current server ingest normalization, event routing, and Codex hook payload shapes (`apps/server/src/lib/eventIngest.ts`)
* [x] T003 \[S1003] \[P] Review protocol ingest and hero CLI contracts for Codex-safe fields (`packages/protocol/src/ingest.ts`)

***

## Foundation (5 tasks)

Protocol contracts, fixtures, and normalization primitives.

### packages/protocol

* [x] T004 \[S1003] Extend protocol ingest payload contract for bounded Codex snake\_case aliases and first-class `codex-cli` lifecycle fields (`packages/protocol/src/ingest.ts`)
* [x] T005 \[S1003] Add protocol ingest tests for Codex aliases, hook event names, tool names, turn ids, and `codex-cli` payload typing (`packages/protocol/tests/ingest.test.ts`)

### apps/server

* [x] T006 \[S1003] \[P] Add sanitized Codex lifecycle fixture with SessionStart, UserPromptSubmit, Bash, apply\_patch, PermissionRequest, SubagentStart, SubagentStop, and Stop payloads (`apps/server/tests/fixtures/event-ingest/codexLifecycle.ts`)
* [x] T007 \[S1003] Extend server normalization helpers for Codex `tool_name`, `turn_id`, `hook_event_name`, `agent_id`, and `agent_type` with schema-validated input and explicit error mapping (`apps/server/src/lib/eventIngest.ts`)
* [x] T008 \[S1003] Add bounded Codex metadata allowlist coverage for opaque mission\_event frames without raw prompt, patch, transcript, MCP argument, or command bodies (`apps/server/src/lib/eventIngest.ts`)

***

## Implementation (10 tasks)

Server routing, lifecycle persistence, bounded fallback, and docs.

### apps/server

* [x] T009 \[S1003] Update CLI normalization to accept `codex-cli` as a first-class `HeroCli` value with explicit fallback for unknown values (`apps/server/src/routes/event.ts`)
* [x] T010 \[S1003] Route Codex `SubagentStart` plus `type: "subagent_spawn"` into typed lineage spawn handling with duplicate child-mission protection (`apps/server/src/lib/eventIngest.ts`)
* [x] T011 \[S1003] Normalize `toolName` and `tool_name` for generic tool use, permission request, post-tool results, apply\_patch, Bash, and MCP events with exhaustive fallback handling (`apps/server/src/routes/event.ts`)
* [x] T012 \[S1003] Normalize `turnId` and `turn_id` only as bounded metadata for opaque and diagnostic mission events without promoting raw transcripts or payload bodies (`apps/server/src/lib/eventIngest.ts`)
* [x] T013 \[S1003] Preserve `eventName ?? hook` dispatch while adding Codex alias coverage and unknown named event fallback with bounded payload data and deterministic mission id selection (`apps/server/src/lib/eventIngest.ts`)
* [x] T014 \[S1003] Materialize full Codex lifecycle as `codex-cli` hero and active/completed mission through existing roster and mission managers with duplicate-trigger prevention while in-flight (`apps/server/src/routes/event.ts`)
* [x] T015 \[S1003] Ensure Codex permission requests emit first-class permission\_request frames using normalized tool names, bounded request ids, detail fallback, and no raw arguments (`apps/server/src/routes/event.ts`)
* [x] T016 \[S1003] Ensure apply\_patch and MCP tool events create bounded mission tool uses without raw patch bodies or MCP argument payloads (`apps/server/src/routes/event.ts`)
* [x] T017 \[S1003] \[P] Update server ingest fixture README for Codex lifecycle support, fixture sanitization, and local-only privacy boundaries (`apps/server/tests/fixtures/event-ingest/README.md`)

### Documentation

* [x] T018 \[S1003] \[P] Update API contract docs for Codex lifecycle ingest support, unknown-event fallback, and no hosted telemetry claims (`docs/api/event-api-hook-contracts.md`)

***

## Testing (4 tasks)

Verification and quality assurance.

### Cross-package

* [x] T019 \[S1003] Add server lifecycle tests for Codex hero/mission materialization, Bash/apply\_patch tool uses, permission request, subagent lineage, and Stop completion (`apps/server/tests/eventIngest.test.ts`)
* [x] T020 \[S1003] Add server tests for unknown Codex named events, bounded opaque metadata, snake\_case aliasing, and Claude lifecycle regression stability (`apps/server/tests/eventIngest.test.ts`)
* [x] T021 \[S1003] Run focused protocol and server ingest tests (`vitest.config.ts`)
* [x] T022 \[S1003] Run focused typecheck, Biome, diff check, and ASCII/LF validation for planned files (`biome.jsonc`)

***

## Completion Checklist

Before marking session complete:

* [x] All tasks marked `[x]`
* [x] All tests passing
* [x] All files ASCII-encoded
* [x] implementation-notes.md updated
* [x] Ready for the validate workflow step

***

## Next Steps

Run the implement workflow step to begin AI-led implementation.


---

# 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/phase10-session03-server-ingest-codex-lifecycle/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.
