feat: agent health scores — per-agent sub-metric badges#27
Merged
Conversation
… card modal - MeetingView: always build the card description from all concluded agent messages (writer, researcher, coder, senior-coder, tester) rather than using only the tester output and falling back to everyone else - TaskDetailModal: fetch project tags on open and replace the freetext input+Add button with a <select> dropdown; only unassigned project tags are shown; selected tag is appended and removed from the dropdown; existing tag pills now use the project tag's hex color when available Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add AgentHealthMetrics interface and extend StreamPayload with agentHealth map - Add dbGetTaskRunsByAgent / dbGetRecentTaskRunsByAgent repo functions - Implement computeHealthMetrics() in lib/health.ts (completion rate, throughput trend, error density, idle time with 7-day rolling window) - Add TTL-based in-process cache in lib/health-cache.ts (30-second default TTL) - Integrate health computation into getStreamPayload() in lib/store.ts - Add AgentHealthBadge component (four-dot compact indicator) - Wire badge into AgentRow and Health column header into AgentList - 17 new unit tests covering health computation and cache behavior Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
taskRunshistory with zero new DB tables or API routesArchitecture
lib/health.ts— purecomputeHealthMetrics(taskRuns, now?)function; injectablenowmakes every calculation fully testable without mockingDate.now(). Uses a 7-day rolling window (ROLLING_WINDOW_MS), aMIN_RUNS_THRESHOLD = 5sparse-data guard, and simple linear regression for week-over-week throughput trend.lib/health-cache.ts— module-levelMapsingleton (same pattern asbroadcast.ts) with configurable TTL. Health metrics are never computed inside the SSE hot path —getStreamPayload()serves cached values and only recomputes on cache miss or expiry.components/AgentHealthBadge.tsx— four coloured dots (C = Completion, T = Trend, E = Errors, I = Idle) with threshold-based green/yellow/red colouring and a hover tooltip showing actual values. Renders nothing on missing metrics; shows "Gathering data…" whenhasEnoughDatais false.Failure mode handling
agentHealth?.[agent.id]returnsundefined→ badge renders nothingagentHealthfield in older payload →StreamPayload.agentHealthis optional — existing clients degrade gracefullyFiles changed
lib/types.tsAgentHealthMetricsinterface; extendStreamPayload.agentHealth?lib/db/repositories/taskRunRepo.tsdbGetTaskRunsByAgent+dbGetRecentTaskRunsByAgentlib/health.tslib/health-cache.tslib/store.tsgetStreamPayload()components/AgentHealthBadge.tsxcomponents/AgentRow.tsxcomponents/AgentList.tsx__tests__/unit/health.test.tsnow)__tests__/unit/health-cache.test.tsTest plan
npm run test:run— all 156 tests passCompletion: X% · Trend: ±Y tasks/wk · Errors: Z% · Idle: NmagentHealthmap; older clients without field ignore it gracefully🤖 Generated with Claude Code