Skip to content

Fix srv1_floor_memory_budget: use real runner cgroup cap (8 GiB) instead of whole-run-peak × margin - #5836

Merged
briansrls merged 3 commits into
mainfrom
session/budget-correctness
Jun 26, 2026
Merged

briansrls merged 3 commits into
mainfrom
session/budget-correctness

Conversation

@briansrls

@briansrls briansrls commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • srv1_floor_memory_budget() now returns gunbc_per_runner_memory_cap (the real 8 GiB cgroup cap) directly, replacing within_run_spawn_budget() which computed whole-run-peak × (6/5) ≈ 13.9 GiB — a budget that never matched the actual binding constraint
  • Delete within_run_spawn_budget() and the orphaned margin constants (gunbc_ci_floor_runner_margin_num/den, gunbc_ci_floor_whole_run_peak_rss_bytes) which had no remaining consumer after this change
  • Rename witness_spawn_width_budget_deconflated → witness_spawn_width_budget_is_per_runner_cap to reflect the corrected invariant

Why the old budget was wrong

within_run_spawn_budget() used gunbc_ci_floor_whole_run_peak_rss_bytes() × (6/5) as the budget passed to memory_aware_spawn_width. That whole-run peak (~11.6 GiB) × 1.2 ≈ 13.9 GiB — larger than the actual 8 GiB cgroup cap. The spawn-width formula therefore operated against a phantom budget, making spawn_width = floor(13.9 × 4/5 / per_shard) instead of the correct floor(8 × 4/5 / per_shard).

Consequence named up front

With the corrected budget and the unmodified per_shard value (2.1 GiB from main), spawn_width = floor(8 × 4/5 / 2.1) = 3. The real cgroup footprint per shard (~3.5 GiB including rustc children from emit_host_gate) means width=3 still exceeds 8 GiB — the floor will remain red on OOM until the footprint reductions land (tidy-wren-707 resolve env de-merge + emit-host batch isolation). That red is accepted. This PR only fixes the budget model; the per_shard reground is a separate PR once real footprint drops.

Not in this PR

Test plan

  • .dag compile clean: ci_budget_tree.dag and ci_budget_tree_witness_test.dag compile against unchanged ci_floor_measurement.dag (orphaned symbols remain in measurement.dag until a future cleanup)
  • Witness witness_spawn_width_budget_is_per_runner_cap passes: srv1_floor_memory_budget() == gunbc_per_runner_memory_cap > 0 < srv1_host_ram()
  • within_run_spawn_budget reference removed from all consumers (only consumer was srv1_floor_memory_budget)

🤖 Generated with Claude Code

@gunbai-bot gunbai-bot Bot changed the title De-fork build and compile tool transports to emit-intent-Bash Fix srv1_floor_memory_budget: use real runner cgroup cap (8 GiB) instead of whole-run-peak × margin Jun 26, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review June 26, 2026 16:53
…measurement.dag

gunbc_ci_floor_runner_margin_num/den and gunbc_ci_floor_whole_run_peak_rss_bytes
had no remaining consumers after within_run_spawn_budget() was retired in the
prior commit. Delete them to close the §5 specification-without-execution gap:
the budget_tree.dag prose claimed they were deleted but they were still present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Generated from plans/budget_tree.dag which already noted the deletion.
Addresses reviewer non-blocking note on #5836.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@briansrls
briansrls merged commit f7ccfa8 into main Jun 26, 2026
1 of 2 checks passed
@briansrls
briansrls deleted the session/budget-correctness branch June 26, 2026 17:51
gunbai-bot Bot pushed a commit that referenced this pull request Jun 26, 2026
…nflicts

Conflicts resolved:
- ci_floor_measurement.dag: keep gunbc_ci_host_container_memory_cap_disposition
  data item from this branch (absent on main after #5836)
- plans/budget_tree.dag: use main's more accurate provenance note (explicitly
  names deleted margin constants and gunbc_ci_floor_whole_run_peak_rss_bytes)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gunbai-bot Bot pushed a commit that referenced this pull request Jun 26, 2026
…ck to 2

Mirrors standalone hotfix #5843 — width=3 OOM-kills every run at 8GiB cgroup
cap post-#5836 (per_shard measured 2.0GiB stale vs actual > 2.43GiB).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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