Skip to content

Commit 982e595

Browse files
author
Gavin Williams
committed
Address some more Coderabbit suggestions
1 parent 106fc14 commit 982e595

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

docs/docs/features/agents/review-agent.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ You can also trigger a review manually by commenting `/review` on any PR or MR.
139139

140140
# Agent configs
141141

142-
Agent configs let you customise how the review agent behaves per repository, connection, or your whole org. You can override the model, review command, auto-review behaviour, custom prompt, and context files all without changing environment variables.
142+
Agent configs let you customise how the review agent behaves per repository, connection, or your whole org. You can override the model, review command, auto-review behaviour, custom prompt, and context files, all without changing environment variables.
143143

144144
Configs are managed on the **Agents** page in the Sourcebot UI. Each config has a **scope**:
145145

@@ -153,20 +153,20 @@ When a PR or MR arrives, Sourcebot selects the most specific matching config. If
153153

154154
Each config can include a custom prompt. Two modes are available:
155155

156-
- **Append** (default) your instructions are added after the built-in review rules.
157-
- **Replace** your instructions entirely replace the built-in rules. Use this when you want full control over what the agent looks for.
156+
- **Append** (default): your instructions are added after the built-in review rules.
157+
- **Replace**: your instructions entirely replace the built-in rules. Use this when you want full control over what the agent looks for.
158158

159159
## Context files
160160

161-
You can configure one or more repository files to be fetched at review time and injected as additional context for the model. This is useful for encoding project-specific conventions that the model should be aware of when reviewing diffs for example, preferred error handling patterns, style rules, or areas of the codebase that need extra scrutiny.
161+
You can configure one or more repository files to be fetched at review time and injected as additional context for the model. This is useful for encoding project-specific conventions that the model should be aware of when reviewing diffs (for example, preferred error handling patterns, style rules, or areas of the codebase that need extra scrutiny).
162162

163163
Set **Context files** in the agent config form to a comma or space separated list of paths relative to the repository root (e.g. `AGENTS.md .sourcebot/review.md`). Files that do not exist in the repository are silently ignored. The files are fetched once per PR from the head commit and included in the context for every diff hunk.
164164

165165
# Environment variable reference
166166

167167
| Variable | Default | Description |
168168
|---|---|---|
169-
| `REVIEW_AGENT_AUTO_REVIEW_ENABLED` | `false` | Automatically review new and updated PRs/MRs. Can be overridden per agent config. |
170-
| `REVIEW_AGENT_REVIEW_COMMAND` | `review` | Comment command that triggers a manual review (without the `/`). Can be overridden per agent config. |
171-
| `REVIEW_AGENT_MODEL` | first configured model | `displayName` of the language model to use for reviews. Can be overridden per agent config. |
169+
| `REVIEW_AGENT_AUTO_REVIEW_ENABLED` | `false` | Automatically review new and updated PRs/MRs. You can override this in an agent config. |
170+
| `REVIEW_AGENT_REVIEW_COMMAND` | `review` | Comment command that triggers a manual review (without the `/`). You can override this in an agent config. |
171+
| `REVIEW_AGENT_MODEL` | first configured model | `displayName` of the language model to use for reviews. You can override this in an agent config. |
172172
| `REVIEW_AGENT_LOGGING_ENABLED` | unset | Write prompt and response logs to disk for debugging. |

packages/db/prisma/migrations/20260421203635_add_agent_config/migration.sql renamed to packages/db/prisma/migrations/20260422071731_add_agent_config/migration.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ CREATE INDEX "AgentConfig_orgId_type_enabled_idx" ON "AgentConfig"("orgId", "typ
4747
-- CreateIndex
4848
CREATE UNIQUE INDEX "AgentConfig_orgId_name_key" ON "AgentConfig"("orgId", "name");
4949

50+
-- CreateIndex
51+
CREATE INDEX "AgentConfigToRepo_repoId_idx" ON "AgentConfigToRepo"("repoId");
52+
53+
-- CreateIndex
54+
CREATE INDEX "AgentConfigToConnection_connectionId_idx" ON "AgentConfigToConnection"("connectionId");
55+
5056
-- AddForeignKey
5157
ALTER TABLE "AgentConfig" ADD CONSTRAINT "AgentConfig_orgId_fkey" FOREIGN KEY ("orgId") REFERENCES "Org"("id") ON DELETE CASCADE ON UPDATE CASCADE;
5258

packages/db/prisma/schema.prisma

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ model AgentConfigToRepo {
646646
repoId Int
647647
648648
@@id([agentConfigId, repoId])
649+
@@index([repoId])
649650
}
650651

651652
/// Maps an AgentConfig to specific connections (used when scope = CONNECTION).
@@ -657,4 +658,5 @@ model AgentConfigToConnection {
657658
connectionId Int
658659
659660
@@id([agentConfigId, connectionId])
661+
@@index([connectionId])
660662
}

packages/web/src/features/agents/review-agent/app.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,14 @@ describe('parseAgentConfigSettings', () => {
5353
autoReviewEnabled: false,
5454
reviewCommand: 'check',
5555
model: 'claude-sonnet-4-6',
56+
contextFiles: 'AGENTS.md .sourcebot/review.md',
5657
});
5758

5859
expect(result).toEqual({
5960
autoReviewEnabled: false,
6061
reviewCommand: 'check',
6162
model: 'claude-sonnet-4-6',
63+
contextFiles: 'AGENTS.md .sourcebot/review.md',
6264
});
6365
});
6466

0 commit comments

Comments
 (0)