Skip to content

Fix #28: redirect off /provisioning when setup_complete event arrives#34

Merged
obaid merged 1 commit into
mainfrom
fix/issue-28-provisioning-ui-stuck
May 22, 2026
Merged

Fix #28: redirect off /provisioning when setup_complete event arrives#34
obaid merged 1 commit into
mainfrom
fix/issue-28-provisioning-ui-stuck

Conversation

@obaid
Copy link
Copy Markdown
Contributor

@obaid obaid commented May 22, 2026

Summary

The provisioning page polls every 3s with usePoll({ only: ['server'] }) to detect server.status === 'running' and navigate the user to /agents. Two failure modes leave the user stuck at ~80% even when the server is actually ready:

  1. Poll cycle fails silently (network blip / Inertia partial-reload error) — page never gets the updated status.
  2. Status column lags the events — the script's setup_complete and gateway_restarted callbacks fire before the status column transitions to running, so for a few seconds the prop says configuring while the server is already up.

Fixes #28.

Changes

  • resources/js/pages/settings/teams/provisioning.tsx: derive a new isReadyByEvents flag 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 calls router.visit('/agents') now fires on isRunning || isReadyByEvents, so we hand off as soon as either path signals completion. usePoll's autoStart is also gated on the combined flag so we don't keep hammering after a successful handoff.
  • app/Http/Controllers/Settings/TeamController.php: add gateway_restarted to the event-type whitelist so the frontend can see it (it was being filtered out by the whereIn clause).

Tests

  • New feature test in 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 in provisioning status with the two events attached, asserts both are present in the page payload.
  • All existing Teams + Api tests still pass (116 passed, 4 skipped).

Pint: clean. Frontend rebuilt (npm run build).

Live E2E status

⚠️ Live E2E not run on this branch — Expose tunnel was too flaky during PR creation (plane wifi). Recommended manual verification on stable internet:

  1. Sign up fresh, create a team on DO
  2. Watch the provisioning page through to completion
  3. Confirm the page auto-redirects to /agents within a few seconds of setup_complete landing in the activity feed (not stuck at 79% / 90%)
  4. Repeat with DevTools throttled to "Slow 3G" — should still redirect (the event-based fallback handles cases where polling lags)

Test plan

  • CI green
  • Live E2E on stable internet — page auto-redirects to /agents
  • Throttled-network E2E — page still redirects when polling is slow

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
@obaid obaid merged commit 0ecdd41 into main May 22, 2026
1 of 2 checks passed
@obaid obaid deleted the fix/issue-28-provisioning-ui-stuck branch May 22, 2026 18:18
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.

Provisioning page stuck at 79% even after server reaches 'running'; manual reload required

1 participant