From ed4efcbd55e64aec3d0e5a29bea317693c265865 Mon Sep 17 00:00:00 2001 From: Virgil Date: Thu, 2 Apr 2026 11:14:17 +0000 Subject: [PATCH] feat(ide): emit build start lifecycle notifications Advertise and emit build.start when a bridged build enters a running state, alongside the existing complete/fail lifecycle events. Co-Authored-By: Virgil --- pkg/mcp/ide/ide.go | 2 ++ pkg/mcp/ide/tools_test.go | 28 ++++++++++++++++++++++++++++ pkg/mcp/notify.go | 1 + 3 files changed, 31 insertions(+) diff --git a/pkg/mcp/ide/ide.go b/pkg/mcp/ide/ide.go index 0242f2a..1124279 100644 --- a/pkg/mcp/ide/ide.go +++ b/pkg/mcp/ide/ide.go @@ -335,6 +335,8 @@ func (s *Subsystem) emitBuildLifecycle(build BuildInfo) { channel := "" switch build.Status { + case "running", "in_progress", "started": + channel = "build.start" case "success", "succeeded", "completed", "passed": channel = "build.complete" case "failed", "error": diff --git a/pkg/mcp/ide/tools_test.go b/pkg/mcp/ide/tools_test.go index 0a02c27..7a961b2 100644 --- a/pkg/mcp/ide/tools_test.go +++ b/pkg/mcp/ide/tools_test.go @@ -356,6 +356,34 @@ func TestBuildStatus_Good_EmitsLifecycle(t *testing.T) { } } +// TestBuildStatus_Good_EmitsStartLifecycle verifies running builds broadcast a start event. +func TestBuildStatus_Good_EmitsStartLifecycle(t *testing.T) { + sub := newNilBridgeSubsystem() + notifier := &recordingNotifier{} + sub.SetNotifier(notifier) + + sub.handleBridgeMessage(BridgeMessage{ + Type: "build_status", + Data: map[string]any{ + "buildId": "build-2", + "repo": "core-php", + "branch": "main", + "status": "running", + }, + }) + + if notifier.channel != "build.start" { + t.Fatalf("expected build.start channel, got %q", notifier.channel) + } + payload, ok := notifier.data.(map[string]any) + if !ok { + t.Fatalf("expected payload map, got %T", notifier.data) + } + if payload["id"] != "build-2" { + t.Fatalf("expected build id build-2, got %v", payload["id"]) + } +} + // TestBuildList_Good_NilBridge verifies buildList returns an empty list without a bridge. func TestBuildList_Good_NilBridge(t *testing.T) { sub := newNilBridgeSubsystem() diff --git a/pkg/mcp/notify.go b/pkg/mcp/notify.go index 2d06b16..a8dce3b 100644 --- a/pkg/mcp/notify.go +++ b/pkg/mcp/notify.go @@ -197,6 +197,7 @@ func channelCapability() map[string]any { // experimental capability. func channelCapabilityChannels() []string { return []string{ + "build.start", "agent.complete", "agent.blocked", "agent.status",