# Project Notes: PROJ-1069 Thread Context E2E Test ## Context This is an E2E verification test for thread-context-protocol wiring. The issue was created from Mattermost thread d8ctggu3jpb4dbgcnefrcs56yh. The Manager (me) should have received a digest of that thread in my task prompt — but I did NOT. ## Key Findings (Discovery) ### What exists: 1. `tools/thread-context.sh` — script that fetches Mattermost thread and creates a digest - Takes thread_id + output_dir as args - Reads bot token from `.env.mattermost` - Calls Mattermost API, resolves user IDs, builds markdown summary - Outputs to `{output_dir}/context/thread.md` 2. `create-implement-issue.sh` — adds `mm_thread: ` to issue body (first line) - This works: issue #2 body starts with `mm_thread: d8ctggu3jpb4dbgcnefrcs56yh` 3. Previous attempt (v13.0 of gitea-transform.js) — was implemented and reverted - Added mmThreadId extraction from issue body - Added passing to queue-daemon.js and spawn-manager.sh - Reverted because gateway caches transforms in memory, so the new code was never loaded ### What's missing (the gap): 1. **gitea-transform.js** — does NOT extract `mm_thread:` from issue body 2. **queue-daemon.js** — does NOT pass `--mm-thread-id` to spawn-manager.sh 3. **spawn-manager.sh** — does NOT support `--mm-thread-id` flag 4. **manager-prompt.md** — has no placeholder for thread digest content ### The full chain that needs wiring: ``` Mattermost thread → create-implement-issue.sh (mm_thread: in body) → gitea-transform.js (extract mm_thread from body) → writeToQueue() (include mmThreadId in queue entry) → queue-daemon.js (read mmThreadId, pass --mm-thread-id to spawn-manager.sh) → spawn-manager.sh (call thread-context.sh, inject digest into manager prompt) → Manager agent (receives thread digest in task prompt) ``` ### Related issue: - sol/gitea-webhooks#59 — "[IMPLEMENT] Thread context wiring" — the proper implementation issue - sol/thread-context-protocol — the protocol repo with README and tools/ ## E2E Test Result **FAIL** — Manager did not receive thread digest. The issue body contains `mm_thread: d8ctggu3jpb4dbgcnefrcs56yh` but the Manager's task prompt has no thread context section. The spawn-manager.sh script was called without `--mm-thread-id`. ## Decisions Made - This is a verification test, not an implementation task - The proper fix belongs in sol/gitea-webhooks#59 - Report findings and close