Skip to content

[Feat] Worker error tracking#1127

Open
RichardAnderson wants to merge 4 commits into
vitodeploy:4.xfrom
RichardAnderson:feat/worker-errors
Open

[Feat] Worker error tracking#1127
RichardAnderson wants to merge 4 commits into
vitodeploy:4.xfrom
RichardAnderson:feat/worker-errors

Conversation

@RichardAnderson
Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.error across API resources, OpenAPI schema, and TS types; show errors in multiple UI surfaces.
  • Centralize worker failure handling via HandlesWorkerFailure and introduce RestartSiteWorkers to restart workers during deploy with per-worker failure capture.
  • Expand site warning logic to include worker_not_running warnings and ensure key web pages preload workers for 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.

Comment thread app/Models/Site.php
Comment thread resources/js/components/error-indicator.tsx Outdated
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.

2 participants