Skip to content

feat(fleet): MothershipClient rename, WorkQueueService skeleton & server wiring - #647

Open
OgnjenGligoric wants to merge 3 commits into
andresharpe:releases/4.1.0from
OgnjenGligoric:feat/544-fleet-server-mothership-client-4.1
Open

feat(fleet): MothershipClient rename, WorkQueueService skeleton & server wiring#647
OgnjenGligoric wants to merge 3 commits into
andresharpe:releases/4.1.0from
OgnjenGligoric:feat/544-fleet-server-mothership-client-4.1

Conversation

@OgnjenGligoric

Copy link
Copy Markdown
Contributor

Linked issue

Closes #544

Summary of changes

Implements the remaining deliverables from Phase 8 fleet server (#544): NotificationClientMothershipClient rename across all call sites, and a WorkQueueService skeleton to unblock Phase 10 (Drone, #96).

NotificationClient.psm1MothershipClient.psm1 rename (src/mcp/modules/)
MothershipClient.psm1 is the new canonical shim — identical body to the old file, forwarding to Dotbot.Notification via a global import so all function names stay available. NotificationClient.psm1 is converted to a one-liner deprecation shim that imports MothershipClient.psm1, preserving backward compatibility for any call site not yet updated.

Two known callers updated to import MothershipClient.psm1 directly:

  • src/ui/modules/NotificationPoller.psm1 (2 import sites)
  • src/ui/modules/SettingsAPI.psm1 (1 import site + error message)

WorkQueueService.psm1 skeleton (src/ui/modules/)
File-based work queue for fleet task dispatch, mirroring FleetAPI.psm1's storage pattern under fleet/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 up fleet/queue/ storage directory
  • Enqueue-WorkItem — adds a pending work item for a target runtime
  • Dequeue-WorkItem — pops the next pending item (FIFO), marks it leased
  • Get-WorkQueueDepth — returns count of pending items for a runtime
  • Complete-WorkItem — marks a leased item completed after drone finishes

src/ui/server.ps1
WorkQueueService imported and initialized at server startup alongside FleetAPI.

Fleet endpoints (POST /api/fleet/runtimes/register, POST /api/fleet/runtimes/<id>/heartbeat): already present in server.ps1 on releases/4.1.0 — no changes needed.

Testing notes

All existing tests pass. No new tests added in this PR — WorkQueueService is a skeleton with no runtime behaviour to assert yet; tests will be added alongside the Drone implementation in #96.

Checklist

  • Tests added or updated
  • Docs updated (if behaviour changed)
  • Linked issue exists
  • Follows the contribution guide

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).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.psm1 and wire it into src/ui/server.ps1 startup.
  • Introduce src/mcp/modules/MothershipClient.psm1 and convert NotificationClient.psm1 into a deprecation shim.
  • Update UI call sites (NotificationPoller, SettingsAPI) to import MothershipClient.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.

Comment thread src/ui/modules/WorkQueueService.psm1 Outdated
Comment thread src/ui/modules/WorkQueueService.psm1
Comment thread src/ui/modules/WorkQueueService.psm1
Comment thread src/ui/modules/SettingsAPI.psm1
Comment thread src/ui/server.ps1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@OgnjenGligoric
OgnjenGligoric marked this pull request as ready for review July 15, 2026 01:20
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.
@carlospedreira

Copy link
Copy Markdown
Collaborator

@OgnjenGligoric

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

3 participants