Skip to content

[code-review] desktop Notify() dead code — frontend notification event never emitted (EventsEmit call missing) #91

Description

@topcheer

Problem

In desktop/ggcode-desktop-wails/notifications.go, the Notify() method (lines 94-99) contains dead code that was intended to emit a frontend event for the in-app notification center, but the actual runtime.EventsEmit call is missing.

// Also emit to frontend for in-app notification center
if ctx != nil {
    if c, ok := ctx.(interface{}); ok {  // Always succeeds — everything implements interface{}
        _ = c // ctx is used by runtime.EventsEmit below  ← NO EventsEmit CALL EXISTS!
    }
}

The type assertion ctx.(interface{}) is a no-op (any value satisfies the empty interface), _ = c discards the result, and the comment references a runtime.EventsEmit call that was never written.

File and Lines

  • desktop/ggcode-desktop-wails/notifications.go lines 94-99

Trigger Scenario

  1. User switches to another application (window not focused)
  2. Agent completes a long-running task
  3. app.go calls nm.Notify("GGCode", "Task completed")
  4. OS-level notification appears correctly ✓
  5. Dock badge updates correctly ✓
  6. Frontend notification center never receives the event

Expected vs Actual Behavior

Expected: The frontend should receive a "notification" event so any in-app notification UI (notification center, toast, history) can display it.

Actual: No frontend event is emitted. The dead code block does nothing. Any in-app notification center UI is non-functional.

Evidence

  • notifications.go has zero EventsEmit calls
  • app.go (line 191) shows the correct pattern: runtime.EventsEmit(a.ctx, ev.name, ev.payload)
  • nm.ctx is stored as interface{} (typed as runtime.Context) specifically to enable EventsEmit, but the call was never implemented

Severity

Medium — OS-level notifications still work, so users aren't completely missing notifications. However, the in-app notification center feature is silently broken.

Fix Suggestion

Replace the dead code with an actual event emission:

// Also emit to frontend for in-app notification center
if ctx != nil {
    runtime.EventsEmit(ctx, "notification", map[string]string{
        "title": title,
        "body":  body,
    })
}

Note: nm.ctx is already stored as interface{} to avoid import cycles, and runtime.EventsEmit accepts interface{} as its first argument.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions