> For the complete documentation index, see [llms.txt](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/sessions/phase40-session04-chat-overrides-and-runtime/tasks.md).

# Task Checklist

**Session ID**: `phase40-session04-chat-overrides-and-runtime` **Total Tasks**: 20 **Estimated Duration**: 3-4 hours **Created**: 2026-07-02

***

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

***

## Setup (3 tasks)

* [x] T001 \[S4004] Verify Session 01-03 handoff artifacts, current worktree status, and focused chat owners (`.spec_system/specs/phase40-session03-shared-redaction-foundation/IMPLEMENTATION_SUMMARY.md`)
* [x] T002 \[S4004] Run focused baseline chat bridge, hook, parser, and Intelligence tests (`bunx vitest run scripts/lib/__tests__/hermes-admin-bridge.test.ts src/hooks/__tests__/use-hermes-admin.test.tsx src/lib/__tests__/hermes-admin-types.test.ts src/lib/__tests__/hermes-intelligence-events.test.ts`)
* [x] T003 \[S4004] Inspect current chat route, hook, parser, and event mapping before edits (`scripts/lib/hermes-admin-bridge.ts`)

***

## Foundation (5 tasks)

* [x] T004 \[S4004] \[P] Extend chat send options with optional model and provider override fields with types matching the declared contract (`src/components/hermes/chat/chat-types.ts`)
* [x] T005 \[S4004] \[P] Extend Hermes chat SSE event types and parser for sanitized `info` diagnostics with exhaustive event handling (`src/lib/hermes-admin-types.ts`)
* [x] T006 \[S4004] \[P] Add client-side chat override validation for model, provider, toolset, yolo, and graph options with schema-validated input and explicit error mapping (`src/hooks/use-hermes-admin.ts`)
* [x] T007 \[S4004] \[P] Update hook fixtures for model/provider serialization, invalid override rejection, and duplicate-trigger prevention while in-flight (`src/hooks/__tests__/use-hermes-admin.test.tsx`)
* [x] T008 \[S4004] Add server-side model and provider validation helpers with bounded allowlist regexes, provider `moa`, and controlled invalid-payload errors (`scripts/lib/hermes-admin-bridge.ts`)

***

## Implementation (7 tasks)

* [x] T009 \[S4004] Add chat override argv construction and wire `handleChatRequest` parsing while preserving toolset, yolo, graph, resume, and prompt ordering with schema-validated input and explicit error mapping (`scripts/lib/hermes-admin-bridge.ts`)
* [x] T010 \[S4004] Set chat spawn environment safeguards for unbuffered output and terminal-safe output while preserving inherited Python env cleanup (`scripts/lib/hermes-admin-bridge.ts`)
* [x] T011 \[S4004] Implement heartbeat comments, pre-output timeout, post-output idle success, and timer cleanup with cleanup on scope exit for all acquired resources (`scripts/lib/hermes-admin-bridge.ts`)
* [x] T012 \[S4004] Preserve browser disconnect child termination and single-finish behavior with cleanup on scope exit for all acquired resources (`scripts/lib/hermes-admin-bridge.ts`)
* [x] T013 \[S4004] Emit sanitized `info` SSE diagnostics from stderr/runtime notices while keeping normal assistant chunks unchanged (`scripts/lib/hermes-admin-bridge.ts`)
* [x] T014 \[S4004] Keep hook chat output accumulation limited to `chunk` events and store `info` diagnostics only in the event stream (`src/hooks/use-hermes-admin.ts`)
* [x] T015 \[S4004] Map `info` events as diagnostic activity without adding them to assistant transcript text (`src/lib/hermes-intelligence-events.ts`)

***

## Testing (5 tasks)

* [x] T016 \[S4004] Add Hermes admin bridge tests for valid ordinary overrides, valid MoA overrides, invalid injection-shaped values, argv ordering, and graph/yolo/toolset compatibility (`scripts/lib/__tests__/hermes-admin-bridge.test.ts`)
* [x] T017 \[S4004] Add Hermes admin bridge tests for pre-output timeout, post-output idle success, heartbeat output, browser disconnect cleanup, timer cleanup, and sanitized `info` events (`scripts/lib/__tests__/hermes-admin-bridge.test.ts`)
* [x] T018 \[S4004] Add parser, hook, and Intelligence tests for `info` events and assistant transcript exclusion (`src/lib/__tests__/hermes-admin-types.test.ts`, `src/hooks/__tests__/use-hermes-admin.test.tsx`, `src/lib/__tests__/hermes-intelligence-events.test.ts`)
* [x] T019 \[S4004] Run the focused Phase 40 chat override suite (`bunx vitest run scripts/lib/__tests__/hermes-admin-bridge.test.ts src/hooks/__tests__/use-hermes-admin.test.tsx src/lib/__tests__/hermes-admin-types.test.ts src/lib/__tests__/hermes-intelligence-events.test.ts`)
* [x] T020 \[S4004] Run script typecheck, app typecheck, and diff whitespace validation (`bun run typecheck:scripts && bun run typecheck && git diff --check`)

***

## 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` (next step in the implement -> creview -> validate sequence)

***

## 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://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/sessions/phase40-session04-chat-overrides-and-runtime/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.
