Fix #28: redirect off /provisioning when setup_complete event arrives#34
Merged
Conversation
The provisioning page polls every 3s with usePoll to detect the
server.status flip to 'running' and navigate the user to /agents.
Two failure modes leave the page stuck at ~80% even after the server
is actually ready:
1. A poll cycle fails silently (network blip) and the page never
gets the 'running' status update.
2. The gateway-restart callback fires after the script's
setup_complete event but before the status column transitions,
so for a few seconds the prop says 'configuring' while the
server is already up.
Add the setup_complete + gateway_restarted events as belt-and-suspenders
redirect triggers on the client. Either event landing in the events
array (already exposed via the provisioning page payload) is a strong
signal that the server is done — we stop polling and hand off to
/agents immediately, even if the status column hasn't caught up yet.
Also adds 'gateway_restarted' to the controller's event whitelist so
the frontend can see it (previously filtered out).
Tests: new feature test confirms both events are present in the page
payload. All Teams + Api feature tests pass (116 passed, 4 skipped).
Fixes #28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The provisioning page polls every 3s with
usePoll({ only: ['server'] })to detectserver.status === 'running'and navigate the user to/agents. Two failure modes leave the user stuck at ~80% even when the server is actually ready:setup_completeandgateway_restartedcallbacks fire before the status column transitions torunning, so for a few seconds the prop saysconfiguringwhile the server is already up.Fixes #28.
Changes
resources/js/pages/settings/teams/provisioning.tsx: derive a newisReadyByEventsflag from the events array —events.some(e => e.event === 'setup_complete' || e.event === 'gateway_restarted'). Either event landing is a strong signal the server is ready. The effect that callsrouter.visit('/agents')now fires onisRunning || isReadyByEvents, so we hand off as soon as either path signals completion.usePoll'sautoStartis also gated on the combined flag so we don't keep hammering after a successful handoff.app/Http/Controllers/Settings/TeamController.php: addgateway_restartedto the event-type whitelist so the frontend can see it (it was being filtered out by thewhereInclause).Tests
tests/Feature/Teams/ServerProvisioningPageTest.php:provisioning page exposes setup_complete + gateway_restarted events so the client can redirect even if status lags (issue #28). Creates a server inprovisioningstatus with the two events attached, asserts both are present in the page payload.Pint: clean. Frontend rebuilt (
npm run build).Live E2E status
/agentswithin a few seconds ofsetup_completelanding in the activity feed (not stuck at 79% / 90%)Test plan