feat(insights): restore bounded investigation agent#566
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Unkey Deploy
|
Greptile SummaryThis PR replaces deterministic insight decisions with a bounded investigation agent. The main changes are:
Confidence Score: 4/5The production read-only investigation path can invoke live anomaly detection.
apps/insights/src/generation.ts
|
| Filename | Overview |
|---|---|
| apps/insights/src/agent.ts | Adds bounded candidate selection, evidence reads, and validated finding materialization. |
| apps/insights/src/generation.ts | Integrates the agent into generation, billing, persistence, and observation handling; the evidence-reader setup leaves live anomaly detection enabled. |
| packages/ai/src/ai/tools/insights-agent-tools.ts | Adds strict request schemas and signal-bound evidence reads. |
| packages/ai/src/ai/insights/ops-context.ts | Adds a live anomaly-detection switch that defaults to enabled. |
| packages/shared/src/insights.ts | Simplifies the needs-context decision shape. |
| packages/evals/src/insight-production-shadow.ts | Updates historical shadow evaluation to use the bounded agent and disables live anomaly detection there. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Detected regressions] --> B[Eligible candidate shortlist]
B --> C[Bounded investigation agent]
C --> D[Signal-scoped evidence reader]
D --> E[Validated decision]
E --> F[Persist insight and observation]
F --> G[Resolve prior insights and effects]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Detected regressions] --> B[Eligible candidate shortlist]
B --> C[Bounded investigation agent]
C --> D[Signal-scoped evidence reader]
D --> E[Validated decision]
E --> F[Persist insight and observation]
F --> G[Resolve prior insights and effects]
Reviews (1): Last reviewed commit: "feat(insights): restore bounded investig..." | Re-trigger Greptile
Summary
This supersedes the overengineered implementation approach in #565 without modifying or closing that PR.
Simplification
Evidence
Deliberate scope
AI disclosure
AI assistance was used. The implementation, tests, production-shadow output, and final diff were reviewed and verified by the maintainer.
Summary by cubic
Replaced the deterministic insights engine with a bounded investigation agent that triages up to five regressions, reads evidence, and returns grounded decisions under 100 words. Investigations are now time-scoped to each website’s timezone; usage is tracked and billed when configured; the UI says “What changed”, and the worker requires
AI_GATEWAY_API_KEY/AI_API_KEY.New Features
ai’sToolLoopAgent(max 5 steps, 2 tool calls, 120s, 100-word output).Migration
INSIGHTS_WORKER_ENABLED=true, setAI_GATEWAY_API_KEYorAI_API_KEY(added todocker-compose.selfhost.yml).whatChangedinstead ofwhyItMatters.Written for commit f398f6a. Summary will update on new commits.