## Summary
Third standalone extraction from #655, after #676 and #677 landed. Based
directly on current `main` (`12e2d16`), including #678; no subagent
runtime or production files change.
- Add an optional request-body response selector so concurrent root,
child, and title requests can receive the correct scripted responses
without depending on arrival order.
- Support synchronous handlers and handlers that await a response.
Preserve FIFO behavior when no selector is installed; explicit HTTP
errors still take precedence, and an undefined selection is an
unexpected request rather than a queue fallback.
- Return a fixed generic HTTP 500 on handler failure and keep
diagnostics in server-side logs. Do not write replies to disconnected
clients.
- Generalize function-call SSE replies to named/namespaced tools. The
existing shell helper delegates without changing its payload.
## Standalone coverage
Seven direct tests cover FIFO compatibility, concurrent out-of-order
completion, error/path precedence, unhandled requests,
synchronous/asynchronous failure and recovery, and named/namespaced
function serialization. Snapshots contain stable payloads rather than
changing response IDs.
The original #655 only tested handler failures directly; this extraction
adds coverage for the fixture's useful behavior without needing the
later subagent feature.
## Validation
- `npm ci --ignore-scripts`
- `npm run typecheck`
- Focused mock-server/model-request suite: **10 passed**
- `npm test`: **1,915 passed**, 36 skipped
- `npm run test:integration`: **7 passed**, using the real Codex 0.164.0
app-server and local mock model, including existing shell-tool flows
- `npm run build`
- `git diff --check`
Only test infrastructure is changed. The full live-model E2E suite and
local cross-platform bundling were not run for this test-only
extraction. Existing dependency audit findings are outside this scope.