diff --git a/CODE_BLOCK_FIXES.md b/CODE_BLOCK_FIXES.md
new file mode 100644
index 0000000000..6deba038a4
--- /dev/null
+++ b/CODE_BLOCK_FIXES.md
@@ -0,0 +1,146 @@
+# 🔧 Code Block Width and Height Fixes
+
+## Issues Fixed
+
+### 1. **Code Block Extending Beyond Chat Input**
+**Problem**: The code block in live IDE mode was extending beyond the boundaries of the chat input, causing horizontal overflow.
+
+**Root Cause**:
+- The code container was using `inline-flex` display
+- No width constraints were applied
+- The `SyntaxHighlighter` component was not constrained
+
+**Solution**:
+- Changed outer container from `inline` to `block` display with `w-full`
+- Added `maxWidth: '100%'` and `boxSizing: 'border-box'` to code container
+- Added `overflow-x-auto` for horizontal scrolling when code is too wide
+- Applied same constraints to `SyntaxHighlighter` customStyle
+
+### 2. **Text Hidden Behind Toolbar**
+**Problem**: When typing in code mode, text could be hidden behind the bottom toolbar.
+
+**Root Cause**: The code block wasn't properly influencing the chat input's height calculation, so the container didn't expand enough.
+
+**Solution**:
+- The existing `syncDisplayHeight` function already monitors the display layer
+- By making the code block a proper block-level element with correct sizing, it now properly contributes to the `scrollHeight`
+- The `containerHeight` state is updated based on the actual content height
+- This ensures the parent container allocates enough space
+
+## Changes Made
+
+### RichChatInput.tsx - Code Mode Rendering
+
+```typescript
+return (
+
// Added w-full
+ {/* Text before trigger */}
+ {textBefore && (
+
{textBefore}
+ )}
+
+ {/* Language badge */}
+
+
+ {codeMode.language}
+
+
+ {/* Code content - NOW PROPERLY CONSTRAINED */}
+
+
+ {codeContent || ' '}
+
+
+ {/* Cursor */}
+ {isFocused && (
+
+ )}
+
+
+);
+```
+
+## How It Works Now
+
+1. **Width Constraint**:
+ - The code block is now a block-level element that respects the container width
+ - `w-full` ensures it takes the full width of the parent
+ - `maxWidth: 100%` prevents it from exceeding the container
+ - `boxSizing: border-box` ensures padding is included in width calculations
+
+2. **Horizontal Scrolling**:
+ - When code lines are too long, `overflow-x-auto` adds a horizontal scrollbar
+ - This prevents the code from breaking the layout
+
+3. **Height Calculation**:
+ - The code block now properly contributes to the display layer's `scrollHeight`
+ - `syncDisplayHeight()` detects the increased height
+ - `containerHeight` state is updated
+ - The parent container expands accordingly
+ - This prevents text from being hidden behind the toolbar
+
+## Testing
+
+To verify the fixes:
+
+1. **Width Test**:
+ - Type `#python` in the chat input
+ - Paste or type a very long line of code
+ - ✅ The code should stay within the chat input boundaries
+ - ✅ A horizontal scrollbar should appear if needed
+
+2. **Height Test**:
+ - Type `#python` in the chat input
+ - Type multiple lines of code (10+ lines)
+ - ✅ The chat input should expand to show all lines
+ - ✅ No text should be hidden behind the toolbar
+ - ✅ The container should scroll if it reaches maxHeight
+
+3. **Inline Test**:
+ - Type some text, then `#python`, then code
+ - ✅ Text before the trigger should display normally
+ - ✅ Code block should be properly constrained
+
+## Related Files
+
+- `ui/desktop/src/components/RichChatInput.tsx` - Main implementation
+- `ui/desktop/src/components/ChatInput.tsx` - Parent component that uses RichChatInput
+
+## Commit
+
+```
+commit 83eba3f3a79
+Fix code block width constraints and ensure proper height calculation
+```