Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: suppress detail during City warm-up, freeze budget streaks in cooldown, disable Auto-controlled panel fields (#2592)

[._.]/ Adam Eivy2521041a2467
diff --git a/client/src/components/city/CityScene.jsx b/client/src/components/city/CityScene.jsx
index 1ff9ef1d1c..bbbf5f61f7 100644
--- a/client/src/components/city/CityScene.jsx
+++ b/client/src/components/city/CityScene.jsx
@@ -98,8 +98,13 @@ export default function CityScene({ apps, agentMap, onBuildingClick, onToggleCam
const renderSettings = useMemo(() => {
if (photoMode || startupSettled) return settings;
+ // During the startup (and post-visibility-resume) warm-up, drop to the cheapest
+ // render path. `effectiveTier: 'low'` also suppresses set dressing + the ray-marched
+ // interior-window shader via cityShowDetail/cityShowInteriorWindows — previously the
+ // clamped particleDensity (0.49) did that implicitly; the explicit tier now owns it.
return {
...settings,
+ effectiveTier: 'low',
reflectionsEnabled: false,
particleDensity: Math.min(settings?.particleDensity ?? 1, STARTUP_PARTICLE_DENSITY),
dpr: [1, 1],
diff --git a/client/src/components/city/CitySettingsPanel.jsx b/client/src/components/city/CitySettingsPanel.jsx
index dc0f7b11db..bd097ae7dd 100644
--- a/client/src/components/city/CitySettingsPanel.jsx
+++ b/client/src/components/city/CitySettingsPanel.jsx
@@ -17,15 +17,16 @@ function HudCorner({ position = 'tl', color = 'cyan' }) {
);
}
-function SettingToggle({ label, value, onChange, description }) {
+function SettingToggle({ label, value, onChange, description, disabled = false }) {
return (
- <div className="flex items-center justify-between py-1.5 group" title={description}>
+ <div className={`flex items-center justify-between py-1.5 group ${disabled ? 'opacity-40' : ''}`} title={description}>
<span className="font-pixel text-[10px] text-gray-400 tracking-wide group-hover:text-gray-300 transition-colors">
{label}
</span>
<button
- onClick={() => onChange(!value)}
- className={`w-9 h-5 rounded-full relative transition-colors ${value ? 'bg-cyan-500/40 border-cyan-500/60' : 'bg-gray-700/40 border-gray-600/40'} border`}
+ onClick={() => !disabled && onChange(!value)}
+ disabled={disabled}
+ className={`w-9 h-5 rounded-full relative transition-colors ${value ? 'bg-cyan-500/40 border-cyan-500/60' : 'bg-gray-700/40 border-gray-600/40'} border ${disabled ? 'cursor-not-allowed' : ''}`}
>
<div
className={`absolute top-0.5 w-3 h-3 rounded-full transition-all ${value ? 'left-[16px] bg-cyan-400 shadow-[0_0_6px_rgba(6,182,212,0.5)]' : 'left-[2px] bg-gray-500'}`}
@@ -35,12 +36,12 @@ function SettingToggle({ label, value, onChange, description }) {
);
}
-function SettingSlider({ label, value, onChange, min = 0, max = 1, step = 0.05, format, description }) {
+function SettingSlider({ label, value, onChange, min = 0, max = 1, step = 0.05, format, description, disabled = false }) {
const displayValue = format
? format(value)
: `${Math.round(value * 100)}%`;
return (
- <div className="py-1.5" title={description}>
+ <div className={`py-1.5 ${disabled ? 'opacity-40' : ''}`} title={description}>
<div className="flex items-center justify-between mb-1">
<span className="font-pixel text-[10px] text-gray-400 tracking-wide">{label}</span>
<span className="font-pixel text-[10px] text-cyan-400/70">{displayValue}</span>
@@ -51,8 +52,9 @@ function SettingSlider({ label, value, onChange, min = 0, max = 1, step = 0.05,
max={max}
step={step}
value={value}
+ disabled={disabled}
onChange={(e) => onChange(parseFloat(e.target.value))}
- className="w-full h-1.5 bg-gray-700 rounded-full appearance-none cursor-pointer accent-cyan-500"
+ className={`w-full h-1.5 bg-gray-700 rounded-full appearance-none accent-cyan-500 ${disabled ? 'cursor-not-allowed' : 'cursor-pointer'}`}
style={{
background: `linear-gradient(to right, #06b6d4 0%, #06b6d4 ${(value - min) / (max - min) * 100}%, #374151 ${(value - min) / (max - min) * 100}%, #374151 100%)`,
}}
@@ -229,12 +231,13 @@ export default function CitySettingsPanel({ qualityMode = 'manual', effectiveTie
{/* Visual Effects */}
<div>
- <SectionHeader title="VISUAL FX" subtitle="Reflections and atmosphere" />
+ <SectionHeader title="VISUAL FX" subtitle={isAuto ? 'Reflections + density controlled by Auto' : 'Reflections and atmosphere'} />
<SettingToggle
label="REFLECTIONS"
value={settings.reflectionsEnabled}
onChange={(v) => updateSetting('reflectionsEnabled', v)}
- description="Wet street reflections and puddles"
+ description={isAuto ? 'Set automatically by Auto quality' : 'Wet street reflections and puddles'}
+ disabled={isAuto}
/>
<SettingToggle
label="SCANLINES"
@@ -249,7 +252,8 @@ export default function CitySettingsPanel({ qualityMode = 'manual', effectiveTie
min={0.25}
max={2}
step={0.25}
- description="Amount of floating particles in the scene"
+ description={isAuto ? 'Set automatically by Auto quality' : 'Amount of floating particles in the scene'}
+ disabled={isAuto}
/>
</div>
diff --git a/client/src/components/city/cityTheme.test.js b/client/src/components/city/cityTheme.test.js
index 06f17a7fd8..9ddf85f8fb 100644
--- a/client/src/components/city/cityTheme.test.js
+++ b/client/src/components/city/cityTheme.test.js
@@ -316,8 +316,9 @@ describe('quality-preset gates', () => {
});
it('detail gates prefer the explicit effectiveTier over particleDensity', () => {
- // effectiveTier is authoritative when present — it ignores particleDensity, so a
- // temporarily-reduced density (startup warm-up) can't flip the detail gates.
+ // effectiveTier is authoritative when present — particleDensity is ignored. The
+ // warm-up path expresses its detail suppression by setting effectiveTier:'low'
+ // (see CityScene.renderSettings), not by clamping particleDensity.
expect(cityShowDetail({ effectiveTier: 'low', particleDensity: 2 })).toBe(false);
expect(cityShowDetail({ effectiveTier: 'medium', particleDensity: 0.1 })).toBe(true);
expect(cityShowInteriorWindows({ effectiveTier: 'medium', particleDensity: 2 })).toBe(false);
diff --git a/client/src/hooks/useCitySettings.js b/client/src/hooks/useCitySettings.js
index 864e3f3346..0b08f12f93 100644
--- a/client/src/hooks/useCitySettings.js
+++ b/client/src/hooks/useCitySettings.js
@@ -42,8 +42,8 @@ const DEFAULT_SETTINGS = {
musicVolume: 0.3,
sfxEnabled: true,
sfxVolume: 0.5,
- // Auto quality (issue #2592): new installs adapt at runtime, beginning at High.
- // `qualityPreset` still names the manual preset AND the Auto starting tier.
+ // Auto quality (issue #2592): new installs adapt at runtime, always beginning at High
+ // (see CyberCity's autoStartTier). `qualityPreset` names the *Manual* preset only.
qualityMode: 'auto', // 'auto' = adaptive render budget; 'manual' = fixed preset
qualityPreset: 'high',
timeOfDay: 'auto', // 'auto' follows the active theme's day/night mode; 'day'/'night' force it
diff --git a/client/src/utils/cityRenderBudget.js b/client/src/utils/cityRenderBudget.js
index 1c28091854..a41c4937e4 100644
--- a/client/src/utils/cityRenderBudget.js
+++ b/client/src/utils/cityRenderBudget.js
@@ -122,25 +122,26 @@ export function recordFrame(state, sample, config = DEFAULT_RENDER_BUDGET_CONFIG
const p75 = percentile(samples, config.percentile);
const fps = 1000 / mean(samples);
- let pressureStreak = state.pressureStreak;
- let headroomStreak = state.headroomStreak;
- if (p75 > config.downshiftFrameMs) {
- pressureStreak += 1;
- headroomStreak = 0;
- } else if (p75 < config.upshiftFrameMs) {
- headroomStreak += 1;
- pressureStreak = 0;
- } else {
- // Dead band — a mixed window breaks both streaks (this is the anti-oscillation gap).
- pressureStreak = 0;
- headroomStreak = 0;
- }
-
let tierIndex = state.tierIndex;
let lastChangeAt = state.lastChangeAt;
const cooledDown = now - state.lastChangeAt >= config.cooldownMs;
+ // Observation freeze during cooldown: windows classified inside the cooldown do NOT
+ // bank a streak. Otherwise a streak accumulated while cooling would fire the instant
+ // the cooldown expires, producing a quality "pop" — and, for a workload that straddles
+ // the two thresholds (comfortable at tier N, over-budget at tier N+1), an endless
+ // downshift↔upshift bounce. Streaks are only counted from windows observed entirely
+ // after the last change, so a change requires fresh, post-cooldown evidence.
+ let pressureStreak = 0;
+ let headroomStreak = 0;
if (cooledDown) {
+ if (p75 > config.downshiftFrameMs) {
+ pressureStreak = state.pressureStreak + 1;
+ } else if (p75 < config.upshiftFrameMs) {
+ headroomStreak = state.headroomStreak + 1;
+ }
+ // else: dead band (18–25ms) — a mixed window breaks both streaks (anti-oscillation gap).
+
if (pressureStreak >= config.downshiftWindows && tierIndex > 0) {
tierIndex -= 1;
lastChangeAt = now;
diff --git a/client/src/utils/cityRenderBudget.test.js b/client/src/utils/cityRenderBudget.test.js
index 0a4778852d..ad65e45273 100644
--- a/client/src/utils/cityRenderBudget.test.js
+++ b/client/src/utils/cityRenderBudget.test.js
@@ -118,12 +118,27 @@ describe('cityRenderBudget — cooldown', () => {
d.window(30); // → downshift to medium, cooldown starts
expect(d.tier).toBe('medium');
d.window(30);
- d.window(30); // two more pressure windows within cooldown → no change
+ d.window(30); // pressure windows within cooldown are frozen, not banked
expect(d.tier).toBe('medium');
+ expect(d.state.pressureStreak).toBe(0); // no banked streak to fire at expiry
d.advance(CFG.cooldownMs); // let the cooldown fully elapse
- d.window(30); // pending pressure now resolves
+ d.window(30); // one fresh post-cooldown window — not enough on its own
+ expect(d.tier).toBe('medium');
+ d.window(30); // second fresh window → downshift
expect(d.tier).toBe('low');
});
+
+ it('does not rebound to the tier it just left after a single quiet window', () => {
+ // Straddling workload: fast enough at the current tier, but the cooldown freeze
+ // means a lone headroom window can't immediately undo a downshift.
+ const d = makeDriver('high');
+ d.window(30);
+ d.window(30); // → medium
+ expect(d.tier).toBe('medium');
+ d.window(10); // headroom window during cooldown → frozen, no upshift
+ expect(d.tier).toBe('medium');
+ expect(d.state.headroomStreak).toBe(0);
+ });
});
describe('cityRenderBudget — visibility transitions', () => {