Skip to content

fix: fail-closed host-memory guard (TODO #13) — the freeze config is now rejected at submission#148

Merged
rctruta merged 2 commits into
mainfrom
fix/host-memory-guard
Jul 6, 2026
Merged

fix: fail-closed host-memory guard (TODO #13) — the freeze config is now rejected at submission#148
rctruta merged 2 commits into
mainfrom
fix/host-memory-guard

Conversation

@rctruta

@rctruta rctruta commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Live incident: an agent-built sort_spill config swept duckdb.memory_limit: [512MB, 16GB] on the 16GB dev machine — DuckDB took what it was granted and froze the host hard. The config was well-designed for the question; the danger was host-relative, and nothing fail-closed existed below it.

Guard at the single validation choke point (_check_memory_limits_fit_host — API submission and executor entry both inherit): any engine memory-limit (matrix lane or engine_params) above 50% of physical RAM is rejected with a message naming the value, host RAM, cap, and the explicit override (meta.allow_high_memory: true). The agent coaching loop turns the 422 into a smaller resubmission automatically.

OS-level enforcement (sandbox/ulimit) remains open in TODO #13 — validation can't stop a workload that grows past its declared limit.

(Note: branch includes files identical to main from the PR #147 restore; net diff is validation.py + tests + TODO.)

  • 6 guard tests incl. the exact freeze config; 62 green across touched suites
  • Pre-push green
  • CI green (no --admin)

rctruta added 2 commits July 6, 2026 09:51
…6GB host (TODO #13)

Observed live: an agent-built sort_spill config swept
duckdb.memory_limit [512MB, 16GB] on the 16GB dev machine. DuckDB takes
the memory it is granted; the 16GB lane froze the host hard. The config
was well-designed for the question — the danger was host-relative, and
nothing fail-closed existed below it (no OS sandbox; harness-tenets gap).

Guard at the single validation choke point (both API submission and
executor entry inherit): any engine memory-limit value — matrix lane
(execution.matrix."<engine>.memory_limit") or static
engine_params.<engine>.memory_limit — above 50% of physical RAM is
rejected at submission, naming the value, host RAM, cap, and the
explicit override (meta.allow_high_memory: true).

The agent coaching loop turns the 422 into a smaller resubmission
automatically — the same mechanism that already handles schema errors.

6 tests including the exact freeze config (16GB lane, 16GB host).
OS-level enforcement (sandbox/ulimit) recorded as still open in TODO #13.
@rctruta rctruta merged commit 3feb4ea into main Jul 6, 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