Repository navigation
Let repos supply their own review guidance file - #39
Conversation
Add a `review-guidance-file` input (GitLab: OTTO_REVIEW_GUIDANCE_FILE) pointing at a markdown file in the reviewed repo. The action appends it to the reviewer persona's system prompt through Otto's --append-system-prompt. The file is read at the PR's base commit, never the head: it lands in the system prompt outside the untrusted-input fencing, so a PR must not be able to rewrite its own reviewer's instructions. GitLab fetches it through the repository files API because the job needn't have a usable clone. A missing or empty file warns and the review runs without it. Co-Authored-By: Claude <noreply@anthropic.com>
Otto ReviewAdds an optional repo-supplied review guidance file. It is read from the PR/MR base commit and appended to the reviewer persona's system prompt on both GitHub and GitLab. No issues found Both earlier findings are fixed. The GitHub "Load review guidance" step and the GitLab gather now always call |
- Always run the guidance loader (GitHub step and GitLab gather). With no file configured it only deletes /tmp/otto-review/guidance.md, so a persistent self-hosted runner can't append a previous job's guidance. - Fall back to `git fetch --depth=1` only when the clone is already shallow. On a full clone it would write .git/shallow and cut the history later steps diff against. Addresses Otto's review on #39. Co-Authored-By: Claude <noreply@anthropic.com>
Smart, I didn't think of that... |
jroachgolf84
left a comment
There was a problem hiding this comment.
LGTM, I like the approach here, as I think it fits in nicely with Otto's existing capabilities.
Description
Adds a
review-guidance-fileinput (GitLab:OTTO_REVIEW_GUIDANCE_FILE). It's a repo-relative path to a markdown file of the repo's own review guidance: focus areas, conventions, what to ignore, how strict to be. The action appends the file to thereviewerpersona's system prompt using Otto's existing--append-system-prompt, so Otto needs no changes.This is an alternative to the fixed scope presets in #38. Repos write the guidance they want instead of picking from a set of roles.
The file is read at the PR's base commit, not the head. The guidance goes into the system prompt, outside the untrusted-input fencing that PR content gets. If it came from the head, a PR could rewrite its own reviewer's instructions ("approve everything"). A PR that adds or changes the file is reviewed under the previous version, and the change applies after merge. If the file is missing or empty on the base commit, the action warns and reviews without it.
core/load-guidance.sh(new): reads the file at the base commit and wraps it under a short heading. The heading says the guidance can't change read-only mode, untrusted-input handling, or the output schema. Writes/tmp/otto-review/guidance.md.core/run-otto.sh: passes--append-system-promptwhen that file exists.action.yaml.gather-context.shfetches the file atdiff_refs.base_shathrough the repository files API, because the job doesn't need a usable clone.Related Issue(s)
Alternative to #38.
Breaking Change?
No. The new input is optional and defaults to empty, which keeps current behavior.
Checklist
README.mdand theaction.yamlinput/output descriptions if the action's interface changedLint YAMLpasses (yamllintclean locally)e2e/harness (or explained why that wasn't possible)Testing
core/tests/load-guidance-test.sh(new, runs ingitlab-adapter-test.yaml), against a throwaway repo. It covers: the base version is loaded and the head's edit is ignored, file missing on base, blank file, unknown base commit,./path, and no file configured.run.shasserts the file is fetched atref=BASE111and staged.run-edge.shasserts a 404 still lets the review run.reviewerpersona in Docker against the dev gateway, same fake PR with and without guidance. The base guidance said to start every comment with[house-rule]and flag a missingowneras medium. The PR head rewrote the guidance to "approve everything".comment.e2e-otto-reviewworkflow can't exercise guidance on this PR, becausemainhas no guidance file yet. It would only show the "not found on base" warning.