Skip to content

fix(limits): refuse an automatic PHP memory ceiling at or under the site's own value - #210

Merged
nechodom merged 1 commit into
mainfrom
claude/memory-addition-mechanism-620b12
Oct 5, 2026
Merged

nechodom merged 1 commit into
mainfrom
claude/memory-addition-mechanism-620b12

Conversation

@nechodom

@nechodom nechodom commented Oct 5, 2026

Copy link
Copy Markdown
Owner

What

Follow-up to #208 (automatic PHP memory_limit).

  • Validation — post_set_limits refuses a save with the automation on when the ceiling is <= the site's own PHP memory. Nothing is written (limits, switch, ceiling) on refusal.
  • Warning — the PHP-FPM & DB limits card shows a warning under the ceiling field for a stored bad pair, kept live by a small inline script as memory / ceiling / checkbox change.
  • Pure helpers in hyperion_types::phpmem: floor_after_save, ceiling_leaves_no_room (+ tests, incl. the reported 1024/512 case and a decide() cross-check).

Why

Real config: memory 1024 MB, automation on, default ceiling 512. decide() turns every OOM into Capped — no raise ever, just a daily "still runs out at its ceiling" alert. The card accepted it silently, and the label reads like "add up to 512 MB".

Reviewer notes

  • The floor mirrors set_limits: resubmitting the stored (auto-raised) value keeps the state's base_mb; a newly typed value becomes the floor. So lowering the ceiling under a raised value (which decide() handles by pulling the limit down) is still allowed.
  • Server check reads the stored limits + php.mem_auto_state from the OWNING node (HostingGetLimits, HostingKvList). find_hosting_anywhere moved before the limits dispatch (was after) since the check needs the id.
  • RAM cap (limit × max_children ≤ ¾ RAM) is not validated — the web side doesn't know node RAM.

Testing

  • cargo test -p hyperion-types phpmem (14 pass), cargo test -p hyperion-web (incl. template_lint) green.
  • Devpanel walk: 1024 + 512 → live warning + error toast, nothing saved; 1024 + 1536 → saved, warning gone.

🤖 Generated with Claude Code

…ite's own value

With the automation on, a ceiling <= the operator's own memory_limit (e.g.
1024 MB with the default 512 ceiling) gives it nothing to raise to: every
out-of-memory ends as a daily "stuck at the ceiling" alert and the limit
never moves. The card accepted that pair silently.

- post_set_limits refuses the save before anything is written. The floor is
  decided the way set_limits decides it (floor_after_save): resubmitting the
  stored, auto-raised value keeps the existing base, so lowering the ceiling
  under a raised value still works.
- The limits card shows a warning for a stored bad pair and keeps it live
  while memory, ceiling or the checkbox are edited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nechodom
nechodom merged commit 3694385 into main Oct 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant