Skip to content

fix(serve): bound delegated memory metrics before byte conversion - #263

Closed
Afloat16 wants to merge 1 commit into
Edge0-AI:mainfrom
Afloat16:fix/delegate-memory-metrics
Closed

Afloat16 wants to merge 1 commit into
Edge0-AI:mainfrom
Afloat16:fix/delegate-memory-metrics

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

What & why

The delegated /status path multiplies reported GiB/MiB values and casts directly to int64_t. In a reproduction linked to the actual status implementation, a finite 1e100 report produces -9223372036854775808 bytes for RAM and GPU memory. A used-memory value larger than the total also produces negative available/free bytes, with an empty reason.

Check that each scaled value is finite, nonnegative and below the exclusive 2^63 bound before conversion. Validate both total and used values before subtracting them. Invalid measurements become null; unavailable system-memory measurements include a reason. Legitimate zero/fractional reports and the existing subtraction-before-conversion rounding are preserved.

Area

  • Engine, CLI or server (edge0-infer/)

How was it tested?

Base f6bfa5546bcf89919f86946ec669bcc7f4cd526d; Linux, GCC 14.2, CMake 4.4.5, CPU preset.

  • New unit regression fails on the base and passes with the fix. Coverage includes invalid total/used fields, negative and huge finite values, wrong types, used greater than total, zero/fractional sizes, exact 2^63 rejection and the closest representable double below that boundary. A fractional subtraction control preserves the previous byte rounding.
  • A probe using the actual status object files reproduced the negative byte outputs before the fix and null plus the system-memory reason afterward.
  • CPU CLI/registry build and moe_test_strata_registry passed.
  • ctest --preset cpu -L "L0|L1" --output-on-failure -j 4: 97 passed, 3 Vulkan tests skipped, 4 existing failures. The same base failures are moe_test_app_generation (std::tmpfile unavailable here), moe_test_platform_memory (Linux expectation), and extreme-float serialization in moe_test_ordered_json / moe_test_template_tools.
  • The actual delegated serve integration functions proxy, live_progress, check_status_schema, and dialects passed against the built CLI and repository fake engine over loopback HTTP.
  • git diff --check passed. Hardware memory telemetry and GPU/model execution were not tested; this patch validates the values supplied to the status mapper.

Checklist

  • Added malformed-report and valid-boundary regression tests.
  • Ran the affected native and HTTP integration checks.
  • Full L0/L1 is green (four base failures above).

@Afloat16

Copy link
Copy Markdown
Contributor Author

Superseded by #291, the consolidated delegated-serving PR requested in #289. The original change and regression coverage are preserved, and the original commit remains in the consolidated branch's history.

@Afloat16 Afloat16 closed this Nov 17, 2026
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