Skip to content

Add a code review step which uses a short-lived provider token#7932

Merged
jamadeo merged 7 commits intomainfrom
gha-llm-proxy
Mar 24, 2026
Merged

Add a code review step which uses a short-lived provider token#7932
jamadeo merged 7 commits intomainfrom
gha-llm-proxy

Conversation

@jamadeo
Copy link
Copy Markdown
Collaborator

@jamadeo jamadeo commented Mar 16, 2026

Summary

Adds a new code review step which proxies its LLM requests using a short-lived Github OIDC token. This lets us make provider calls from an untrusted context for e.g. code reviews (included in this PR) or live provider integration tests.

This PR also contains the source code for a cloudflare worker that can be used to do this proxying.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e6cb8ae9c5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab11ec115a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +160 to +163
if [ ! -f "$COMMENTS" ]; then
echo "No comments produced, skipping review submission."
exit 0
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Submit body-only reviews when comments are absent

This early return skips submission whenever comments.json is missing, even if conclusion.json exists with a non-empty body from finish_review. The recipe prompt explicitly allows summary-only output via finish_review, so in that path the workflow silently drops the generated review instead of posting it.

Useful? React with 👍 / 👎.

function jsonResponse(status, body, extraHeaders = {}) {
return new Response(JSON.stringify(body), {
status,
headers: { "Content-Type": "application/json", ...extraHeaders },
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add CORS headers to JSON error responses

Error paths (for example invalid token or rate limiting) use jsonResponse, but this helper only sets Content-Type and omits Access-Control-Allow-Origin. In cross-origin browser usage, those 401/429 responses are blocked by CORS even though preflight and proxied success responses allow CORS, which prevents clients from reading the error payload or handling retry/auth flows correctly.

Useful? React with 👍 / 👎.

@@ -0,0 +1,84 @@
#!/usr/bin/env -S uv run --script
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice and brief! was wondering if a skill and gh cli could do this but this is more crisp

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is possible, but if goose is to invoke the gh cli directly, we need to give it a GITHUB_TOKEN, which would then be vulnerable to stealing via promp injection. So instead we give goose the least privilege/secrets possible (only the short-lived token for the LLM proxy) and have it stage the whole review to an artifact, which is later uploaded by a step with the right privilege.

We could just have goose write to a json file directly, but that felt like asking more of the LLM vs giving it tools.

@jamadeo jamadeo requested a review from tlongwell-block March 17, 2026 15:09
@DOsinga DOsinga added the needs_human label to set when a robot looks at a PR and can't handle it label Mar 20, 2026
@jamadeo jamadeo requested a review from michaelneale March 23, 2026 13:46
Copy link
Copy Markdown
Collaborator

@michaelneale michaelneale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. Does this mean we can also retire the codex review bot which is starting to get really noisy and harmful?

@jamadeo
Copy link
Copy Markdown
Collaborator Author

jamadeo commented Mar 24, 2026

I like it. Does this mean we can also retire the codex review bot which is starting to get really noisy and harmful?

Eventually that would be great, but right now I think the codex review is probably a lot better at general code reviews. My thinking was that we use this new method to add specific things to look for, and if we can get to a point where the prompts work well enough to do general reviews, that's a great too.

@jamadeo jamadeo added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit 928f4ac Mar 24, 2026
21 checks passed
@jamadeo jamadeo deleted the gha-llm-proxy branch March 24, 2026 13:11
wpfleger96 added a commit that referenced this pull request Mar 24, 2026
* origin/main:
  fix: use pnpm when publishing (#8092)
  Alexhancock/publish npm file format fix (#8091)
  fix: iteration on the publish-npm workflow (#8087)
  chore: ignore unmaintained warning for proc-macro-error (#8084)
  chore: clean up stray recipe.yaml (#8086)
  chore(release): bump version to 1.29.0 (minor) (#8088)
  Update lockfile references (#8085)
  Fix version bump (#8083)
  Add a code review step which uses a short-lived provider token (#7932)
lifeizhou-ap added a commit that referenced this pull request Mar 25, 2026
* main:
  Fix user message text silently dropped when message contains both text and image (#8071)
  fix: use pnpm when publishing (#8092)
  Alexhancock/publish npm file format fix (#8091)
  fix: iteration on the publish-npm workflow (#8087)
  chore: ignore unmaintained warning for proc-macro-error (#8084)
  chore: clean up stray recipe.yaml (#8086)
  chore(release): bump version to 1.29.0 (minor) (#8088)
  Update lockfile references (#8085)
  Fix version bump (#8083)
  Add a code review step which uses a short-lived provider token (#7932)
michaelneale added a commit that referenced this pull request Mar 25, 2026
* origin/main:
  Fix user message text silently dropped when message contains both text and image (#8071)
  fix: use pnpm when publishing (#8092)
  Alexhancock/publish npm file format fix (#8091)
  fix: iteration on the publish-npm workflow (#8087)
  chore: ignore unmaintained warning for proc-macro-error (#8084)
  chore: clean up stray recipe.yaml (#8086)
  chore(release): bump version to 1.29.0 (minor) (#8088)
  Update lockfile references (#8085)
  Fix version bump (#8083)
  Add a code review step which uses a short-lived provider token (#7932)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs_human label to set when a robot looks at a PR and can't handle it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants