Skip to content

fix(admin): invalidate controllerVersion on machineRedeploy and machineUpgrade success#1880

Open
pandemicsyn wants to merge 1 commit intomainfrom
gt/shadow/d10df224
Open

fix(admin): invalidate controllerVersion on machineRedeploy and machineUpgrade success#1880
pandemicsyn wants to merge 1 commit intomainfrom
gt/shadow/d10df224

Conversation

@pandemicsyn
Copy link
Copy Markdown
Contributor

Summary

Adds an immediate controllerVersion query invalidation to the onSuccess callbacks of both machineRedeploy and machineUpgrade mutations in KiloclawInstanceDetail.tsx.

Previously, the Gateway section could show stale data (e.g. "Unavailable until redeploy") for up to 5 minutes after a redeploy or upgrade succeeded because the controllerVersion query has a 5-minute staleTime and was only re-invalidated once the machine polled back to running state — not at mutation success time.

The fix adds an immediate invalidation at onSuccess (guarded by data?.user_id), clearing the stale cache right away. The existing deferred re-invalidation via the useEffect polling loop (fires once the machine is confirmed running) is preserved alongside this immediate invalidation.

Verification

  • Code review only; change is a pure query-cache invalidation with no server-side logic.
  • Pattern mirrors the existing controllerVersion invalidation in the useEffect restart-completion hook (lines 1133–1140 in the file).
  • No regressions possible — invalidating a query early just causes an extra refetch, not incorrect state.

Visual Changes

N/A

Reviewer Notes

The double-invalidation is intentional: the immediate invalidation at onSuccess kicks out the stale cached value before the machine has restarted, and the useEffect invalidation fires a second time once the machine is confirmed running and the new controllerVersion is actually available. This is the correct two-phase pattern for post-restart UI updates.

…neUpgrade success

In both restartMachine mutation onSuccess callbacks, immediately invalidate
the controllerVersion query so the Gateway section does not show stale data
(e.g. 'Unavailable until redeploy') after an upgrade succeeds.

The gatewayStatus invalidation was already present via invalidateGatewayQueries().
The deferred re-invalidation via useEffect (polling until machine is running)
is preserved alongside this immediate invalidation.
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Apr 2, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • src/app/admin/components/KiloclawInstances/KiloclawInstanceDetail.tsx

Reviewed by gpt-5.4-20260305 · 449,029 tokens

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