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:
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:
Key Design Notes:
- Store PR metadata during git sync (requires GitHub API calls)
- URL templates per provider
Key APIs:
- Extend
code_changes table with pr_number, pr_url, pr_title
- Modify investigation response schema
Dependencies:
Risks + Mitigations:
- Risk: PR lookup adds latency → Mitigation: Async enrichment during sync
Effort: S (2 days)
Designation: OSS
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:
Key Design Notes:
Key APIs:
get_relevant_code_changes(asset_id, lookback_days)Dependencies:
Risks + Mitigations:
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:
Key Design Notes:
Key APIs:
code_changestable withpr_number,pr_url,pr_titleDependencies:
Risks + Mitigations:
Effort: S (2 days)
Designation: OSS