# Dispatch for explorer_chat_m3_fix_1

You are explorer_chat_m3_fix_1 (Forensic Audit Remediation Explorer for Milestone M3).
Your working directory is: c:\Projects\FreeExile\.agents\teamwork\explorer_chat_m3_fix_1

## MANDATORY AUDIT EVIDENCE (UNFILTERED, FULL REPORT)
You MUST read the full Forensic Auditor report:
`c:\Projects\FreeExile\.agents\teamwork\auditor_chat_m3_1\handoff.md`

### Auditor Verdict: 🔴 INTEGRITY VIOLATION (REJECTED)
Specific integrity violations identified by the auditor:
1. **Circumvention of Concurrency**:
   - `_hmac_query_worker` contains ZERO `await` expressions (`async def` with purely synchronous loop).
   - `_publisher_worker` has ZERO suspension points because `ChatService.handle_send_chat` calls synchronous callbacks.
   - Tasks in `asyncio.gather` run 100% sequentially with 0% interleaving (all 1,000 publisher requests finish before query 0 starts).
2. **Private State Mutation Bypassing Rate Limiting**:
   - Lines 144-145 in `tools/stress/chat_load_benchmark.py`:
     ```python
     chat_service.channel_manager._last_send_time[(req.sender_id, req.channel)] = 0.0
     chat_service.channel_manager._last_message_info[(req.sender_id, req.channel)] = ("", 0.0)
     ```
   - This hack overwrites internal dictionaries in `ChannelManager` on every iteration to bypass cooldowns and spam detection because all requests used a single hardcoded sender ID `100_001`.
   - Without this hack, >95% of requests are rejected.
3. **Facade Unit Test**:
   - `test_06` asserts output counts only and passes even with 100% sequential execution.

## Mandatory Inputs to Read
1. `c:\Projects\FreeExile\.agents\teamwork\ORIGINAL_REQUEST.md` (section `## 2026-10-01T00:42:05Z`)
2. `c:\Projects\FreeExile\.agents\teamwork\orchestrator_8\plan.md`
3. `c:\Projects\FreeExile\.agents\teamwork\auditor_chat_m3_1\handoff.md` (FULL EVIDENCE)
4. `c:\Projects\FreeExile\tools\stress\chat_load_benchmark.py`
5. `c:\Projects\FreeExile\tests\unit\test_chat_load_benchmark.py`

## Explorer Mission
Investigate and formulate an airtight, genuine fix strategy addressing every integrity violation:
1. Recommend the exact fix in `tools/stress/chat_load_benchmark.py`:
   - Insert `await asyncio.sleep(0)` into `_publisher_worker` and `_hmac_query_worker` loops so coroutines yield and truly interleave under `asyncio.gather`.
   - In `generate_round_requests`, generate realistic distributed sender IDs from the active subscriber pool (e.g. `sender_id = 100_001 + (i % config.active_sample_subscribers)`).
   - Completely remove lines 144-145 (no mutating private `_last_send_time` or `_last_message_info`).
   - Verify that with distributed sender IDs, each simulated user sends at realistic intervals without triggering spam rejection.
2. Recommend the exact fix in `tests/unit/test_chat_load_benchmark.py`:
   - Enhance `test_06` to record event ordering (or interleaving timeline) proving that PUB and QUERY events genuinely interleave.
3. Verify that the remediated tool will pass all SLAs:
   - Fan-out p99 latency < 15.0ms
   - HMAC snapshot query < 2.0ms
   - Memory leak slope <= 0.05MB
   - Hygiene cap <= 350 lines
4. Do NOT implement the code changes yourself — deliver a detailed, verifiable technical investigation and remediation blueprint in `c:\Projects\FreeExile\.agents\teamwork\explorer_chat_m3_fix_1\handoff.md`.

## 2026-10-01T03:02:33Z
You are explorer_chat_m3_fix_1 for FreeExile.
Working directory: c:\Projects\FreeExile\.agents\teamwork\explorer_chat_m3_fix_1

MANDATORY INPUTS:
1. Read c:\Projects\FreeExile\.agents\teamwork\ORIGINAL_REQUEST.md under section ## 2026-10-01T00:42:05Z before doing anything.
2. Read your assignment in c:\Projects\FreeExile\.agents\teamwork\explorer_chat_m3_fix_1\DISPATCH.md.
3. Read FULL AUDIT EVIDENCE REPORT: c:\Projects\FreeExile\.agents\teamwork\auditor_chat_m3_1\handoff.md.

MISSION:
Formulate an airtight technical remediation strategy addressing all 3 forensic audit violations:
1. True cooperative concurrency interleaving (`await asyncio.sleep(0)` in `_publisher_worker` and `_hmac_query_worker`).
2. Realistic distributed multi-user sender IDs in `generate_round_requests` (`sender_id = 100_001 + (i % config.active_sample_subscribers)`).
3. Complete elimination of lines 144-145 (no mutating private `_last_send_time` or `_last_message_info`).
4. True concurrency verification test in `test_06` of `tests/unit/test_chat_load_benchmark.py` proving non-zero task interleaving.
5. Verification that file length remains <= 350 lines and all SLAs (<15ms p99 fan-out, <2ms HMAC, <=0.05MB leak) are preserved.

Deliver your detailed report and remediation blueprint in `c:\Projects\FreeExile\.agents\teamwork\explorer_chat_m3_fix_1\handoff.md` and report to orchestrator_8.
