Skip to content

Issue Workspace – AI & Automations Tab

The AI & Automations tab unifies every machine-assisted signal that touches an issue. It combines Developer Aide responses, workflow risk telemetry, and the automation execution log so teams can review context, run AI follow-ups, and audit extensions without jumping between surfaces.

Panel layout

Section Purpose Data source
Developer Aide Runs bug analysis, test scaffolding, and estimation actions directly against the issue. DeveloperAideOutput records (latest 10) + inline action launcher partial (issues/developer_aide_actions).
Risk & Insight Feed Streams Risk Scanner alerts, usage policy warnings, and future approval guardrails into a single grid. RiskAlert / UsagePolicyStatus entries scoped to the issue’s project + upcoming workflow guard metadata.
Automation Log Shows extension dispatches, workflow recipes, and webhook callbacks tied to the issue. ExtensionEvent rows where payload.issue.id == issue.id.

All three sections are rendered by issues/show/_ai_automations.html.erb and refreshed live through Issues::BroadcastService.broadcast_ai_outputs.

Developer Aide block

  1. Actions – The issues/developer_aide_actions partial wires buttons to the Developer Aide queue (Projects::DeveloperAideController). Usage is gated by UsageFeatureGate :developer_aide_suite; super users bypass the gate automatically.
  2. OutputsIssue#developer_aide_outputs.active.recent_first.limit(10) populate the card stack. New outputs should call Issues::BroadcastService.broadcast_ai_outputs(issue) so the tab updates via ActionCable without a full refresh.

Risk & Insight feed

The grid is intentionally simple HTML so product squads can swap cards without touching JS:

  • Risk monitoring – Surface RiskAlert headlines related to the issue’s project. When Risk Scanner raises or updates an alert, enqueue Issues::BroadcastService.broadcast_ai_outputs(issue).
  • Usage/Automation notices – Policy evaluators (e.g., UsagePolicyEvaluator, UsagePolicyEnforcer) can push capacity warnings or sandbox-only notices into the feed by writing a presenter that returns :warning / :info cards.
  • Future guardrails – When workflow approvals or automation guard responses include “action required” metadata, persist it in the WorkflowApproval record. The card can then highlight the reminder while the main approvals list (in the Activity tab) handles actuation.

Because the feed is just ERB, hooking in new cards only requires a query + partial fragment. Keep each card self-contained so ActionCable updates remain light.

Automation log

The automation log is both:

  1. Remotely loaded: when the AI tab is opened, the Stimulus issue-page controller fetches automation_log_issue_path(issue, automation_page: N) and swaps the HTML fragment into place. Server-side pagination comes from Kaminari metadata on ExtensionEvent.
  2. Real-time aware: when Issues::BroadcastService.broadcast_automation_log runs, IssueUpdatesChannel emits an automation_log_refresh payload that replaces the section without reloading the tab.

Important: extension deliveries must include the canonical issue.id in the payload (payload: { issue: { id: issue.id, ... } }). The automation scope filters on that JSON path using PostgreSQL JSON operators.

Remote panel wiring

The issue-page Stimulus controller automatically hydrates sections with a data-remote-src attribute the first time their parent tab becomes active. Three controllers ship out of the box:

Route helper Partial Purpose
timeline_issue_path issues/show/_activity_timeline Activity tab stream
automation_log_issue_path issues/show/_automation_log AI tab automation log
workflow_approvals_panel_issue_path issues/show/_workflow_approvals Activity tab approvals list

Specs under spec/requests/issue_workspace_remote_spec.rb exercise these endpoints so regressions in pagination/filtering are caught early. When adding a new remote section, follow the same pattern: expose a controller action that renders the partial, add a data-remote-src attribute, and update the request spec.

Live updates & broadcasts

IssueUpdatesChannel keeps the tab fresh without polling:

  • Issues::BroadcastService.broadcast_ai_outputs(issue) re-renders the entire AI panel (Developer Aide + risk feed + automation log preview).
  • Issues::BroadcastService.broadcast_automation_log(issue) targets only the log table to avoid re-querying Developer Aide outputs.
  • Workflow approvals, activity, and comments trigger their own events so tab badges can light up when updates land off-screen.

Client-side, issue_page_controller.ts listens for events like ai_refresh, workflow_approvals_refresh, and automation_log_refresh. If a tab isn’t active, the controller badges it with a subtle dot until the user opens it.

Implementer checklist

  1. Emit issue-aware events – Extension runtimes and inline workflow actions should always embed payload.issue.id so the automation filter can match.
  2. Broadcast after writes – Anytime you add Developer Aide outputs, risk alerts, or automation events for an issue, call the relevant Issues::BroadcastService helper so ActionCable consumers update in real time.
  3. Guard access – Feature gates (UsageFeatureGate) and plan limits (UsagePolicyEnforcer) already understand super-admin bypasses. Use the same helpers if you add new AI/automation actions so the UI stays consistent.
  4. Document integrations – When shipping new cards in the Risk & Insight feed or new automation event types, update this guide and the changelog so customers know how to light them up.

Following this contract keeps the AI & Automations tab authoritative: every feed is either lazy-loaded with pagination or refreshed through ActionCable, and teams can always trace AI actions back to their automation sources.