Source Code & Repository Agent
Overview
The Source Code & Repository Agent connects OpsWorker to your code. It correlates recent commits, pull requests, and file changes with infrastructure incidents to identify whether a code or configuration change caused an issue, and when appropriate it can propose a fix by opening a pull request (GitHub) or merge request (GitLab).
Unlike the Kubernetes cluster tooling, which is strictly read-only, this agent has a controlled write path: it can create branches and open PRs/MRs (and technically merge). Every change is PR-based and human-reviewed; OpsWorker does not push directly to your default branch and does not run background PR jobs.
Requirements
- GitHub or GitLab integration configured for the cluster
- The agent activates when the
sourcecontrolcapability is present, which is satisfied by a configured GitHub OR GitLab integration - See GitHub Integration or GitLab Integration
If neither integration is connected, the agent is shown as unavailable with its missing capabilities listed.
Capabilities
Read
| Capability | Description |
|---|---|
| List recent commits | View commits in a repository, filtered by time range or branch |
| View PR/MR details | See pull request descriptions, changes, and merge status |
| File blame | Identify who last changed a specific file or line |
| Compare branches | See differences between branches |
| View file contents | Read specific files from the repository |
Write (PR/MR based, human-reviewed)
| Capability | Description |
|---|---|
| Create branch | Create a working branch for a proposed fix |
| Open PR / MR | Open a pull request (GitHub) or merge request (GitLab) with the change |
| Merge | Technically supported, but changes are intended for human review and approval |
A PR/MR exists only when a tool call actually returned a live URL during the session. There are no background or asynchronous PR jobs: if you did not see a returned URL, no PR/MR was created.
Use Cases
Change Correlation
During an investigation, the agent identifies deployments and code changes that occurred around the time the alert fired:
- "A Kubernetes manifest change was merged 15 minutes before the alert: deployment resource limits were reduced from 512Mi to 256Mi"
- "A new application version was deployed 30 minutes ago, here are the relevant code changes"
Interactive Queries
In free-form AI Chat, you can ask the agent directly:
What PRs were merged in the last 24 hours?
Who changed the deployment config for api-gateway recently?
Show me the commit that last modified deployment.yaml
Proposing a Fix
When the root cause is traced to a specific code or configuration change, the agent can open a PR/MR with the proposed fix for your team to review. See PR Creation.
Next Steps
- GitHub Integration: connect GitHub
- GitLab Integration: connect GitLab
- PR Creation: how OpsWorker opens pull and merge requests