fix(code-review): respect agent execution contexts - #25
Conversation
📝 WalkthroughWalkthroughUpdated review instructions to verify CLI availability and authentication in the execution context. Sandboxed agents now require command-scoped host and network approval without sandbox bypasses. Review commands now use explicit committed, uncommitted, and untracked scope flags. Documentation describes the updated authentication behavior and scope options. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
|
move the yaml config to its own PR; mark this PR ready for review (not draft) |
|
Moved the repository CodeRabbit policy to #26 and applied every requested setting there: inheritance disabled, assertive profile, review status/fortune/poem enabled, simplify enabled, one-commit auto-pause, and the request-changes workflow as the all-comments approval gate. PR #25 is now auth-only and ready for review. |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@commands/coderabbit-review.md`:
- Around line 40-61: In commands/coderabbit-review.md at lines 40-61, add a
fail-closed secret/credential preflight over the complete selected review scope,
including untracked files when requested, before invoking coderabbit
"${args[@]}"; stop without running the review when a secret is detected. Apply
the same preflight before coderabbit review --agent in agents/code-reviewer.md
at lines 38-44, preserving each entry point’s existing scope selection and
authentication behavior.
- Around line 40-61: The review command flow must perform the fail-closed secret
preflight before invoking coderabbit with args. Update the Run Review section
around the args construction to apply the complete-scope check from
skills/code-review/SKILL.md for all review types, including untracked files, and
abort rather than running the command when secrets are detected.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 2e6029b1-dd9b-4dee-9613-2382ccbd6706
📒 Files selected for processing (5)
CHANGELOG.mdREADME.mdagents/code-reviewer.mdcommands/coderabbit-review.mdskills/code-review/SKILL.md
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
coderabbitai/bitbucket(manual)
📜 Review details
🧰 Additional context used
🪛 LanguageTool
README.md
[style] ~148-~148: Consider using a different verb for a more formal wording.
Context: ...dings grouped by severity 4. Optionally fix issues and re-review Sandboxed agents ...
(FIX_RESOLVE)
🔇 Additional comments (5)
skills/code-review/SKILL.md (1)
31-74: LGTM!Also applies to: 83-100, 110-126
README.md (1)
145-154: LGTM!commands/coderabbit-review.md (2)
3-3: 🎯 Functional CorrectnessKeep the base selector consistent with the shared skill.
skills/code-review/SKILL.mddocuments--base-commit, but this command accepts only--base <branch>and forwards onlybase. A commit-based review cannot use this entry point. Add a separatebase_commitargument and forward--base-commit, or remove that mode from the shared skill.
29-30: LGTM!Also applies to: 71-72
CHANGELOG.md (1)
21-25: LGTM!
| **If the CLI is not authenticated**, ask the user to run: | ||
|
|
||
| ### Run Review | ||
| ```bash | ||
| coderabbit auth login | ||
| ``` | ||
|
|
||
| Do not start the login flow without the user's explicit action. Claude Code runs | ||
| these checks in its normal host shell; sandboxed agents must follow the portable | ||
| skill's execution-context guidance instead. | ||
|
|
||
| Once prerequisites are met: | ||
| ### Run Review | ||
|
|
||
| ```bash | ||
| # type defaults to "all"; add --base and --dir only when specified | ||
| args=(review --agent -t "${type:-all}") | ||
| args=(review --agent) | ||
| case "${type:-all}" in | ||
| all) ;; | ||
| committed) args+=(--committed) ;; | ||
| uncommitted) args+=(--uncommitted) ;; | ||
| untracked) args+=(--uncommitted --include-untracked) ;; | ||
| *) echo "Unsupported review type: $type" >&2; exit 2 ;; | ||
| esac |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- commands/coderabbit-review.md ---'
sed -n '1,180p' commands/coderabbit-review.md
printf '%s\n' '--- agents/code-reviewer.md ---'
sed -n '1,140p' agents/code-reviewer.md
printf '%s\n' '--- secret-related references ---'
rg -n -i --glob '!node_modules' --glob '!dist' --glob '!build' \
'secret|credential|sensitive|preflight|portable.*skill|include-untracked|coderabbit review' \
commands agents skills .github 2>/dev/null || true
printf '%s\n' '--- repository files near portable review skill ---'
git ls-files | rg -i 'review|secret|credential|portable|skill' | head -200Repository: coderabbitai/skills
Length of output: 9202
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- skills/code-review/SKILL.md: control and workflow ---'
sed -n '1,190p' skills/code-review/SKILL.md
printf '%s\n' '--- references to the portable review skill ---'
rg -n -C 4 'skills/code-review|code-review/SKILL|secret|credential|coderabbit review --agent|commands/coderabbit-review' \
commands agents skills --glob '*.md' --glob '*.toml'
printf '%s\n' '--- command and agent invocation structure ---'
rg -n -C 6 'coderabbit(\s+|\")|review --agent|Run Review|Run CodeRabbit Review' \
commands/coderabbit-review.md agents/code-reviewer.md skills/code-review/SKILL.mdRepository: coderabbitai/skills
Length of output: 28539
Sensitive Data Exposure (CWE-200): Exposure of Sensitive Information to an Unauthorized Actor
Reachability: External · Exploitability: Moderate
Add the fail-closed secret preflight to both direct review entry points.
Before invoking coderabbit, inspect the complete selected scope, including untracked files when requested. Stop if a secret or credential is present.
commands/coderabbit-review.md: run the check beforecoderabbit "${args[@]}".agents/code-reviewer.md: run the same check beforecoderabbit review --agent.
📍 Affects 2 files
commands/coderabbit-review.md#L40-L61(this comment)agents/code-reviewer.md#L38-L44
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@commands/coderabbit-review.md` around lines 40 - 61, In
commands/coderabbit-review.md at lines 40-61, add a fail-closed
secret/credential preflight over the complete selected review scope, including
untracked files when requested, before invoking coderabbit "${args[@]}"; stop
without running the review when a secret is detected. Apply the same preflight
before coderabbit review --agent in agents/code-reviewer.md at lines 38-44,
preserving each entry point’s existing scope selection and authentication
behavior.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- command context ---'
sed -n '1,140p' commands/coderabbit-review.md
printf '%s\n' '--- portable skill references ---'
rg -n -C 4 'secret|credential|preflight|fail.closed|coderabbit review|include-untracked|review --agent' skills/code-review/SKILL.md commands
printf '%s\n' '--- invocation references ---'
rg -n -C 3 'coderabbit "\$\{args|coderabbit review|commands/coderabbit-review|coderabbit-review' .Repository: coderabbitai/skills
Length of output: 15570
Sensitive Data Exposure (CWE-200): Exposure of Sensitive Information to an Unauthorized Actor
Reachability: External · Exploitability: Moderate
Add the fail-closed secret preflight before coderabbit "${args[@]}". The command can transmit credentials in the selected diff because it does not apply the complete-scope check required by skills/code-review/SKILL.md, including for untracked files.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@commands/coderabbit-review.md` around lines 40 - 61, The review command flow
must perform the fail-closed secret preflight before invoking coderabbit with
args. Update the Run Review section around the args construction to apply the
complete-scope check from skills/code-review/SKILL.md for all review types,
including untracked files, and abort rather than running the command when
secrets are detected.
Summary
-tscope selectors with the current CLI flags:--committed,--uncommitted, and--include-untrackedWhy
A restricted Codex command sandbox may not expose authentication already stored by the host CodeRabbit CLI. A sandbox-only preflight can therefore report a false unauthenticated state. That behavior is specific to sandboxed execution and must not replace the normal host-shell workflow used by Claude Code and other native integrations.
The portable rule is to verify authentication in the same authoritative execution context that will perform the review. Sandboxed agents use their harness's normal command-scoped host/network approval without disabling the sandbox; host-native agents use their normal shell. If the authoritative check is unauthenticated, the user is asked to authenticate explicitly.
Validation
coderabbit0.7.1 help verified the current authentication and review flagsgit diff --checkcoderabbit auth status --agentconfirmed existing authenticationDraft status
This remains a draft intentionally. The original change generalized a Codex-only workaround across every supported agent. The branch now separates sandboxed and host-native behavior, but it should receive owner and full CodeRabbit review before it is considered ready.
The repository-level CodeRabbit policy remains isolated in #26.
Summary by CodeRabbit
Documentation
Bug Fixes