Architecture: Should generated code auto-merge to develop or create a draf...

Documentation for Sessions

🏗️ Architecture: Should generated code auto-merge to develop or create a draf...

Date: 2026-03-10
Time: 18:57:57 UTC
Session: gspace1-199.5
Agent: backend
Confidence: 94%
Status: ✅ Documented


📋 Decision Context

Question:

Should generated code auto-merge to develop or create a draft MR for user review?

Task: S199: Draft MR creation after generation


🎯 Decision Made

Chosen:

Create draft MR instead of auto-merging. Emit module-gen.mr-created SSE event with MR URL. Fallback to auto-merge if draft MR fails (old GitLab compat).

Options Considered:

  1. Keep auto-merge (fast but risky)
  2. Draft MR with fallback (chosen — review step + backward compat)
  3. Require manual merge only (too much friction for non-developers)

💭 Reasoning

ROOT CAUSE: Auto-merge (S188) pushed generated code directly to develop without review. This is dangerous — LLM-generated code can have subtle bugs that pass auto-correction but break at runtime. A draft MR gives users a review step before merging, aligns with standard Git workflow, and makes the generated code visible in GitLab's UI. The MR URL is emitted via SSE so the chat can display a clickable link. Fallback to auto-merge ensures backward compatibility with older GitLab instances that may not support draft MRs.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation