Docs › Configuration reference

Configuration reference

Every parameter mrsentry accepts, generated from the code. Each key can be set in YAML, as an environment variable, or for many keys, as a CLI flag.

Where settings come from

From highest to lowest priority:

  1. CLI flags, e.g. --fail-on high or --model azure/gpt-4o.
  2. Environment variables named MRSENTRY_<SECTION>__<KEY> (double underscore between levels). Values are parsed as YAML, so MRSENTRY_REVIEW__EXCLUDE='["**/gen/**"]' and MRSENTRY_REVIEW__MAX_INLINE_COMMENTS=10 both work.
  3. The repository's .mrsentry.yml, restricted to the keys marked repo below.
  4. Org config from --config or MRSENTRY_CONFIG.
  5. Defaults.

In GitLab CI, CI_SERVER_URL, CI_PROJECT_ID and CI_MERGE_REQUEST_IID fill in gitlab.url, gitlab.project and gitlab.mr_iid automatically. The GitLab token is looked up in MRSENTRY_GITLAB_TOKEN, then the variable named in gitlab.token_env, then GITLAB_TOKEN.

Useful commands

mrsentry config init writes an annotated starter file. mrsentry config show prints the effective configuration with secrets redacted. mrsentry config validate checks it, including a repository's .mrsentry.yml with --repo-dir.

On this page: GitLab · LLM · Review · ECR · Fix · Output · General

GitLab gitlab.*

Where your GitLab is and how mrsentry authenticates to it.

KeyType / defaultDescription
gitlab.url
MRSENTRY_GITLAB__URL
str GitLab base URL, e.g. https://gitlab.example.com. Defaults to $CI_SERVER_URL.
gitlab.token
MRSENTRY_GITLAB__TOKEN
str Bot token (project/group access token or PAT) with api + write_repository. Prefer env MRSENTRY_GITLAB_TOKEN. CI_JOB_TOKEN cannot post notes.
gitlab.token_env
MRSENTRY_GITLAB__TOKEN_ENV
str Name of the env var holding the token, if your CI already uses its own (e.g. COMPANY_GITLAB_TOKEN). Default lookup: MRSENTRY_GITLAB_TOKEN, then GITLAB_TOKEN.
gitlab.verify_ssl
MRSENTRY_GITLAB__VERIFY_SSL
bool
true
Verify TLS certificates.
gitlab.ca_bundle
MRSENTRY_GITLAB__CA_BUNDLE
str Path to a custom CA bundle for self-managed GitLab.
gitlab.timeout_s
MRSENTRY_GITLAB__TIMEOUT_S
float
30.0
HTTP timeout in seconds.
gitlab.max_retries
MRSENTRY_GITLAB__MAX_RETRIES
int
4
Retries on 429/5xx with exponential backoff.
gitlab.project
MRSENTRY_GITLAB__PROJECT
str Project id or path (group/name). Defaults to $CI_PROJECT_ID.
gitlab.mr_iid
MRSENTRY_GITLAB__MR_IID
int
0
Merge request IID. Defaults to $CI_MERGE_REQUEST_IID.

LLM llm.*

Model profiles, which profile each task uses, fallbacks and spending limits.

KeyType / defaultDescription
llm.profiles
MRSENTRY_LLM__PROFILES
dict
{"default": {"model": "anthropic/claude-sonnet-4-5", "api_base": "", "api_key_env": "", "api_version": "", "aws_region": "", "temperature": 0.1, "max_tokens": 8192, "timeout_s": 180.0, "extra": {}}}
Named model profiles.
llm.roles.review
MRSENTRY_LLM__ROLES__REVIEW
str
"default"
Profile used for the main review pass.
llm.roles.summarize
MRSENTRY_LLM__ROLES__SUMMARIZE
str
"default"
Profile used for the critic/summarizer pass.
llm.roles.fix_repair
MRSENTRY_LLM__ROLES__FIX_REPAIR
str
"default"
Profile used for repairing builds broken by dependency bumps.
llm.fallbacks
MRSENTRY_LLM__FALLBACKS
list Profiles tried in order when a call fails.
llm.max_retries
MRSENTRY_LLM__MAX_RETRIES
int
3
Retries per call (rate limits, transient errors).
llm.max_cost_usd_per_run
MRSENTRY_LLM__MAX_COST_USD_PER_RUN
float
5.0
Abort further LLM calls once estimated cost exceeds this.
llm.input_token_budget
MRSENTRY_LLM__INPUT_TOKEN_BUDGET
int
600000
Total input-token budget for one review run.

Review review.*

What gets reviewed, how strict the reviewer is and how comments are posted.

KeyType / defaultDescription
review.enabled
MRSENTRY_REVIEW__ENABLED
bool
true
Run the AI code review step.
review.categories repo
MRSENTRY_REVIEW__CATEGORIES
list
["bug", "security", "performance", "reliability", "maintainability", "testing"]
Review categories the model may report.
review.min_severity repo
MRSENTRY_REVIEW__MIN_SEVERITY
Severity
"medium"
Lowest severity posted as an inline comment.
review.min_confidence repo
MRSENTRY_REVIEW__MIN_CONFIDENCE
float
0.6
Drop findings with model confidence below this (0-1).
review.max_inline_comments repo
MRSENTRY_REVIEW__MAX_INLINE_COMMENTS
int
25
Cap on inline comments per run (highest severity first).
review.include repo
MRSENTRY_REVIEW__INCLUDE
list
["**"]
Glob patterns of files to review.
review.exclude repo
MRSENTRY_REVIEW__EXCLUDE
list
["**/*.lock", "**/package-lock.json", "**/pnpm-lock.yaml", "**/yarn.lock", "**/*.min.js", "**/*.map", "**/dist/**", "**/build/**", "**/generated/**", "**/vendor/**", "**/*.snap", "**/*.svg", "**/*.png", "**/*.jpg"]
Glob patterns of files to skip.
review.max_file_diff_lines
MRSENTRY_REVIEW__MAX_FILE_DIFF_LINES
int
1500
Files with larger diffs are reviewed hunk-group by hunk-group.
review.unit_token_target
MRSENTRY_REVIEW__UNIT_TOKEN_TARGET
int
24000
Approximate input tokens per review unit (chunk size).
review.concurrency
MRSENTRY_REVIEW__CONCURRENCY
int
4
Parallel review units.
review.agent.enabled
MRSENTRY_REVIEW__AGENT__ENABLED
bool
true
Let the model call read-only repo tools to verify findings.
review.agent.max_steps
MRSENTRY_REVIEW__AGENT__MAX_STEPS
int
12
Max tool-calling rounds per review unit.
review.agent.tool_timeout_s
MRSENTRY_REVIEW__AGENT__TOOL_TIMEOUT_S
int
20
Timeout for a single tool call.
review.agent.max_tool_output_chars
MRSENTRY_REVIEW__AGENT__MAX_TOOL_OUTPUT_CHARS
int
20000
Truncate tool output beyond this many characters.
review.summarizer
MRSENTRY_REVIEW__SUMMARIZER
bool
true
Run a critic pass that removes noise and duplicates.
review.incremental
MRSENTRY_REVIEW__INCREMENTAL
bool
true
Skip files whose diff is identical to the last reviewed one.
review.suggestions repo
MRSENTRY_REVIEW__SUGGESTIONS
bool
true
Emit GitLab suggestion blocks when safe.
review.guidelines repo
MRSENTRY_REVIEW__GUIDELINES
list
["bundled:general", "bundled:java", "bundled:python", "bundled:typescript", "repo:.mrsentry/guidelines.yml"]
Guideline packs: bundled:<name>, repo:<path> or an absolute path.
review.extra_instructions repo
MRSENTRY_REVIEW__EXTRA_INSTRUCTIONS
str Free-text team instructions appended to the prompt.
review.language repo
MRSENTRY_REVIEW__LANGUAGE
str
"English"
Language used for comments.
review.skip_draft_mr repo
MRSENTRY_REVIEW__SKIP_DRAFT_MR
bool
false
Skip MRs marked Draft.
review.resolve_fixed
MRSENTRY_REVIEW__RESOLVE_FIXED
bool
true
Resolve bot threads whose finding no longer reproduces.
review.post_lgtm repo
MRSENTRY_REVIEW__POST_LGTM
bool
true
Post an overview note even when there are no findings.

ECR ecr.*

Which image to scan, which severities matter and what to do with stale results.

KeyType / defaultDescription
ecr.enabled
MRSENTRY_ECR__ENABLED
bool
true
Run the ECR vulnerability step when an image is given.
ecr.image
MRSENTRY_ECR__IMAGE
str ECR repository[:tag|@digest] or full URI <acct>.dkr.ecr.<region>.amazonaws.com/<repo>:<tag>.
ecr.region
MRSENTRY_ECR__REGION
str AWS region (falls back to AWS_REGION / default chain).
ecr.registry_id
MRSENTRY_ECR__REGISTRY_ID
str AWS account id of the registry (default: caller account).
ecr.tag_strategy
MRSENTRY_ECR__TAG_STRATEGY
Literal
"latest-pushed"
How to pick the image when no tag/digest is given.
ecr.tag_filter
MRSENTRY_ECR__TAG_FILTER
str Regex limiting candidate tags for latest-pushed/semver.
ecr.min_severity repo
MRSENTRY_ECR__MIN_SEVERITY
Severity
"high"
Lowest vulnerability severity to act on.
ecr.freshness_max_age
MRSENTRY_ECR__FRESHNESS_MAX_AGE
str
"24h"
Findings older than this are considered stale.
ecr.on_stale
MRSENTRY_ECR__ON_STALE
OnStale
"rescan"
rescan (BASIC only, then local), local (Trivy/Grype), warn, or fail when findings are stale or missing.
ecr.local_scanner
MRSENTRY_ECR__LOCAL_SCANNER
Literal
"trivy"
Scanner used for local fallback.
ecr.rescan_wait_s
MRSENTRY_ECR__RESCAN_WAIT_S
int
600
Max seconds to wait for a triggered StartImageScan.
ecr.include_os_packages repo
MRSENTRY_ECR__INCLUDE_OS_PACKAGES
Literal
"report"
OS/base-image packages are reported (with base image hint) or ignored.
ecr.ignore repo
MRSENTRY_ECR__IGNORE
list Accepted vulnerabilities.

Fix fix.*

How vulnerabilities are fixed, verified and delivered.

KeyType / defaultDescription
fix.enabled
MRSENTRY_FIX__ENABLED
bool
true
Allow the fix step.
fix.mode
MRSENTRY_FIX__MODE
Literal
"new-mr"
Open a new MR or push into the MR.
fix.target_branch
MRSENTRY_FIX__TARGET_BRANCH
str Base branch for new fix MRs (default: project default branch).
fix.branch_prefix
MRSENTRY_FIX__BRANCH_PREFIX
str
"mrsentry/vuln-fix"
Prefix for fix branches.
fix.strategy repo
MRSENTRY_FIX__STRATEGY
Literal
"prefer-direct-upgrade"
For transitive deps: try bumping the direct parent first, or pin.
fix.allow_major_upgrades repo
MRSENTRY_FIX__ALLOW_MAJOR_UPGRADES
bool
false
Allow fixes that cross a major version.
fix.verify
MRSENTRY_FIX__VERIFY
dict Verification command per ecosystem (maven, gradle, npm, yarn, pnpm, poetry, uv, pip). Empty = skip build.
fix.verify_timeout_s
MRSENTRY_FIX__VERIFY_TIMEOUT_S
int
1800
Timeout for each verify command.
fix.allow_llm_repair
MRSENTRY_FIX__ALLOW_LLM_REPAIR
bool
true
Let the LLM edit code when a bump breaks verification.
fix.max_repair_iterations
MRSENTRY_FIX__MAX_REPAIR_ITERATIONS
int
3
Max LLM repair rounds.
fix.shell_allowlist
MRSENTRY_FIX__SHELL_ALLOWLIST
list
["mvn", "./mvnw", "gradle", "./gradlew", "npm", "npx", "pnpm", "yarn", "node", "python", "python3", "pip", "poetry", "uv", "pytest", "tsc", "java", "javac"]
Executables the repair agent may run.
fix.build_env_passthrough
MRSENTRY_FIX__BUILD_ENV_PASSTHROUGH
list Env var names passed to build tools despite secret scrubbing (e.g. NEXUS_USER, NEXUS_PASSWORD, NPM_TOKEN used by settings.xml/.npmrc). GitLab/AWS/LLM creds never pass.
fix.draft_mr repo
MRSENTRY_FIX__DRAFT_MR
bool
false
Open fix MRs as Draft.
fix.labels repo
MRSENTRY_FIX__LABELS
list
["security", "mrsentry"]
Labels on fix MRs.
fix.commit_author_name
MRSENTRY_FIX__COMMIT_AUTHOR_NAME
str
"mrsentry-bot"
Git author name for fix commits.
fix.commit_author_email
MRSENTRY_FIX__COMMIT_AUTHOR_EMAIL
str
"mrsentry-bot@noreply.local"
Git author email.
fix.registry_mirrors
MRSENTRY_FIX__REGISTRY_MIRRORS
dict Registry base URLs per ecosystem (maven, npm, pypi) for upgrade lookups, e.g. Nexus/Artifactory.

Output output.*

Artifacts written for GitLab and for humans.

KeyType / defaultDescription
output.dir
MRSENTRY_OUTPUT__DIR
str
"mrsentry-out"
Directory for JSON/SARIF/CodeQuality/dotenv artifacts.
output.formats
MRSENTRY_OUTPUT__FORMATS
list
["json", "codequality", "dotenv", "markdown"]
Artifacts to write: json, markdown, sarif, codequality, dotenv.
output.save_llm_transcripts
MRSENTRY_OUTPUT__SAVE_LLM_TRANSCRIPTS
bool
false
Store every prompt/response for audit (may hold code).
output.fail_on
MRSENTRY_OUTPUT__FAIL_ON
mrsentry.config.Severity or None Exit 1 if any finding/vuln >= this severity.

General

Top-level switches.

KeyType / defaultDescription
dry_run
MRSENTRY_DRY_RUN
bool
false
Do everything except write to GitLab / push.
log_level
MRSENTRY_LOG_LEVEL
str
"INFO"
DEBUG, INFO, WARNING, ERROR.

Annotated example

This is the starter org config produced by mrsentry config init:

# mrsentry org/CI configuration. Pass with --config or MRSENTRY_CONFIG.
# Secrets never go here: use env vars (MRSENTRY_GITLAB_TOKEN, AWS default chain, api_key_env).
gitlab:
  url: https://gitlab.example.com        # default: $CI_SERVER_URL
  verify_ssl: true
  # ca_bundle: /etc/ssl/certs/corp-ca.pem

llm:
  profiles:
    default:                             # Amazon Bedrock (uses the AWS default credential chain)
      model: bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0
      aws_region: us-east-1
    # azure:
    #   model: azure/my-gpt-4o-deployment
    #   api_base: https://my-resource.openai.azure.com
    #   api_version: "2024-10-21"
    #   api_key_env: AZURE_OPENAI_API_KEY
    # anthropic:
    #   model: anthropic/claude-sonnet-4-5
    #   api_key_env: ANTHROPIC_API_KEY
    # proxy:                             # LiteLLM proxy
    #   model: litellm_proxy/claude-sonnet
    #   api_base: https://litellm.internal
    #   api_key_env: LITELLM_API_KEY
    # local:                             # any OpenAI-compatible server (vLLM, Ollama, LM Studio)
    #   model: openai/qwen2.5-coder-32b
    #   api_base: http://vllm.internal:8000/v1
    #   api_key_env: VLLM_API_KEY
  roles: { review: default, summarize: default, fix_repair: default }
  fallbacks: []
  max_cost_usd_per_run: 5.0

review:
  min_severity: medium
  max_inline_comments: 25
  agent: { enabled: true, max_steps: 12 }
  # extra_instructions: |
  #   We use Spring Boot 3 and jOOQ. Flag any raw JDBC.

ecr:
  # image: 123456789012.dkr.ecr.us-east-1.amazonaws.com/my-service:latest
  min_severity: high
  freshness_max_age: 24h
  on_stale: rescan          # rescan | local | warn | fail
  local_scanner: trivy

fix:
  mode: new-mr              # new-mr | existing-mr
  strategy: prefer-direct-upgrade
  verify:
    maven: mvn -B -q -DskipITs verify
    gradle: ./gradlew build -x integrationTest
    npm: npm ci
    pnpm: pnpm install --frozen-lockfile
    yarn: yarn install --frozen-lockfile
    poetry: poetry install --no-root
    uv: uv sync
  allow_llm_repair: true

output:
  dir: mrsentry-out
  formats: [json, markdown, codequality, dotenv]
  # fail_on: critical