Skip to content

feat(gastown): add agent status bubble UI and gt_status tool#999

Merged
jrf0110 merged 9 commits intomainfrom
agent-status-bubbles
Mar 11, 2026
Merged

feat(gastown): add agent status bubble UI and gt_status tool#999
jrf0110 merged 9 commits intomainfrom
agent-status-bubbles

Conversation

@jrf0110
Copy link
Contributor

@jrf0110 jrf0110 commented Mar 10, 2026

Summary

  • Adds a gt_status tool that lets agents emit plain-language status updates (e.g. "Installing dependencies", "Writing tests") visible on the dashboard in real time.
  • Backend: new agent_status_message / agent_status_updated_at columns on agent_metadata, POST /agents/:agentId/status endpoint, agent_status bead event type, and WebSocket broadcast from TownDO so dashboard clients see updates immediately.
  • Frontend: status bubbles rendered across all agent surfaces — AgentCard, AgentPanel drawer, TownOverviewPageClient recent agents, and AgentsPageClient grid. Bubbles fade in/out with motion/react, grey out when stale (>10 min), and truncate at 80 chars. agent_status events in the activity feed show agent name and message, and clicking them opens the agent drawer.
  • WebSocket agent_status events trigger listAgents query invalidation so agent cards refresh without waiting for the 5s poll cycle.

Verification

  • Reviewed all 18 changed files for consistency of the new fields across DB schema, types, Zod schemas, tRPC output, and router.d.ts.
  • Verified gt_status tool wiring from container plugin through HTTP handler to TownDO storage and WebSocket broadcast.

Visual Changes

image image image

Reviewer Notes

  • The gt_status tool prompt instructs agents to only call it at meaningful phase transitions, not on every tool use, to avoid noise.
  • Stale detection (>10 min) is client-side only — no server-side TTL or cleanup.
  • The router.d.ts diff includes an unrelated whitespace change on the listAgents line — this came in with the original commits.

@jrf0110 jrf0110 force-pushed the agent-status-bubbles branch 2 times, most recently from 04b8d04 to 88bc44f Compare March 10, 2026 20:22
@jrf0110 jrf0110 changed the title refactor(gastown): replace per-agent JWTs with per-container JWTs feat(gastown): add agent status bubble UI and gt_status tool Mar 10, 2026
@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 10, 2026

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
cloudflare-gastown/src/handlers/rig-agents.handler.ts 37 Status update payloads are unbounded and are persisted plus broadcast
Other Observations (not in diff)

N/A

Files Reviewed (19 files)
  • cloudflare-gastown/container/plugin/client.ts - 0 issues
  • cloudflare-gastown/container/plugin/tools.ts - 0 issues
  • cloudflare-gastown/src/db/tables/agent-metadata.table.ts - 0 issues
  • cloudflare-gastown/src/db/tables/bead-events.table.ts - 0 issues
  • cloudflare-gastown/src/dos/Town.do.ts - 0 issues
  • cloudflare-gastown/src/dos/town/agents.ts - 0 issues
  • cloudflare-gastown/src/dos/town/beads.ts - 0 issues
  • cloudflare-gastown/src/gastown.worker.ts - 0 issues
  • cloudflare-gastown/src/handlers/rig-agents.handler.ts - 1 issue
  • cloudflare-gastown/src/prompts/polecat-system.prompt.ts - 0 issues
  • cloudflare-gastown/src/trpc/schemas.ts - 0 issues
  • cloudflare-gastown/src/types.ts - 0 issues
  • src/app/(app)/gastown/[townId]/TownOverviewPageClient.tsx - 0 issues
  • src/app/(app)/gastown/[townId]/agents/AgentsPageClient.tsx - 0 issues
  • src/components/gastown/ActivityFeed.tsx - 0 issues
  • src/components/gastown/AgentCard.tsx - 0 issues
  • src/components/gastown/TerminalBar.tsx - 0 issues
  • src/components/gastown/drawer-panels/AgentPanel.tsx - 0 issues
  • src/lib/gastown/types/router.d.ts - 0 issues

Reviewed by gpt-5.4-20260305 · 1,597,125 tokens

Toast (gastown) and others added 7 commits March 11, 2026 08:52
 backend)

- Add agent_status_message and agent_status_updated_at columns to agent_metadata table
- Add agent_status to BeadEventType enum
- Add updateAgentStatusMessage() DB helper and RPC method in Town.do.ts
- Emit agent_status bead event on the hooked bead when status is updated
- Add POST /agents/:agentId/status HTTP route and handler
- Add updateAgentStatusMessage() to GastownClient
- Add gt_status tool to polecat plugin tools
- Expose new fields in Agent type and AgentOutput Zod schema
- Add gt_status guidance section to polecat system prompt

Co-authored-by: John Fawcett <john@kilocode.ai>
…o frontend

- Add broadcastAgentStatus() to TownDO; call it in updateAgentStatusMessage()
  so connected dashboard clients receive a lightweight agent_status event
  immediately on every gt_status call
- Handle agent_status in useAlarmStatusWs (TerminalBar); dispatch to callback
  rather than overwriting the alarm snapshot; invalidate listAgents queries
  in AlarmStatusPane so agent cards refresh without waiting for the 5s poll
- Add agent_status to ActivityFeed EVENT_ICONS/EVENT_COLORS (MessageSquare,
  muted) and eventDescription() so the event renders in feed and bead timeline

Co-authored-by: John Fawcett <john@kilocode.ai>
- AgentCard: render speech-bubble below card when agent is working and
  has a status message; fades in/out with motion/react; greyed if stale
  (>10 min); truncates at 80 chars; shows relative timestamp
- AgentPanel drawer: add current status row below status badge with full
  message text and relative timestamp
- ActivityFeed: include agent name in agent_status event description
  (e.g. "Dusk: Running tests"); town feed agent_status clicks open the
  agent drawer instead of event drawer
- AgentsPageClient: status bubble on each agent card in the agents grid
- TownOverviewPageClient: status bubble on recent agents rows; agent_status
  feed events routed to agent detail drawer
- router.d.ts: add agent_status_message and agent_status_updated_at to
  listAgents output type

Co-authored-by: John Fawcett <john@kilocode.ai>
…on rehook

Address two review comments:
1. Resolve agent rig from agentsByRig map instead of relying on
   unpopulated rig_id field on bead_events rows, so clicking
   agent_status feed items opens the agent drawer.
2. Clear agent_status_message and agent_status_updated_at in hookBead()
   when an agent is recycled for a new bead, preventing stale status
   bubbles from the previous task.

Co-authored-by: John Fawcett <john@kilocode.ai>
Store agent_name, rig_id, and rig_name in the bead event metadata when
logging agent_status events. The activity feed now displays these as
'[RigName] AgentName: status message' instead of just the raw message.

Co-authored-by: John Fawcett <john@kilocode.ai>
…rmat branch

- Add migrateAgentMetadata() with ALTER TABLE statements for
  agent_status_message and agent_status_updated_at columns, wired
  into initBeadTables() so existing towns get the columns on next
  DO activation.
- Add agent_status case to formatEventMessage() in the alarm status
  pane so status updates render as 'agent <id>: <message>' instead
  of the generic fallback.
- Fix Prettier formatting in 5 frontend files.

Co-authored-by: John Fawcett <john@kilocode.ai>
…ypes

The generated router.d.ts was only partially updated — listAgents had the
new fields but getRig.agents and sling.agent still omitted them, causing
stale agent shapes for consumers derived from GastownOutputs.
@jrf0110 jrf0110 force-pushed the agent-status-bubbles branch from 3cb86ae to 398641c Compare March 11, 2026 13:52
jrf0110 and others added 2 commits March 11, 2026 09:43
- Add .trim().max(280) to UpdateAgentStatusMessageBody so runaway
  agents can't bloat storage or WebSocket payloads with oversized
  status updates.
- Fix double-encoded UTF-8 section divider (â→═) in Town.do.ts
  introduced by an earlier commit.

Co-authored-by: John Fawcett <john@kilocode.ai>
@jrf0110 jrf0110 enabled auto-merge (squash) March 11, 2026 14:45
@jrf0110 jrf0110 merged commit 9514080 into main Mar 11, 2026
17 of 18 checks passed
@jrf0110 jrf0110 deleted the agent-status-bubbles branch March 11, 2026 14:50
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