Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
show a comment count on each row in an app's Issues tab
Adam Eivy614cceaeb169
diff --git a/client/src/components/apps/tabs/IssuesTab.jsx b/client/src/components/apps/tabs/IssuesTab.jsxindex 71956ecea5..281793d892 100644--- a/client/src/components/apps/tabs/IssuesTab.jsx+++ b/client/src/components/apps/tabs/IssuesTab.jsx@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback, useMemo, useId, useRef } from 'react'import { Link } from 'react-router';import {AlertTriangle, Bot, ChevronDown, ChevronRight, CircleDot, ClipboardCheck,- ExternalLink, Loader2, RefreshCw, Rocket, Search, Tag, User+ ExternalLink, Loader2, MessageSquare, RefreshCw, Rocket, Search, Tag, User} from 'lucide-react';import BrailleSpinner from '../../BrailleSpinner';import Banner from '../../ui/Banner';@@ -676,6 +676,15 @@ export default function IssuesTab({ appId, appName }) {{issue.author && <span>opened by {issue.author}</span>}{issue.updatedAt && <span>updated {timeAgo(issue.updatedAt)}</span>}{issue.milestone && <span className="text-cyan-400">{issue.milestone}</span>}+ {issue.commentCount > 0 && (+ <span+ className="flex items-center gap-1"+ title={`${issue.commentCount} comment${issue.commentCount === 1 ? '' : 's'}`}+ >+ <MessageSquare size={12} />+ {issue.commentCount}+ </span>+ )}{issue.assignees.length > 0 ? (<span className="flex items-center gap-1 text-gray-300"><User size={12} /> {issue.assignees.join(', ')}diff --git a/client/src/components/apps/tabs/IssuesTab.test.jsx b/client/src/components/apps/tabs/IssuesTab.test.jsxindex 668bd39b16..6904fa97bf 100644--- a/client/src/components/apps/tabs/IssuesTab.test.jsx+++ b/client/src/components/apps/tabs/IssuesTab.test.jsx@@ -131,6 +131,22 @@ describe('IssuesTab', () => {expect(chip.className).toContain('text-gray-300');});+ it('shows a comment count only for issues that have comments', async () => {+ api.getAppIssues.mockResolvedValue(okPayload([+ { ...ISSUE, number: 42, title: 'Crash on save', commentCount: 3 },+ { ...ISSUE, number: 43, title: 'Add CSV export', commentCount: 1 },+ { ...ISSUE, number: 44, title: 'Untouched', commentCount: 0 },+ ]));+ await renderTab();++ await screen.findByText('Crash on save');+ // Titled, so the bare digit is never the only thing a screen reader gets —+ // and so the assertion can't collide with the issue number or a label count.+ expect(screen.getByTitle('3 comments')).toHaveTextContent('3');+ expect(screen.getByTitle('1 comment')).toHaveTextContent('1');+ expect(screen.queryByTitle('0 comments')).not.toBeInTheDocument();+ });+it('keeps the description collapsed until the user expands it', async () => {await renderTab();diff --git a/server/services/appIssues.js b/server/services/appIssues.jsindex 46435bb033..ff9dd3aead 100644--- a/server/services/appIssues.js+++ b/server/services/appIssues.js@@ -44,6 +44,10 @@ const truncateBody = (body) => {/*** Normalize a raw `gh issue list --json` row into the common issue shape.* GitHub labels carry a hex `color` with no `#`; the UI needs it prefixed.+ *+ * `gh` has no scalar comment-count field — its `comments` field is the full+ * comment array — so the count is derived here and the bodies are dropped+ * rather than shipped to a UI that only renders a number.*/function normalizeGithubIssue(issue) {return {@@ -64,6 +68,7 @@ function normalizeGithubIssue(issue) {author: issue.author?.login || null,milestone: issue.milestone?.title || null,updatedAt: issue.updatedAt || null,+ commentCount: Array.isArray(issue.comments) ? issue.comments.length : 0,};}@@ -72,7 +77,8 @@ function normalizeGithubIssue(issue) {* `iid` and assignees/author on `username`. Labels are plain strings on current* `glab`, but the object form is tolerated too — the JSON label shape has varied* across glab versions, and a silently-dropped label list is worse than an- * unused branch.+ * unused branch. GitLab counts discussion in `user_notes_count` (system notes+ * excluded), which is already the scalar the UI wants.*/function normalizeGitlabIssue(issue) {return {@@ -92,6 +98,7 @@ function normalizeGitlabIssue(issue) {author: issue.author?.username || null,milestone: issue.milestone?.title || null,updatedAt: issue.updated_at || null,+ commentCount: Number.isFinite(issue.user_notes_count) ? issue.user_notes_count : 0,};}@@ -120,7 +127,7 @@ async function fetchGithubIssues(repoSpec, apiHost) {const raw = await execGh(['issue', 'list', '--repo', repoSpec, '--state', 'open','--limit', String(GH_LIST_LIMIT),- '--json', 'number,title,body,labels,assignees,author,milestone,url,updatedAt',+ '--json', 'number,title,body,labels,assignees,author,milestone,url,updatedAt,comments',]).catch((err) => {console.error(`❌ app-issues: gh issue list failed for ${repoSpec}: ${err.message}`);return null;diff --git a/server/services/appIssues.test.js b/server/services/appIssues.test.jsindex daadf74d23..d5f6995ce0 100644--- a/server/services/appIssues.test.js+++ b/server/services/appIssues.test.js@@ -54,6 +54,7 @@ describe('listAppIssues — GitHub', () => {milestone: { title: 'v2' },createdAt: '2026-01-01T00:00:00Z',updatedAt: '2026-01-02T00:00:00Z',+ comments: [{ body: 'me too' }, { body: 'on it' }],}]));const result = await listAppIssues(APP);@@ -72,6 +73,7 @@ describe('listAppIssues — GitHub', () => {author: 'carol',milestone: 'v2',updatedAt: '2026-01-02T00:00:00Z',+ commentCount: 2,}]);});@@ -92,6 +94,20 @@ describe('listAppIssues — GitHub', () => {expect(argv[argv.indexOf('--state') + 1]).toBe('open');});+ it('asks gh for comments and ships only the count — gh has no scalar count field', async () => {+ execGh.mockResolvedValue(JSON.stringify([+ { number: 1, title: 'discussed', labels: [], assignees: [], comments: [{ body: 'a novel-length reply' }] },+ { number: 2, title: 'quiet', labels: [], assignees: [], comments: [] },+ { number: 3, title: 'field absent', labels: [], assignees: [] },+ ]));+ const result = await listAppIssues(APP);+ const argv = execGh.mock.calls[0][0];+ expect(argv[argv.indexOf('--json') + 1].split(',')).toContain('comments');+ expect(result.issues.map(i => i.commentCount)).toEqual([1, 0, 0]);+ // The bodies stay on the server — the tab renders a number, not a thread.+ expect(result.issues[0].comments).toBeUndefined();+ });+it('an ANSWERED empty list is a definitive "no open issues", not a transient', async () => {execGh.mockResolvedValue('[]');const result = await listAppIssues(APP);@@ -143,6 +159,7 @@ describe('listAppIssues — GitLab', () => {milestone: { title: 'Sprint 3' },created_at: '2026-02-01T00:00:00Z',updated_at: '2026-02-02T00:00:00Z',+ user_notes_count: 4,}] });const result = await listAppIssues(APP);@@ -155,6 +172,7 @@ describe('listAppIssues — GitLab', () => {assignees: ['dana'],author: 'erin',milestone: 'Sprint 3',+ commentCount: 4,});expect(result.issues[0].labels).toEqual([{ name: 'feature', color: null, description: '' },@@ -166,6 +184,13 @@ describe('listAppIssues — GitLab', () => {expect(execGlabJson.mock.calls[0][0]).toEqual(['issue', 'list', '--per-page', '100']);});+ it('an older glab that omits user_notes_count reports 0 comments, never NaN', async () => {+ useGitlabOrigin();+ execGlabJson.mockResolvedValue({ reason: 'ok', rows: [{ iid: 8, title: 'no count field', labels: [], assignees: [] }] });+ const result = await listAppIssues(APP);+ expect(result.issues[0].commentCount).toBe(0);+ });+it('a failed glab call (CLI missing / unauthenticated / timed out) is transient', async () => {useGitlabOrigin();execGlabJson.mockResolvedValue({ rows: null, reason: 'cli-failed' });