feat(fleet): MothershipClient rename, WorkQueueService skeleton & server wiring - #647
Conversation
Add a MothershipClient compatibility shim that globally imports the runtime Dotbot.Notification module. Deprecate the old NotificationClient by turning it into a thin forwarder to MothershipClient and update UI modules (NotificationPoller, SettingsAPI) to reference MothershipClient instead of NotificationClient. Introduce a skeleton WorkQueueService implementing a file-based queue API (enqueue, dequeue, depth, complete) and its initialization. Wire WorkQueueService into the UI server startup (import + Initialize-WorkQueueService).
There was a problem hiding this comment.
Pull request overview
This PR advances the fleet (“Mothership”) server work by renaming the UI/MCP import surface from NotificationClient to MothershipClient, and introducing a first-pass WorkQueueService module intended to support Phase 10 Drone task dispatch.
Changes:
- Add
src/ui/modules/WorkQueueService.psm1and wire it intosrc/ui/server.ps1startup. - Introduce
src/mcp/modules/MothershipClient.psm1and convertNotificationClient.psm1into a deprecation shim. - Update UI call sites (
NotificationPoller,SettingsAPI) to importMothershipClient.psm1.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ui/server.ps1 | Imports + initializes the new WorkQueueService at UI server startup. |
| src/ui/modules/WorkQueueService.psm1 | New file-based work queue skeleton for fleet dispatch. |
| src/ui/modules/SettingsAPI.psm1 | Updates module path + error message to MothershipClient.psm1. |
| src/ui/modules/NotificationPoller.psm1 | Updates both import sites to MothershipClient.psm1. |
| src/mcp/modules/NotificationClient.psm1 | Becomes a one-line backward-compat shim that imports MothershipClient.psm1. |
| src/mcp/modules/MothershipClient.psm1 | New canonical shim that imports Dotbot.Notification globally. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Use file CreationTime when ordering queue files in Dequeue-WorkItem to ensure FIFO behavior instead of sorting by filename. Add tests to Test-Runtime.ps1 to import the WorkQueueService module and verify initialize, enqueue, dequeue, lease/completion semantics, depth reporting, per-runtime isolation, and error handling, plus cleanup of temp control directory.
|
The PR description says this closes #544, but the issue explicitly calls for POST /api/fleet/register and a heartbeat endpoint at /api/fleet/heartbeat. This PR leaves only the existing /api/fleet/runtimes/register and /api/fleet/runtimes/{id}/heartbeat routes in place. Could you either add the documented routes (or aliases), or update the issue/PR scope so #544 is not marked complete prematurely? |
Linked issue
Closes #544
Summary of changes
Implements the remaining deliverables from Phase 8 fleet server (#544):
NotificationClient→MothershipClientrename across all call sites, and aWorkQueueServiceskeleton to unblock Phase 10 (Drone, #96).NotificationClient.psm1→MothershipClient.psm1rename (src/mcp/modules/)MothershipClient.psm1is the new canonical shim — identical body to the old file, forwarding toDotbot.Notificationvia a global import so all function names stay available.NotificationClient.psm1is converted to a one-liner deprecation shim that importsMothershipClient.psm1, preserving backward compatibility for any call site not yet updated.Two known callers updated to import
MothershipClient.psm1directly:src/ui/modules/NotificationPoller.psm1(2 import sites)src/ui/modules/SettingsAPI.psm1(1 import site + error message)WorkQueueService.psm1skeleton (src/ui/modules/)File-based work queue for fleet task dispatch, mirroring
FleetAPI.psm1's storage pattern underfleet/queue/<RuntimeId>/. Exports a stable public surface that #96 (Drone agent) can import and call without errors — full dispatch logic is deferred to the Drone phase.Exported functions:
Initialize-WorkQueueService— sets upfleet/queue/storage directoryEnqueue-WorkItem— adds a pending work item for a target runtimeDequeue-WorkItem— pops the next pending item (FIFO), marks itleasedGet-WorkQueueDepth— returns count of pending items for a runtimeComplete-WorkItem— marks a leased itemcompletedafter drone finishessrc/ui/server.ps1WorkQueueServiceimported and initialized at server startup alongsideFleetAPI.Fleet endpoints (
POST /api/fleet/runtimes/register,POST /api/fleet/runtimes/<id>/heartbeat): already present inserver.ps1onreleases/4.1.0— no changes needed.Testing notes
All existing tests pass. No new tests added in this PR —
WorkQueueServiceis a skeleton with no runtime behaviour to assert yet; tests will be added alongside the Drone implementation in #96.Checklist