Skip to content

🤖 fix: align composer pickers and size local workers by memory - #3760

Merged
ibetitsmike merged 7 commits into
mainfrom
mike/picker-alignment-worker-budget
Jul 29, 2026
Merged

🤖 fix: align composer pickers and size local workers by memory#3760
ibetitsmike merged 7 commits into
mainfrom
mike/picker-alignment-worker-budget

Conversation

@ibetitsmike

Copy link
Copy Markdown
Contributor

Summary

Aligns the model selector with the adjacent agent picker and makes local/default Jest and ESLint worker counts respect shared cgroup memory pressure.

Background

The model selector reserved a checkmark column on every row, which shifted its leading icons away from the agent picker alignment. During validation, local lint and test runs also exhausted a 32 GiB shared cgroup because the visible 96-core host and leaf cgroup did not expose the tighter ancestor memory cap.

Implementation

  • Shares panel chrome and option-row styling between the model and agent pickers.
  • Distinguishes hover with a neutral row background and selection with an accent provider icon and label, while preserving aria-selected and the separate default-model star.
  • Walks cgroup v1 and v2 ancestors to find the effective memory constraint, accounts for broader equal-cap usage, discounts reclaimable file cache, and reserves headroom before choosing local worker counts.
  • Lints and formats the new runtime helper, with a one-worker ESLint fallback if budget detection fails.

CI integration jobs still pass an explicit --maxWorkers=100% on fixed runners. This PR changes the default worker budget used by local commands and other invocations that do not override it.

Validation

  • make static-check
  • bun x jest tests/workerBudget.test.ts --runInBand --silent (13 tests)
  • bun test ./src/browser/components/AgentModePicker/AgentModePicker.test.tsx (5 tests)
  • Storybook visual comparison of normal, hovered, selected, and selected-plus-hover model rows

Risks

The worker profiles use measured repository workloads and may need retuning if tool memory behavior changes. CI's explicit worker override is unchanged.

Mux prepared this PR on behalf of Mike.


Generated with mux • Model: openai:gpt-5.6-sol • Thinking: max

Share the panel chrome, option row states, and trigger chevron behavior between the two composer pickers via composerPickerStyles.
ESLint and Jest were sized from visible cores because process.constrainedMemory() reads only the leaf cgroup, which reports 'max' while the real 32GiB cap sits on an ancestor. Walk the cgroup chain for the tightest cap, subtract co-tenant usage, and size pools from measured per-worker peaks.
Trim shared picker styles to the classes both selectors use, remove redundant comments and exports, and complete cgroup v1 limit and usage accounting without changing tuned budget constants.

---

_Generated with  • Model:  • Thinking: _

<!-- mux-attribution: model=openai:gpt-5.6-sol thinking=high -->
Restores the WHY behind the per-worker memory constants and the pickers' differing row padding, and adds scripts/lib/*.js to PRETTIER_PATTERNS so the new shared helper is format-checked (the two legacy scripts/*.js files are already non-conforming, so the glob stays narrow to avoid unrelated churn).
The check reserved a column on every row (selected or not), leaving a wide left gutter the agent mode picker does not have. Selection now reads from the accent-tinted provider icon plus the accent label, so both pickers inset their leading icon identically.
Clarify that ESLint concurrency lanes share a process rather than a single V8 heap.

_Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `max`_

<!-- mux-attribution: model=openai:gpt-5.6-sol thinking=max -->
Count sibling usage when equal ancestor caps constrain a cgroup, lint the runtime helper, fail safely to one ESLint worker, and remove unbenchmarked Jest worker recycling.

_Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `max`_

<!-- mux-attribution: model=openai:gpt-5.6-sol thinking=max -->
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 2b19dabc9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike merged commit 417f03f into main Jul 29, 2026
20 of 21 checks passed
@ibetitsmike
ibetitsmike deleted the mike/picker-alignment-worker-budget branch July 29, 2026 20:46
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