Skip to content

fix(RelayBarGlass): usage never loads — start polling from AppModel.init - #33

Open
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1784144701-relaybar-poll-fix
Open

fix(RelayBarGlass): usage never loads — start polling from AppModel.init#33
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1784144701-relaybar-poll-fix

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

RelayBar (Glass) made zero network requests for its entire lifetime, so every tool tab was stuck on hardcoded seed values and fell into the "Not routed through Relay" state regardless of gateway/key/config (issue #32).

Root cause: AppModel.start() — which creates the 5s poll timer and triggers the first fetch — was invoked from .onAppear on the MenuBarExtra label. Under .menuBarExtraStyle(.window) that label's .onAppear never fires, so start() was never called → no timer → refresh()/refreshSpend()/computeSpend() never ran → no HTTP request ever made. The failure was silent because lastError is only set on a fetch path that never executed.

Fix: drive polling from the model instead of a view modifier.

// AppModel.init()
self.agents = AppModel.seedAgents()
start()                       // added

// RelayBarApp.swift
} label: {
    Text("✨🚅")               // .onAppear { model.start() } removed
}

AppModel is @MainActor and the @StateObject is created on the main actor, so start() (which schedules the Timer on RunLoop.main and kicks off detached fetch tasks) runs safely from init.

Scope / not included

This fixes the confirmed root cause (no polling → no data). The reporter's separate "still open" note about an empty Claude Code tab after polling works is not addressed here — it was never reproduced from code (network, JSON decode, SwiftUI observation, and tool attribution were all ruled out) and needs live macOS observation to diagnose.

Validation

This is a macOS-only SwiftUI/AppKit menu bar app (MenuBarExtra, .menuBarExtraStyle(.window)); it cannot be built or run on the Linux CI/dev box (no Swift/Xcode toolchain). The change matches the diagnosis and fix in issue #32, whose author verified on macOS: before fix 0 network requests from the process; after fix 12 successful HTTP 200 gateway responses in 30s.

Link to Devin session: https://app.devin.ai/sessions/77a9c75c205e4dbba85ee512c814bbe4
Requested by: @ishaan-berri

…arExtra label .onAppear

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>
@ishaan-berri ishaan-berri self-assigned this Jul 15, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

…an't read usage (#34)

* fix(RelayBarGlass): surface load/error states instead of a silent empty card

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>

* feat(setup): warn at sign-in when relay key can't read usage

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.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.

1 participant