[Feat] Worker error tracking#1127
Open
RichardAnderson wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds persistent worker error tracking (DB + API), surfaces worker failures as site warnings/UI indicators, and centralizes restart/failure handling so worker restarts during deploy and manual actions record/report errors consistently.
Changes:
- Persist and expose
workers.erroracross API resources, OpenAPI schema, and TS types; show errors in multiple UI surfaces. - Centralize worker failure handling via
HandlesWorkerFailureand introduceRestartSiteWorkersto restart workers during deploy with per-worker failure capture. - Expand site warning logic to include
worker_not_runningwarnings and ensure key web pages preloadworkersfor warning generation.
Reviewed changes
Copilot reviewed 37 out of 39 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Feature/WorkersTest.php | Adds coverage for supervisor reread/update on start and optimistic error clearing. |
| tests/Feature/WarningsBroadcastTest.php | Adds coverage for new worker-related site warnings (proxied + non-proxied). |
| tests/Feature/SiteSettingsProxiedSiteTest.php | Covers “update start command + restart now” behavior. |
| tests/Feature/RestartSiteWorkersTest.php | New tests for deploy-time worker restart behavior and error persistence. |
| tests/Feature/Jobs/WorkerJobsTest.php | Updates failure expectations and tests error extraction + resource exposure. |
| resources/views/ssh/services/process-manager/supervisor/stop-worker.blade.php | Captures supervisor output and flags failures for parsing/logging. |
| resources/views/ssh/services/process-manager/supervisor/start-worker.blade.php | Adds reread/update before start and captures output for error extraction. |
| resources/views/ssh/services/process-manager/supervisor/restart-workers.blade.php | Removes bulk restart script (restart now handled per-worker in PHP). |
| resources/views/ssh/services/process-manager/supervisor/restart-worker.blade.php | Captures output and flags failures consistently. |
| resources/views/ssh/services/process-manager/supervisor/create-worker.blade.php | Captures output and flags failures consistently during create. |
| resources/js/types/worker.d.ts | Adds error field to the Worker TS type. |
| resources/js/types/site.d.ts | Extends SiteWarning union with worker_not_running shape. |
| resources/js/pages/workers/components/columns.tsx | Displays an error indicator next to worker status in the table. |
| resources/js/pages/site-settings/components/start-command.tsx | Adds apply-choice UX (config-only vs restart-now) when a bootstrap worker exists. |
| resources/js/pages/hosted-domains/index.tsx | Reuses shared ErrorIndicator component (removes inline copy). |
| resources/js/pages/application/components/proxied-app-card.tsx | Shows worker error indicator in the proxied app card header. |
| resources/js/components/site-banners.tsx | Renders worker warnings as banners with status + error details and CTA. |
| resources/js/components/error-indicator.tsx | New shared tooltip-based error indicator component. |
| resources/js/components/banners.tsx | Allows richer banner descriptions by switching wrapper from <p> to <div>. |
| public/api-docs/openapi/schemas/Worker.yaml | Updates status enum and documents new error field. |
| database/migrations/2026_05_25_123252_add_error_to_workers_table.php | Adds nullable error column to workers. |
| app/Traits/HandlesWorkerFailure.php | New shared failure handler (extracts supervisor error lines, broadcasts updates). |
| app/Tables/SiteTable.php | Eager-loads workers so site warnings can include worker state. |
| app/Services/ProcessManager/Supervisor.php | Removes restartByIds implementation (no longer used). |
| app/Services/ProcessManager/ProcessManager.php | Removes restartByIds from the interface. |
| app/Models/Worker.php | Makes error mass-assignable and documents it. |
| app/Models/Site.php | Adds worker-derived warnings and bootstrap worker id parsing. |
| app/Jobs/Worker/ManageJob.php | Clears error on success; uses shared failure handler; broadcasts site updates. |
| app/Jobs/Worker/EditJob.php | Clears error on success; uses shared failure handler; broadcasts site updates. |
| app/Jobs/Worker/CreateJob.php | Keeps failed worker (with error) instead of deleting; uses shared failure handler. |
| app/Jobs/Site/DeployJob.php | Uses RestartSiteWorkers instead of removed bulk restart-by-ids call. |
| app/Http/Resources/WorkerResource.php | Exposes error field. |
| app/Http/Middleware/HandleInertiaRequests.php | Loads workers for site props so warnings can include worker info. |
| app/Http/Controllers/SiteSettingController.php | Adds flash messaging for “start command updated + restarting”. |
| app/Actions/Worker/RestartSiteWorkers.php | New action: restart each worker and record failures without aborting the deploy flow. |
| app/Actions/Worker/ManageWorker.php | Clears error optimistically when transitioning to starting/stopping/restarting. |
| app/Actions/Worker/EditWorker.php | Clears error when editing (restarting) a worker. |
| app/Actions/Site/UpdateStartCommand.php | Adds optional restart behavior and a new result enum case. |
| app/Actions/Site/BroadcastSiteUpdate.php | Loads workers for accurate warning computation in broadcasts. |
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.
This pull request introduces several improvements and refactors to worker management, especially around error handling, status reporting, and worker restarts. The changes add more robust error tracking for workers, centralize worker restart logic, and enhance the visibility of worker status and errors throughout the application.