Conversation
Greptile SummaryThis PR extends the workbench AI feature with several improvements: adds built-in Plural observability tools (log querying, log aggregation, log facets, Prometheus metrics), adds Kubernetes tools (kube_get, kube_list) and service/stack file extraction tools to the infrastructure subagent, introduces a Key changes:
Confidence Score: 4/5Mostly safe to merge; one definite P1 logic bug in plrl_logs.ex causes all log tool queries to ignore user-supplied time ranges, always using a 30-minute default. The to_time/1 bug in plrl_logs.ex is a confirmed present defect — the pattern match is on the wrong struct type, so time ranges are silently dropped for all three Plrl log tools. The Plrl.Metrics arity inconsistency is P2 since it may work fine if dispatched as a plain module atom. All other changes are clean. lib/console/ai/tools/workbench/observability/plrl_logs.ex (to_time bug), lib/console/ai/tools/workbench/observability/plrl_metrics.ex (arity inconsistency)
|
| Filename | Overview |
|---|---|
| lib/console/ai/tools/workbench/observability/plrl_logs.ex | New Plural-native log query tool; to_time/1 pattern-matches on %MODULE{} (parent Logs struct) instead of the embedded TimeRange value, so user-provided time ranges are always silently ignored |
| lib/console/ai/tools/workbench/observability/plrl_metrics.ex | New Prometheus metrics wrapper; uses 0-arity callbacks inconsistently with other new Plrl tools that use 1-arity dispatch arguments |
| lib/console/ai/tools/workbench/infrastructure/service_files.ex | New tool to extract files for a Plural service using ServiceFixer; authorization chain intact |
| lib/console/ai/tools/workbench/infrastructure/stack_files.ex | New tool to extract terraform files for a stack using EEx template rendering; authorization chain intact |
| lib/console/ai/tools/workbench/infrastructure/kube_get.ex | New tool to fetch a K8s resource via Kazan; secrets blacklisted; user passed for RBAC via control_plane/2 |
| lib/console/ai/tools/workbench/infrastructure/kube_list.ex | New tool to list K8s resources; delegates kube_request/3 to KubeGet; same secrets blacklist |
| lib/console/ai/workbench/subagents/infrastructure.ex | Adds ServiceFiles, StackFiles, KubeGet, KubeList to infrastructure subagent; passes user to k8s_tools for embedded RBAC |
| lib/console/ai/tools/workbench/observability/plrl_logs_aggregate.ex | New log aggregation count tool; reuses plrl_logs.json schema; delegates query building to Logs module |
| lib/console/ai/tools/workbench/observability/plrl_logs_labels.ex | New log facets/labels tool with extra field parameter for field-specific filtering |
| lib/console/ai/workbench/subagents/observability.ex | Adds Plrl log/metric tools to observability subagent; fixes obs_tools filter to exclude MCP tools by tool type |
| lib/console/ai/tools/workbench/coding_agent.ex | Adds workbench config validation for read-only mode and repo allowlist; switches to 2-arg callback pattern |
| lib/console/deployments/workbenches.ex | Adds WorkbenchPrompt CRUD; stores user_id on WorkbenchCron; fixes update_workbench_cron ordering |
| lib/console/schema/workbench_prompt.ex | New schema for saved workbench prompts with binary prompt field and workbench FK |
| lib/console/schema/workbench_cron.ex | Adds user_id FK to WorkbenchCron; updates default preloads to include :user |
| lib/console/graphql/deployments/workbench.ex | GraphQL types and mutations for WorkbenchPrompt CRUD with read-access scope |
| lib/console/graphql/resolvers/deployments/workbench.ex | Resolvers for WorkbenchPrompt list, create, update, and delete delegating to Workbenches context |
| lib/console/deployments/policies/rbac.ex | Adds RBAC evaluation and preload support for WorkbenchPrompt delegating to parent workbench |
| priv/repo/migrations/20260405194233_add_workbench_prompts.exs | Migration adding workbench_prompts table and nullable user_id FK to workbench_crons |
| lib/console/pipelines/ai/workbench_cron/pipeline.ex | Cron pipeline now uses stored user (with groups preloaded) instead of admin bot user for job creation |
| lib/console/graphql/introspection.ex | New Absinthe plugin blocking schema introspection for unauthenticated requests in production |
| lib/console/ai/mcp/client.ex | Adds LegacyClient for older SSE MCP protocol version (2024-11-05) |
| lib/console/ai/provider/base.ex | Defensive JSON decode for tool call arguments replacing the crashing JSON.decode! |
| lib/console/deployments/pubsub/recurse.ex | Adds missing fallthrough clause for non-user WorkbenchJobActivityCreated events |
Reviews (3): Last reviewed commit: "add built-in plural observability tools" | Re-trigger Greptile
232beb6 to
c276389
Compare
c35bc67 to
9817662
Compare
8ca86df to
d189ed4
Compare
d189ed4 to
300def0
Compare
fafcab8 to
882675b
Compare
Forgot to add tool calls to extract files for services+stacks
0101c97 to
c4a758a
Compare
c4a758a to
c4e1b92
Compare
6e8d1e5 to
5081af3
Compare
Forgot to add tool calls to extract files for services+stacks
Test Plan
n/a
Checklist
Plural Flow: console