Skip to content

Jeff/fix/mac configurator#1907

Open
jeff-hykin wants to merge 6 commits intodevfrom
jeff/fix/mac_configurator
Open

Jeff/fix/mac configurator#1907
jeff-hykin wants to merge 6 commits intodevfrom
jeff/fix/mac_configurator

Conversation

@jeff-hykin
Copy link
Copy Markdown
Member

Problem

#1789 had an bug for MacOS.

Solution

Main fix is >= instead of > the rest is a test readability/consistency cleanup.

Breaking Changes

None.

How to Test

MacOS only

# Clear saved state to reproduce
echo '{}' > ~/.local/state/dimos/sysctl.json

# reboot
# Run tests (this is where the problem is worst)
bin/pytest-fast

Contributor License Agreement

  • I have read and approved the CLA.

)
from dimos.utils import prompt

# Named constants for test readability (buffer sizes, powers of 2)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment is noise (will delete)

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 23, 2026

Greptile Summary

This PR fixes a macOS-only bug in BufferConfiguratorMacOS.fix() where the bisection loop used target > current instead of target >= current, causing it to exit without writing or saving anything when the halved target equalled the current system value. The additional target > 0 guard prevents writing zero to sysctl when the current value is also zero. The test file is updated to reflect the corrected one-extra-write behavior and uses named binary-mebibyte constants for readability.

Confidence Score: 5/5

Safe to merge — targeted one-line logic fix with a correctly updated test suite and no breaking changes.

The bug is well-understood (bisection loop silently skipping the save when target halves to equal current), the fix is minimal and provably correct, the target > 0 guard closes the zero-write edge case, and the renamed test now asserts the right call count. No regressions in adjacent paths; all remaining notes are P2 style.

No files require special attention.

Important Files Changed

Filename Overview
dimos/protocol/service/system_configurator/lcm.py Single-line logic fix: while target >= current and target > 0 replaces while target > current, correctly including a write attempt at the current value before stopping, and guards against writing zero when current is 0.
dimos/protocol/service/test_system_configurator.py Test updated: test_fix_stops_at_current_value replaced by test_fix_tries_current_value_then_stops which now expects 2 writes (target then current) instead of 1, matching the fixed behavior. Named MiB/FD constants improve readability throughout.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["fix() called\nfor each (key, target, current) in needs"] --> B{"target >= current\nAND target > 0?"}
    B -- No --> G["_save_sysctl_conf(saved)"]
    B -- Yes --> C["_write_sysctl_int(key, target)"]
    C -- success --> D["saved[key] = target\nbreak"]
    C -- CalledProcessError --> E["target //= 2"]
    E --> B
    D --> G

    style E fill:#f9a,stroke:#c00
    style D fill:#afa,stroke:#060
    style B fill:#aef,stroke:#06a
Loading

Reviews (1): Last reviewed commit: "-" | Re-trigger Greptile

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