wip: phase 7 planning paused — ready to execute

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
curo1305
2026-06-03 18:34:49 +02:00
co-authored by Claude Sonnet 4.6
parent 3df62506c9
commit bdd784341f
2 changed files with 103 additions and 42 deletions
@@ -0,0 +1,76 @@
---
context: phase
phase: 07-redo-and-optimize-llm-integration
task: 0
total_tasks: 15
status: planned
last_updated: 2026-06-03T16:33:39Z
---
# BLOCKING CONSTRAINTS — Read Before Anything Else
_No constraints discovered through failure this session — planning only._
<current_state>
Phase 7 planning is 100% complete. All 5 plans created, plan checker passed (4 blockers fixed in 1 revision round). Nothing has been executed yet. Next step is /gsd:execute-phase 7.
</current_state>
<completed_work>
This session (2026-06-03):
- Phase 7 discuss-phase was already complete (07-CONTEXT.md existed)
- Research completed → 07-RESEARCH.md (D-03 and D-07 resolved)
- 07-VALIDATION.md created (13 Wave 0 test stubs mapped)
- 07-PATTERNS.md created (14 files mapped to analogs)
- 5 PLAN.md files created (07-01 through 07-05)
- Plan checker ran — 4 blockers, 3 warnings found
- Revision round fixed all 7 issues
- Plan checker re-run → VERIFICATION PASSED
- STATE.md and ROADMAP.md updated
- All artifacts committed: 3df6250
</completed_work>
<remaining_work>
Execute all 5 plans in order:
- 07-01 (Wave 1): Alembic migration 0005 + SystemSettings ORM + ai_config.py HKDF helpers + 13 xfail stubs
- 07-02 (Wave 2): ProviderConfig + GenericOpenAIProvider + OpenAI singleton + registry + MAX_AI_CHARS removal + anthropic>=0.95.0 pin
- 07-03 (Wave 3): AnthropicProvider output_config + classifier wiring via load_provider_config
- 07-04 (Wave 4): Celery retry 30/90/270s + _ClassificationError + re-classify endpoint
- 07-05 (Wave 5): Admin AI Providers panel + DocumentCard badge + Re-analyze button + human UAT checkpoint (autonomous=false)
</remaining_work>
<decisions_made>
- D-03 (Anthropic structured output): Use output_config.format.type="json_schema" — constrained decoding, no beta headers, SDK >=0.95.0 required
- D-07 (Client lifecycle): Instance-level singleton self._client in __init__ — AsyncOpenAI/AsyncAnthropic manage httpx pools internally; recreating per call destroys pool reuse
- D-14 (extra_hosts): Already done in docker-compose.yml — no changes needed (verified by RESEARCH.md)
- D-02/Gemini: GenericOpenAIProvider has supports_json_mode=False for Gemini preset — falls back to parse_classification()
- Celery retry: _ClassificationError raised from _run(), caught in outer sync extract_and_classify() which calls self.retry() — NOT inside asyncio.run()
- AdminAiConfigTab.vue: ADDITIVE change only — new global System AI Providers section goes ABOVE existing per-user assignment table (Pitfall 6)
- MAX_AI_CHARS: Defined in 3 places (openai_provider.py L5, anthropic_provider.py L5, classifier.py L28) — all 3 removed across Plans 02+03
</decisions_made>
<blockers>
None.
</blockers>
## Required Reading (in order)
1. `.planning/phases/07-redo-and-optimize-llm-integration/07-CONTEXT.md` — locked decisions D-01..D-18
2. `.planning/phases/07-redo-and-optimize-llm-integration/07-RESEARCH.md` — resolved patterns (Anthropic output_config, singleton client, Celery retry, system_settings design)
3. `.planning/phases/07-redo-and-optimize-llm-integration/07-01-PLAN.md` through `07-05-PLAN.md` — execution plans
## Critical Anti-Patterns (do NOT repeat these)
- **Wrong phase number**: User typed `/gsd-plan-phase 3` but meant Phase 7. Phase 3 is complete. Phase 7 is the active phase.
- **Celery retry inside asyncio.run()**: self.retry() must be raised from the OUTER sync task body. Raising it inside asyncio.run(_run()) corrupts async state (RESEARCH Pitfall 3).
- **AdminAiConfigTab.vue overwrite**: Existing per-user assignment table (ADMIN-05) must NOT be removed. New section is additive only (RESEARCH Pitfall 6).
## Infrastructure State
- Docker services: not running (stopped between sessions)
- Last test run: 344 passed / 1 pre-existing failure (test_extract_docx missing module) — from Phase 6.2 execution
- Git: clean working tree, commit 3df6250
<context>
Session was planning-only. No code was written. Phase 7 planning artifacts are complete and committed. The codebase is unchanged from the end of Phase 6.2. Ready to execute.
</context>
<next_action>
/clear, then: /gsd:execute-phase 7
</next_action>