conductor(plan): Mark context_first_message_fix task complete
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
# Context First Message Fix - Plan
|
||||
|
||||
## Tasks
|
||||
|
||||
- [x] 1. Research: Identify how to detect "first message" vs subsequent messages
|
||||
- [x] 2. Modify `_api_generate` to conditionally send context on first message only
|
||||
- [x] 3. Verify context goes in md_content, not user_message
|
||||
- [x] 4. Test: First message includes context, subsequent messages don't
|
||||
- [x] 5. Commit with details
|
||||
|
||||
## Commit SHA: 0d4fade5
|
||||
|
||||
## Details
|
||||
|
||||
### Task 1: Research - Detect First Message ✅
|
||||
|
||||
**WHERE**: `src/app_controller.py` - `_api_generate` function
|
||||
|
||||
**WHAT**: Find how to determine if this is the first message in a discussion
|
||||
|
||||
**HOW**:
|
||||
- Check if discussion entries have any AI responses already
|
||||
- Look at `disc_entries` or history state to determine context already sent
|
||||
- Used `controller._disc_entries_lock` for thread-safe access
|
||||
|
||||
### Task 2: Modify `_api_generate` ✅
|
||||
|
||||
**WHERE**: `src/app_controller.py:338`
|
||||
|
||||
**WHAT**: Conditionally include `stable_md` (context) only on first message
|
||||
|
||||
**HOW**:
|
||||
- Before calling `ai_client.send()`, check if this is first message
|
||||
- If first message: pass `stable_md` as md_content
|
||||
- If subsequent: pass `""` for md_content to avoid redundant sending
|
||||
|
||||
### Task 3: Verify Context Separation ✅
|
||||
|
||||
**WHAT**: Ensure context is in md_content parameter, not crammed into user_message
|
||||
|
||||
**HOW**: Confirmed in ai_client.send() - md_content goes in `<context>` tag in system instruction
|
||||
|
||||
### Task 4: Test ✅
|
||||
|
||||
**WHAT**: Verified behavior:
|
||||
- First message includes full context (files, screenshots in md_content)
|
||||
- Subsequent messages do NOT include context again
|
||||
- History still works correctly
|
||||
|
||||
**Verification**: `uv run pytest tests/test_api_events.py` passes (4/4)
|
||||
|
||||
### Task 5: Commit ✅
|
||||
|
||||
- Commit SHA: 0d4fade5
|
||||
- Message: `fix(context): Only send context on first message in discussion`
|
||||
- Git note attached with summary
|
||||
Reference in New Issue
Block a user