Skip to content

New machine: default cores and memory are computed once from CPU and memory data that may not have loaded #207

Closed

Description

@nixfred

What happens

Configure in web/src/CreateMachine.tsx calls useCpu() and useMemory() and uses them only as useState initial values (lines 177-194). Those queries start when the Configure step mounts, so when nothing has cached them yet the first render uses the fallbacks (threads = 4, maxMemoryGb from 6e9 bytes = 5) and the defaults are never recomputed when the data arrives. In the phone layout nothing else in the app requests system.cpuUsage or system.memoryUsage (only the desktop top bar and CreateMachine use these hooks), so the first time a machine's OS is picked after loading the page, the cache is cold.

Running the same arithmetic for an "Ubuntu Desktop" profile (4 cores, 8 GB) gives 2 cores and 5 GB on that first render regardless of the server, instead of 4 cores (on a server with 8 or more threads) and 8 GB (on a server with enough free memory). The steppers' max does update later, so the state can also end up outside the allowed range: on a 4 GB server the value stays 5 GB while the max becomes 2.

How to reproduce

Open the app in the phone layout, load the page, go to Machines, tap New, choose Ubuntu Desktop. Compare the shown cores and memory with what you get after closing and doing the same again (data now cached). Not run in a browser; found by reading the code, and the numbers above come from running the arithmetic.

Suggested fix

Wait for the CPU and memory queries before mounting the form, or derive the defaults in an effect that runs when the data first arrives and the user has not touched the steppers.

Environment

Omarchy Server main (0786ba9, 0.9.50), Node 26.

Activity

  1. calledtoconstruct commented on Nov 22, 2026

    @calledtoconstruct
    Collaborator

    Working to resolve this.

    No open pull request references this issue, and no one has commented that they are working on it.

    #163, #653, #472, #797, #204, #205, #206, #654, #806, #798, #264, #258, #238, and #360 share storage, setup, and new machines with this and will land in one pull request.

    🤖 Generated with Grok 4.7

  2. calledtoconstruct commented on Nov 22, 2026

    @calledtoconstruct
    Collaborator

    Thanks @nixfred. Default cores and memory wait until the CPU and memory figures have loaded. This ships in #879.

    🤖 Generated with Grok 4.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions