feat(admin): add machine size update endpoint and admin UI#1357
feat(admin): add machine size update endpoint and admin UI#1357evanjacobson wants to merge 15 commits intomainfrom
Conversation
Add a targeted PATCH endpoint to update a kiloclaw instance's machineSize without re-provisioning (which would wipe envVars, secrets, etc.). New size takes effect on the next machine restart. The admin UI presents valid Fly.io machine configurations with dynamic memory options based on cpu_kind and CPU count, enforcing shared-cpu-2x as the minimum preset and 3 GB as the minimum RAM.
Instead of waiting for a restart, the "Save & Apply Now" button immediately reconfigures the Fly machine by fetching its current config and patching only the guest (CPU/memory) field. This preserves the running image (version pin), env vars, mounts, and all other config exactly as-is — equivalent to `fly machine update`. A secondary "Save for Restart" button retains the old behavior.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)SUGGESTION
Other Observations (not in diff)N/A Files Reviewed (8 files)
Reviewed by gpt-5.4-20260305 · 2,377,097 tokens |
1. Cap memory picker presets at 16384 MB to match MachineSizeSchema max 2. Defer persisting machineSize until after successful Fly apply so a failed update doesn't leave stale size in storage 3. Handle stopped/created machines in applyNow by calling startMachine explicitly (matching restartMachineInBackground behavior) 4. Pass updated.instance_id to waitForState so it waits for the new machine version, not a stale pre-update started state
…troy Re-read status from storage after Fly API calls and bail if the instance was destroyed in the interim. Prevents persist() from recreating a partial row with only machineSize after finalizeDestroyIfComplete() has cleared all storage.
DurableObjectStorage.get() returns undefined (not null) for missing keys, so the strict === null check never matched after storage was cleared by finalizeDestroyIfComplete().
…ch-claw-machine # Conflicts: # kiloclaw/worker-configuration.d.ts # src/app/admin/components/KiloclawInstances/KiloclawInstanceDetail.tsx # src/routers/kiloclaw-billing-router.test.ts
Main removed the trial_end logic from subscription_data in createSubscriptionCheckout. These tests were incorrectly kept during merge conflict resolution.
| identity: undefined; | ||
| generated: undefined; | ||
| }, {}, {}>; | ||
| discord_server_membership_verified_at: drizzle_orm_pg_core.PgColumn<{ |
There was a problem hiding this comment.
Seems like you got some unrelated changes in here
There was a problem hiding this comment.
these never got generated previously but are now merged into main. When I update the branch they should disappear
RSO
left a comment
There was a problem hiding this comment.
There are changes here that don't belong, but other than that, the change looks good.
One thought: Is this tRPC call going through the main tRPC endpoint? Otherwise, we may have to bump the maxDuration of the endpoint.
There was a problem hiding this comment.
One thought: Is this tRPC call going through the main tRPC endpoint? Otherwise, we may have to bump the maxDuration of the endpoint.
@RSO @evanjacobson instead of adding endpoints - which we probably have to workaround/change when go to do multiple instance sizes. What if we just make the instance size a env var. Then you can just override it in .dev.vars if you want to provision something else?
The goal was to make this available in prod for our machines, in addition to dev @pandemicsyn |
Pull request was closed
Summary
PATCH /api/platform/machine-sizeendpoint to update a kiloclaw instance'smachineSizewithout re-provisioning (which would wipe envVars, secrets, etc.)updateMachineSizeDO method, internal client method, and tRPC admin mutation through the full stackKilo team — Loom
https://www.loom.com/share/be4a9d1159e148fd879fa6b157f4f1b3
Test plan
pnpm tsc --noEmitpasses in bothkiloclaw/and rootnulland displays "Default (shared-cpu-2x / 3 GB)"guestFromSize)