[Fix] Available updates + kernel fixes alert#1159
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds kernel update detection, a Server.kernel_updates field and migration, an UpdateKernel action and queued job, a controller endpoint and resource field, realtime broadcasts on state change, and frontend UI for triggering kernel upgrades. ChangesKernel Update Detection and Upgrade
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Adds first-class tracking of kernel updates (separate from regular package updates) and exposes a dedicated “Update kernel & restart” flow across backend + UI, including warnings/banners and test coverage.
Changes:
- Split update detection into regular vs kernel updates and persist
kernel_updatesonservers. - Add kernel upgrade SSH script + backend action/job/route to run a dist-upgrade and reboot.
- Expose kernel-update warnings and UI actions (dropdown + banner), plus new feature tests.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Feature/ServerTest.php | Adds coverage for kernel update counting, warning exposure, and kernel update authorization. |
| resources/views/ssh/os/upgrade-kernel.blade.php | New SSH script to perform dist-upgrade for kernel updates. |
| resources/views/ssh/os/available-updates.blade.php | Updates the update-check script to output regular vs kernel update counts separately. |
| resources/js/types/server.d.ts | Extends the Server type with kernel_updates and adds a new warning union case. |
| resources/js/pages/servers/components/actions.tsx | Adds a “Update kernel” dropdown action (confirm + POST). |
| resources/js/layouts/server/layout.tsx | Uses realtime server updates to disable/enable menu based on live status. |
| resources/js/components/server-banners.tsx | Adds a kernel-update warning banner with “Update & restart” action. |
| database/migrations/2026_06_13_162705_add_kernel_updates_to_servers_table.php | Adds kernel_updates column to servers. |
| app/SSH/OS/OS.php | Adds upgradeKernel() and changes availableUpdates() to return both counts. |
| app/Models/Server.php | Stores kernel_updates, updates update-check logic, and emits a new warning key. |
| app/Jobs/Server/UpdateKernelJob.php | New queued job to upgrade kernel, refresh status, broadcast, and reboot. |
| app/Http/Resources/ServerResource.php | Exposes kernel_updates to the frontend. |
| app/Http/Controllers/ServerController.php | Adds servers.update-kernel endpoint and updates update-check flash message. |
| app/Actions/Server/UpdateKernel.php | Action to mark server as updating and dispatch the kernel update job. |
| app/Actions/Server/RebootServer.php | Broadcasts server updates after a reboot state change. |
| app/Actions/Server/CheckConnection.php | Broadcasts server updates when connection status transitions. |
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
resources/js/layouts/server/layout.tsx (1)
284-284:⚠️ Potential issue | 🟠 Major | ⚡ Quick winPass the realtime
servertoServerHeaderinstead ofpage.props.server.Line 44 creates a realtime server record that updates when
server.updatedsocket events arrive (broadcast byUpdateKernelJobafter kernel upgrades complete). Line 45 correctly uses this realtime server forisMenuDisabled, but line 284 still passes the stalepage.props.servertoServerHeader.If
ServerHeaderrenders components that depend onserver.kernel_updatesorserver.status(such asServerActionsfrom this same directory), those components will display stale data until the page refreshes, breaking the realtime update flow.🔄 Proposed fix
- <ServerHeader server={page.props.server} site={page.props.site} /> + <ServerHeader server={server} site={page.props.site} />🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@resources/js/layouts/server/layout.tsx` at line 284, Replace the stale page.props.server being passed to ServerHeader with the realtime server variable used elsewhere in this file (the same "server" used for computing isMenuDisabled) so ServerHeader and its children (e.g., ServerActions) receive the live record (including kernel_updates and status) and update on realtime socket events.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/Actions/Server/UpdateKernel.php`:
- Around line 9-17: Add PHPDoc documentation for the UpdateKernel action: place
a class-level PHPDoc above class UpdateKernel summarizing the action's
responsibility, and a method-level PHPDoc above updateKernel specifying the
parameter type (Server $server), the purpose, and return void; reference the
Server model and the fact it sets Server::status to ServerStatus::UPDATING and
dispatches UpdateKernelJob to the 'ssh' queue so readers understand side effects
and expected behavior.
In `@app/Jobs/Server/UpdateKernelJob.php`:
- Around line 42-46: The log call in UpdateKernelJob (ServerLog::log invoked in
UpdateKernelJob::handle) uses a generic event type 'update-server-failed';
change that string to a kernel-specific identifier such as
'update-kernel-failed' (or 'kernel-update-failed') so kernel update failures are
distinguishable from other server update failures—update the third argument
passed to ServerLog::log in UpdateKernelJob accordingly.
- Around line 18-59: Add PHPDoc blocks to the UpdateKernelJob class and each
public/private method: document the class purpose (runs a kernel upgrade and
triggers reboot/notifications) above class UpdateKernelJob; add a constructor
PHPDoc for __construct(Server $server) describing the injected Server parameter;
add a handle() PHPDoc describing what it does and any thrown exceptions (if any
underlying calls can throw, annotate `@throws` \Exception); add a failed(Exception
$e) PHPDoc describing its error handling and the Exception parameter; and add a
short PHPDoc for private broadcastServerUpdate() describing its behavior.
Include param and return tags where appropriate (`@param` Server $server, `@param`
Exception $e, `@return` void) and `@throws` for methods that may propagate
exceptions.
- Around line 49-58: Replace the duplicated broadcast logic in the private
broadcastServerUpdate() with a call to the existing BroadcastServerUpdate
action: remove the SocketEvent::dispatch block and instead invoke the
BroadcastServerUpdate action (e.g., resolve(BroadcastServerUpdate::class) or new
BroadcastServerUpdate(...)) passing the refreshed Server instance (or project id
and ServerResource as the action expects); then update the call sites in
handle() and failed() to call that action instead of the removed private method
so the job composes the shared BroadcastServerUpdate logic rather than
reimplementing it.
In
`@database/migrations/2026_06_13_162705_add_kernel_updates_to_servers_table.php`:
- Line 12: The migration adds the kernel_updates column without explicit
positioning; update the $table->integer('kernel_updates')->default(0) definition
to include ->after('updates') so the new kernel_updates column is placed
immediately after the existing updates column for clearer schema ordering.
---
Outside diff comments:
In `@resources/js/layouts/server/layout.tsx`:
- Line 284: Replace the stale page.props.server being passed to ServerHeader
with the realtime server variable used elsewhere in this file (the same "server"
used for computing isMenuDisabled) so ServerHeader and its children (e.g.,
ServerActions) receive the live record (including kernel_updates and status) and
update on realtime socket events.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 3d2822b1-7dd8-47bf-9a91-e62618e3a6c3
📒 Files selected for processing (16)
app/Actions/Server/CheckConnection.phpapp/Actions/Server/RebootServer.phpapp/Actions/Server/UpdateKernel.phpapp/Http/Controllers/ServerController.phpapp/Http/Resources/ServerResource.phpapp/Jobs/Server/UpdateKernelJob.phpapp/Models/Server.phpapp/SSH/OS/OS.phpdatabase/migrations/2026_06_13_162705_add_kernel_updates_to_servers_table.phpresources/js/components/server-banners.tsxresources/js/layouts/server/layout.tsxresources/js/pages/servers/components/actions.tsxresources/js/types/server.d.tsresources/views/ssh/os/available-updates.blade.phpresources/views/ssh/os/upgrade-kernel.blade.phptests/Feature/ServerTest.php
…ate, cleaner update flash message Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary by CodeRabbit
New Features
Bug Fixes / Behaviour
Tests