fix: remove cpulimit, use nice only for CPU priority

cpulimit -f interfered with Claude's Ink terminal UI causing duplicate
prompt rendering. Replaced with nice-only approach.

- Remove cpulimit entirely (was causing display issues)
- Rename CpuLimitConfig -> NiceConfig for clean naming
- Simplify wrapWithCpuLimit -> wrapWithNice
- Update UI labels and settings key (cpuLimit -> nice)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-27 11:43:20 +01:00
co-authored by Claude Opus 4.5
parent f92d009034
commit c4e5337480
8 changed files with 90 additions and 236 deletions
+8 -43
View File
@@ -4886,13 +4886,10 @@ class ClaudemanApp {
claudeModeSelect.onchange = () => {
allowedToolsRow.style.display = claudeModeSelect.value === 'allowedTools' ? '' : 'none';
};
// CPU Limiting settings
const cpuLimitSettings = settings.cpuLimit || {};
document.getElementById('appSettingsCpuLimitEnabled').checked = cpuLimitSettings.enabled ?? false;
document.getElementById('appSettingsCpuNiceValue').value = cpuLimitSettings.niceValue ?? 10;
document.getElementById('appSettingsCpuLimitPercent').value = cpuLimitSettings.cpuLimitPercent ?? 80;
// Check cpulimit availability and update status indicator
this.checkCpulimitAvailability();
// CPU Priority settings
const niceSettings = settings.nice || {};
document.getElementById('appSettingsNiceEnabled').checked = niceSettings.enabled ?? false;
document.getElementById('appSettingsNiceValue').value = niceSettings.niceValue ?? 10;
// Notification settings
const notifPrefs = this.notificationManager?.preferences || {};
document.getElementById('appSettingsNotifEnabled').checked = notifPrefs.enabled ?? true;
@@ -4954,12 +4951,10 @@ class ClaudemanApp {
// Claude CLI settings
claudeMode: document.getElementById('appSettingsClaudeMode').value,
allowedTools: document.getElementById('appSettingsAllowedTools').value.trim(),
// CPU Limiting settings
cpuLimit: {
enabled: document.getElementById('appSettingsCpuLimitEnabled').checked,
niceValue: parseInt(document.getElementById('appSettingsCpuNiceValue').value) || 10,
cpuLimitPercent: parseInt(document.getElementById('appSettingsCpuLimitPercent').value) || 80,
useCpulimitIfAvailable: true,
// CPU Priority settings
nice: {
enabled: document.getElementById('appSettingsNiceEnabled').checked,
niceValue: parseInt(document.getElementById('appSettingsNiceValue').value) || 10,
},
};
@@ -5021,36 +5016,6 @@ class ClaudemanApp {
return {};
}
// Check if cpulimit is available and update the UI status indicator
async checkCpulimitAvailability() {
const statusEl = document.getElementById('cpuLimitStatus');
const percentInput = document.getElementById('appSettingsCpuLimitPercent');
if (!statusEl) return;
try {
const res = await fetch('/api/system/cpu-limit-status');
if (res.ok) {
const data = await res.json();
if (data.cpulimitAvailable) {
statusEl.textContent = '\u2713'; // Checkmark
statusEl.title = 'cpulimit is installed';
statusEl.classList.add('available');
statusEl.classList.remove('unavailable');
if (percentInput) percentInput.disabled = false;
} else {
statusEl.textContent = '\u2717'; // X mark
statusEl.title = 'cpulimit not installed (install with: apt install cpulimit)';
statusEl.classList.add('unavailable');
statusEl.classList.remove('available');
// Don't disable input, still allow setting the value for when it gets installed
}
}
} catch (err) {
statusEl.textContent = '?';
statusEl.title = 'Could not check cpulimit availability';
}
}
applyHeaderVisibilitySettings() {
const settings = this.loadAppSettingsFromStorage();
// Default all to true (enabled) if not set
+7 -15
View File
@@ -782,29 +782,21 @@
</label>
<span class="form-hint">Auto-enable for new sessions (otherwise auto-enables on Ralph pattern detection)</span>
</div>
<!-- CPU Limiting Section -->
<div class="form-section-header">CPU Limiting</div>
<!-- Nice Priority Section -->
<div class="form-section-header">Nice Priority</div>
<div class="form-row form-row-switch">
<label>Enable CPU Limiting</label>
<label>Enable Nice Priority Reduction</label>
<label class="switch">
<input type="checkbox" id="appSettingsCpuLimitEnabled">
<input type="checkbox" id="appSettingsNiceEnabled">
<span class="slider"></span>
</label>
<span class="form-hint">Limit CPU usage for Claude sessions (reduces system impact, only affects new sessions)</span>
<span class="form-hint">Lower priority of Claude sessions (reduces system impact, only affects new sessions)</span>
</div>
<div class="form-row" id="cpuLimitNiceRow">
<div class="form-row" id="niceValueRow">
<label>Nice Value</label>
<input type="number" id="appSettingsCpuNiceValue" min="-20" max="19" value="10" style="width: 80px;">
<input type="number" id="appSettingsNiceValue" min="-20" max="19" value="10" style="width: 80px;">
<span class="form-hint">Process priority (-20 to 19, higher = lower priority, default: 10)</span>
</div>
<div class="form-row" id="cpuLimitPercentRow">
<label>CPU Limit %</label>
<div class="settings-item-actions">
<input type="number" id="appSettingsCpuLimitPercent" min="1" max="100" value="80" style="width: 80px;">
<span class="cpu-limit-status" id="cpuLimitStatus" title="cpulimit availability status"></span>
</div>
<span class="form-hint">Hard CPU limit (requires cpulimit installed, default: 80%)</span>
</div>
</div>
<!-- Paths Tab -->
<div class="modal-tab-content hidden" id="settings-paths">