Skip to content

fix(agent-host): restore agent-dashboard event bridge — chats responsive again#137

Open
ParkerM2 wants to merge 7 commits into
productionfrom
feature/agent-host-event-bridge
Open

fix(agent-host): restore agent-dashboard event bridge — chats responsive again#137
ParkerM2 wants to merge 7 commits into
productionfrom
feature/agent-host-event-bridge

Conversation

@ParkerM2
Copy link
Copy Markdown
Owner

Summary

  • Workspace primary + team-lead chat panels were unresponsive: user message bubbled but no assistant reply ever appeared.
  • Root cause: when AgentManagerService moved into the utility process, its router.emit(...) calls landed on a no-op shim. Nothing in main re-emitted the host's AgentManagerEvents onto the renderer-facing AGENT_DASHBOARD_EVENTS.* IPC channels that useAgentDashboardEvents / useAgentStream / useSessionThinking subscribe to.
  • Fix: align host-side emitEvent.data payloads with the IPC contracts, add a new wireAgentDashboardBridge forwarder in service-registry, drop the renderer's optimistic user-message write so the host echo is the single source of truth (no duplicate bubbles).

Changes

  • src/main/services/agent-manager/agent-manager-service.ts — reshape emitEvent payloads for session.ended, status.changed, stream.event; delete dead router.emit(...) calls; drop unused router dep and IpcRouter / AGENT_DASHBOARD_EVENTS imports.
  • src/main/agent-host/index.ts — delete createRouterShim, pass {} to createAgentManagerService.
  • src/main/agent-host/agent-dashboard-bridge.ts (new) — pure forwardAgentManagerEvent mapping + wireAgentDashboardBridge factory. Hoists the router.emit bind once outside the event callback.
  • tests/unit/main/agent-host/agent-dashboard-bridge.test.ts (new) — 7 Vitest cases covering all 5 mapped event types + unknown-type ignore + factory subscribe/forward/unsub.
  • src/main/bootstrap/service-registry.ts — wire the bridge between createProjectService and createCommandBus, before any other agentHostClient.onEvent subscriber.
  • src/renderer/features/workspace/api/useWorkspace.ts — drop optimistic onMutate / onError blocks from useWorkspaceSend.
  • src/main/features/agent-dashboard/agent-dashboard-handlers.ts — refresh stale file-header comment to point at the new bridge.

Implementation plan: docs/superpowers/plans/2026-05-14-agent-host-event-bridge.md

Deferred follow-ups (not in this PR)

  • agentHostClient.sendMessage is fire-and-forget and always returns true — failures (no process, dead stdin) silently swallowed.
  • WorkspaceSession.status is set to 'live' immediately after spawn and never tracks host-side process death.
  • Pre-existing dead read in src/main/bus/session-manager.ts:71 (data?.status on status.changed payload) — now permanently dead since the payload shape never had status.

Test plan

  • npx tsc --noEmit — clean
  • npx vitest run tests/unit/main/agent-host/ — 7/7 pass
  • npx eslint on all touched files — clean
  • npm run dev — ADC-Dev boots cleanly, no agent-dashboard.* errors
  • Manual: primary panel chat — single user bubble, streaming response
  • Manual: team-lead panel chat — single user bubble, streaming response

🤖 Generated with Claude Code

ParkerES and others added 7 commits May 14, 2026 09:59
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ch renderer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tes cache

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…idge

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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