Troubleshooting Memory Consent Issues¶
Quick solutions fer common problems with memory configuration consent prompts.
Quick Diagnosis¶
Run this diagnostic command:
python3 -c "
from amplihack.launcher.memory_config import get_memory_config
import json
config = get_memory_config()
print(json.dumps(config, indent=2))
"
Expected output:
{
"system_ram_gb": 16,
"recommended_limit_mb": 8192,
"current_limit_mb": 4096,
"node_options": "--max-old-space-size=8192",
"user_consent": true
}
Issue: Prompt Hangs Forever¶
Symptoms¶
- Prompt appears but timeout never triggers
- Process doesn't respond to Ctrl+C
- Terminal hangs indefinitely
Causes¶
- Edge case in input detection
- Platform-specific stdin issue
- Terminal emulator compatibility
Solutions¶
Solution 1: Force Non-Interactive Mode¶
Solution 2: Skip Memory Configuration¶
Solution 3: Check Platform Compatibility¶
# Test stdin detection
import sys
print(f"stdin is TTY: {sys.stdin.isatty()}")
print(f"stdin fileno: {sys.stdin.fileno()}")
# Expected: stdin is TTY: True
If stdin.isatty() returns False in an interactive terminal, yer terminal emulator may have compatibility issues.
Workaround:
Issue: Prompt Never Appears¶
Symptoms¶
- Memory settings applied without askin'
- No prompt displayed
- Settings changed without consent
Causes¶
- Non-interactive environment detected
- Auto-accept flag set
- CI/CD environment variables present
Solutions¶
Solution 1: Verify Environment¶
# Check if running in non-interactive mode
test -t 0 && echo "Interactive" || echo "Non-interactive"
If "Non-interactive", check why:
Solution 2: Check Environment Variables¶
If ye see AMPLIHACK_MEMORY_AUTO_ACCEPT=true, that be why.
To enable prompting:
Solution 3: Force Interactive Mode¶
Issue: Timeout Too Short¶
Symptoms¶
- Prompt disappears before ye can respond
- "No response within 30 seconds" message
- Settings applied without yer input
Causes¶
- Default 30-second timeout too short
- Slow to read/decide
- Distraction during prompt
Solutions¶
Solution 1: Increase Timeout¶
Solution 2: Make Permanent¶
Add to yer shell profile:
# ~/.bashrc or ~/.zshrc
echo 'export AMPLIHACK_MEMORY_PROMPT_TIMEOUT=120' >> ~/.bashrc
source ~/.bashrc
Solution 3: Pre-Configure Choice¶
If ye always want the same answer:
# Always accept
export AMPLIHACK_MEMORY_AUTO_ACCEPT=true
# Or always reject
export AMPLIHACK_MEMORY_AUTO_REJECT=true
Issue: Settings Not Applied¶
Symptoms¶
- Responded "yes" to prompt
- NODE_OPTIONS unchanged
- Memory limit still at old value
Causes¶
- Permissions issue
- Conflicting NODE_OPTIONS
- Environment not propagated
Solutions¶
Solution 1: Check Current NODE_OPTIONS¶
If empty or different from expected:
Solution 2: Verify Memory Config¶
from amplihack.launcher.memory_config import get_memory_config
config = get_memory_config()
print(f"Recommended: {config['recommended_limit_mb']} MB")
print(f"NODE_OPTIONS: {config['node_options']}")
Solution 3: Check for Overrides¶
Remove conflictin' settings.
Issue: Wrong Memory Limit Calculated¶
Symptoms¶
- System has 64 GB RAM but only recommended 8 GB
- Calculation doesn't match formula
- Warning about low RAM on high-RAM system
Causes¶
- RAM detection failure
- Incorrect RAM reporting
- Formula misunderstanding
Solutions¶
Solution 1: Verify RAM Detection¶
from amplihack.launcher.memory_config import detect_system_ram_gb
ram_gb = detect_system_ram_gb()
print(f"Detected RAM: {ram_gb} GB")
If None or wrong value:
# Check system RAM manually
# Linux
free -h
# macOS
sysctl hw.memsize
# Windows
wmic ComputerSystem get TotalPhysicalMemory
Solution 2: Understand the Formula¶
Formula: N = max(8192, total_ram_mb รท 4) capped at 32768 MB
Examples:
| System RAM | Quarter RAM | Max(8192, Quarter) | Final (Capped) |
|---|---|---|---|
| 16 GB | 4096 MB | 8192 MB | 8192 MB |
| 32 GB | 8192 MB | 8192 MB | 8192 MB |
| 64 GB | 16384 MB | 16384 MB | 16384 MB |
| 128 GB | 32768 MB | 32768 MB | 32768 MB |
| 256 GB | 65536 MB | 65536 MB | 32768 MB (capped) |
Solution 3: Manual Override¶
If automatic detection be wrong:
# Set specific memory limit
export NODE_OPTIONS="--max-old-space-size=16384"
export AMPLIHACK_SKIP_MEMORY_CONFIG=true
amplihack
Issue: Prompt Appears in CI/CD¶
Symptoms¶
- CI/CD pipeline hangs waitin' fer input
- Build times out
- Job fails with "no input available"
Causes¶
- Missing auto-accept flag
- Interactive mode forced
- Environment detection failure
Solutions¶
Solution 1: Add Auto-Accept to CI Config¶
GitHub Actions:
GitLab CI:
Jenkins:
Solution 2: Check for Force Interactive¶
If present, remove it.
Solution 3: Verify CI Detection¶
CI environments should be auto-detected. Check fer these variables:
If none present, yer CI environment ain't recognized.
Workaround:
Issue: Different Behavior on Different Platforms¶
Symptoms¶
- Works on macOS but not Linux
- Windows shows different prompts
- Timeout works locally but not in Docker
Causes¶
- Platform-specific implementation differences
- Terminal compatibility issues
- Container stdin handling
Solutions¶
Solution 1: Platform-Specific Configuration¶
Create platform-aware wrapper:
#!/bin/bash
# amplihack-platform-wrapper.sh
case "$(uname -s)" in
Darwin*)
# macOS - use defaults
;;
Linux*)
# Linux - increase timeout
export AMPLIHACK_MEMORY_PROMPT_TIMEOUT=60
;;
CYGWIN*|MINGW*|MSYS*)
# Windows - auto-accept
export AMPLIHACK_MEMORY_AUTO_ACCEPT=true
;;
esac
exec amplihack "$@"
Solution 2: Docker-Specific Setup¶
FROM python:3.11
RUN pip install amplihack
# Non-interactive by default in containers
ENV AMPLIHACK_MEMORY_AUTO_ACCEPT=true
CMD ["amplihack"]
Solution 3: SSH Session Handling¶
When runnin' via SSH:
The -t flag forces pseudo-terminal allocation, ensurin' interactive prompts work.
Issue: Prompt in Background Job¶
Symptoms¶
- Started amplihack in background (
amplihack &) - Process stopped waitin' fer input
- Can't bring to foreground
Causes¶
- Background processes can't read stdin
- Job control suspends on input
Solutions¶
Solution 1: Auto-Accept for Background Jobs¶
Solution 2: Use nohup¶
Ensure auto-accept is set:
Diagnostic Commands¶
Full System Check¶
#!/bin/bash
# amplihack-diag.sh - Full diagnostic check
echo "=== Environment Check ==="
env | grep AMPLIHACK_MEMORY
echo "=== stdin Check ==="
test -t 0 && echo "Interactive" || echo "Non-interactive"
echo "=== RAM Detection ==="
python3 -c "from amplihack.launcher.memory_config import detect_system_ram_gb; print(f'{detect_system_ram_gb()} GB')"
echo "=== Current NODE_OPTIONS ==="
echo "$NODE_OPTIONS"
echo "=== Memory Config Test ==="
python3 -c "
from amplihack.launcher.memory_config import get_memory_config
import json
config = get_memory_config()
print(json.dumps(config, indent=2))
"
Run it:
Getting Help¶
If these solutions don't work:
- Check version:
- Enable debug mode:
- Collect diagnostic info:
- Report issue with:
- Platform (OS and version)
- Terminal emulator
- amplihack version
- Diagnostic output
- Steps to reproduce
See Also¶
- Memory Configuration Consent Feature - Complete feature documentation
- How to Configure Memory Consent - Configuration guide
- Memory Management Overview - System architecture
- Environment Variables - All configuration options
Last Updated: 2026-01-17 Version: 1.0.0 Status: Production