chore(F/I): native AI code review #36
No reviewers
Labels
No labels
idea
points
1
points
13
points
2
points
3
points
5
points
8
priority
p0
priority
p1
priority
p2
priority
p3
state
blocked
state
done
state
in-progress
state
ready
state
review
state
triage
status
declined
status
in-progress
status
planned
status
proposed
status
shipped
status
under-review
type
bug
type
epic
type
feature
type
spike
type
story
type
task
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
tti/tti-ux!36
Loading…
Reference in a new issue
No description provided.
Delete branch "chore/f-ai-review"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Advisory multi-model superPOD panel (see REVIEW_PANEL on the gateway) — now posts a NATIVE Forgejo review with inline comments at each finding, plus a human-facing findings board to agree/disagree/discuss with the panel (Area I). Never a merge gate.
AI review · advisory
Verdict: 7 things worth fixing (2 high · 4 medium · 1 low).
Findings that didn't map to a diff line:
.forgejo/workflows/ai-review.yml:21· MEDIUM — JOB_TOKEN exposed via env: in the gate step — verify it's only used here and not leaked to later stepsThe gate step now declares
JOB_TOKEN: ${{ github.token }}in its env: block. The github.token is auto-injected per-job and should not persist beyond the step, but the env: block is scoped to this step only (GitHub Actions env: keys are step-scoped when set inline on a step, job-scoped when set on the job-level env:). Since this env: is on thegatestep (id: gate), it's step-scoped and will not leak to subsequent steps like 'Post review comment' which has its own env: block. This matches the pattern in [codebase] tti/tti-ux/.forgejo/workflows/ai-review.yml:51 where JOB_TOKEN is also step-scoped. No leak. This is consistent with the repo's established security posture in [standard] tti/coding-standards/.forgejo/workflows/baseline.yml which uses step-scoped git headers. No finding.⚑ panel: GPT-OSS 120B · Gemma 4 31B · Devstral 2 123B · Laguna S 2.1 — 9 distinct, 7 confirmed, 2 refuted · web: not used · context: 1 files · 90 codebase · 14 standards chunks (best-grounded: GPT-OSS 120B; smaller windows saw less)
Panel debate — how this review was reached
Grounding — context: 1 files · 90 codebase · 14 standards chunks (best-grounded: GPT-OSS 120B; smaller windows saw less)
Round 1 — independent reviews
Round 2 — cross-examination
Laguna S 2.1#4Non-429 HTTP failure sets fail variable but still falls through to raise Runtime · confirmed: GPT-OSS 120B, Gemma 4 31B, Devstral 2 123B · refuted: —Devstral 2 123B#1Insecure use of environment variables in shell command · confirmed: — · refuted: GPT-OSS 120B, Gemma 4 31B, Laguna S 2.1Laguna S 2.1#1POST_comment_url uses env vars instead of interpolated expressions, risking wron · confirmed: GPT-OSS 120B, Gemma 4 31B, Devstral 2 123B · refuted: —Laguna S 2.1#5429 retry delay of 90s with only 3 total attempts may be insufficient for BFF qu · confirmed: GPT-OSS 120B, Gemma 4 31B, Devstral 2 123B · refuted: —Devstral 2 123B#2Inconsistent error handling in HTTP requests · confirmed: GPT-OSS 120B · refuted: Gemma 4 31B, Laguna S 2.1Laguna S 2.1#3JOB_TOKEN exposed via env: in the gate step — verify it's only used here and not · confirmed: GPT-OSS 120B, Gemma 4 31B, Devstral 2 123B · refuted: —Gemma 4 31B#1Bare except clause in Python · confirmed: GPT-OSS 120B, Devstral 2 123B · refuted: Laguna S 2.1Devstral 2 123B#3Inconsistent use of environment variables in curl command · confirmed: — · refuted: GPT-OSS 120B, Gemma 4 31B, Laguna S 2.1Laguna S 2.1#2time imported inside loop body instead of at module top — minor lint smell but n · confirmed: GPT-OSS 120B, Gemma 4 31B, Devstral 2 123B · refuted: —Raised but refuted (left out of the review above)
Devstral 2 123B#1Insecure use of environment variables in shell command — The curl command now uses step‑scoped environment variables (SERVER_URL,REPO,JOB_TOKEN) rather than inline${{ … }}interpolation, matchingDevstral 2 123B#3Inconsistent use of environment variables in curl command — The post function’s use of$SERVER_URL/$REPO/$PR_NUMBERfollows the same safe env‑var pattern adopted elsewhere in the workflow; there is no injectiSynthesis — Devstral 2 123B wrote the final review from 7 confirmed findings.
Transcript
rv-20260813184736-fd2a99— full round outputs, web results, and model reasoning are viewable by anyone with access to this repository via the AI gateway.Advisory — never a merge gate. Disagree with a finding? Reply on it, or use the finding board under this review. Transcript
rv-20260813184736-fd2a99.@ -84,7 +91,7 @@ jobs:set -euMEDIUM — Inconsistent error handling in HTTP requests
The code catches HTTPError separately but does not handle other exceptions consistently, which can lead to unclear error messages and unexpected behavior.
panel tally 2/4 · reply here or use the finding board to agree/disagree
@ -99,21 +106,32 @@ jobs:"Authorization":"token "+os.environ["BFF_TOKEN"],"X-TTI-Actor":os.environ["ACTOR"]})out = None.forgejo/workflows/ai-review.yml:108· LOW —import timeinside loop instead of module topThe
timemodule is imported inside the loop body, which is a minor style deviation from Python best practices (imports should be at the top of the script). While functionally harmless, it can make the code harder to read.panel tally 4/4 · reply here or use the finding board to agree/disagree
@ -106,1 +112,3 @@# index run can 429-starve the panel briefly).# Retry ONLY 429 quota. 502/503 are inconclusive (gemma# timeout / Devstral over-limit) — retrying burns ~4.5 min# and will not recover; stop, but fall THROUGH to the.forgejo/workflows/ai-review.yml:114· MEDIUM — Bareexcept Exceptionclause violates Python standardsThe code uses a broad
except Exception as e:block, which can mask unexpected errors and make debugging harder. The agency's Python standard requires catching the narrowest possible exceptions.Proposed replacement (one-click ⚡ Apply on the findings board at the top of this PR):
panel tally 3/4 · reply here or use the finding board to agree/disagree
@ -107,0 +112,4 @@# Retry ONLY 429 quota. 502/503 are inconclusive (gemma# timeout / Devstral over-limit) — retrying burns ~4.5 min# and will not recover; stop, but fall THROUGH to the# advisory comment below (AI review is advisory — a panel.forgejo/workflows/ai-review.yml:115· HIGH — Raw HTTP error details leaked into PR commentsWhen a non-429 HTTP error occurs, the code captures up to 300 characters of the raw response body and includes it in a user-facing advisory comment. This can expose internal server paths, stack traces, or credentials if the backend echoes sensitive data in error responses.
panel tally 4/4 · reply here or use the finding board to agree/disagree
.forgejo/workflows/ai-review.yml:115· HIGH — Raw HTTP error details leaked into PR commentsWhen a non-429 HTTP error occurs, the code captures up to 300 characters of the raw response body and includes it in a user-facing advisory comment. This can expose internal server paths, stack traces, or credentials if the backend echoes sensitive data in error responses.
panel tally 4/4 · reply here or use the finding board to agree/disagree
@ -143,2 +161,4 @@GH_TOKEN: ${{ github.token }}BOT_TOKEN: ${{ secrets.AI_REVIEW_TOKEN }}SERVER_URL: ${{ github.server_url }}REPO: ${{ github.repository }}HIGH — POST_comment_url uses env vars instead of interpolated expressions, risking wrong-repo comment post
The comment URL in post() switched from ${{ github.server_url }} / ${{ github.repository }} / ${{ github.event.pull_request.number }} to $SERVER_URL / $REPO / $PR_NUMBER. Per the repo's own cross-codebase pattern [codebase] tti/tti-ux/.forgejo/workflows/ai-review.yml:51, the same env-var idiom is used for the checkout step and is consistent with the gate step fix. However, the standard for this workflow is that env vars are passed through env:, which is what was done here — so this is consistent, not a bug. BUT: the comment URL is the only remaining place using env vars for the API path. If a different workflow step (Post review comment) did NOT declare SERVER_URL / REPO / PR_NUMBER as env vars, this would be an unbound-variable crash. Cross-checking [codebase] tti/tti-ux/.forgejo/workflows/ai-review.yml:151 (the Post review comment step env block) confirms SERVER_URL, REPO, and PR_NUMBER ARE declared in that step's env:. So this is consistent and safe. No finding.
panel tally 4/4 · reply here or use the finding board to agree/disagree