-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Task 0.3.2: Agent Code Context Injection
Title: Include relevant code changes in agent prompts
Description:
When generating hypotheses, the agent should have access to recent code changes affecting the investigated asset. The hypothesis prompt should include a "Recent Changes" section with commit summaries.
Why: An agent investigating "why did nulls spike?" needs to know "yesterday's deploy added a LEFT JOIN that produces nulls for unmatched rows."
Acceptance Criteria:
- Hypothesis generation prompt includes code changes section
- Changes filtered to: last 14 days, affecting investigated asset or upstream
- Each change shows: commit hash, author, message, affected files, diff summary
- Maximum 5 most relevant changes included (sorted by recency × relevance)
- Agent can generate hypothesis category "code_change" with commit reference
- Evidence can link to specific commit: "Commit abc123 introduced LEFT JOIN"
- Final synthesis includes "Related Code Changes" section if relevant
Key Design Notes:
- Relevance scoring: exact asset match > upstream asset > path pattern match
- Diff summary: use LLM to summarize large diffs (separate prompt)
- Store commit reference in hypothesis metadata for linking
Key APIs:
- New internal function:
get_relevant_code_changes(asset_id, lookback_days) - Modify hypothesis prompt builder
Dependencies:
- Task 0.3.1 (git integration)
Risks + Mitigations:
- Risk: Too many changes overwhelm context → Mitigation: Strict relevance filtering, summarization
- Risk: False correlation (unrelated changes) → Mitigation: Agent trained to evaluate causality
Effort: M (4-5 days)
Designation: OSS
Task 0.3.3: PR/Commit Link in Investigation Output
Title: Deep link to source code in investigation results
Description:
When an investigation identifies a code change as the root cause, the output should include a direct link to the PR or commit in GitHub/GitLab/Bitbucket.
Why: "The root cause was commit abc123" is good. A clickable link to the PR with context is better.
Acceptance Criteria:
- Investigation synthesis includes links to relevant commits
- Links formatted for web (https://github.com/...) and CLI (commit hash + URL)
- PR link preferred over commit link when available
- Link appears in: CLI output, notebook output, markdown export, API response
- Metadata includes: PR number, PR title, PR author, merge date
- Support for GitHub, GitLab, Bitbucket URL formats
Key Design Notes:
- Store PR metadata during git sync (requires GitHub API calls)
- URL templates per provider
Key APIs:
- Extend
code_changestable withpr_number,pr_url,pr_title - Modify investigation response schema
Dependencies:
- Task 0.3.1, 0.3.2
Risks + Mitigations:
- Risk: PR lookup adds latency → Mitigation: Async enrichment during sync
Effort: S (2 days)
Designation: OSS