-
Notifications
You must be signed in to change notification settings - Fork 2
refactor: extract kiro auth module and migrate Qwen to BaseTokenStorage #824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
87726f9
26722cb
a1a831f
5c63c22
f67707d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,70 @@ | ||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| REPO_ROOT="$(git rev-parse --show-toplevel)" | ||||||||||||||||||||||||||||||
| cd "$REPO_ROOT" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Compute changed files between base and head | ||||||||||||||||||||||||||||||
| BASE="${AIRLOCK_BASE_SHA:-HEAD~1}" | ||||||||||||||||||||||||||||||
| HEAD="${AIRLOCK_HEAD_SHA:-HEAD}" | ||||||||||||||||||||||||||||||
| CHANGED_FILES=$(git diff --name-only --diff-filter=ACMR "$BASE" "$HEAD" 2>/dev/null || git diff --name-only --cached) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Filter by language | ||||||||||||||||||||||||||||||
| GO_FILES=$(echo "$CHANGED_FILES" | grep '\.go$' || true) | ||||||||||||||||||||||||||||||
| PY_FILES=$(echo "$CHANGED_FILES" | grep '\.py$' || true) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ERRORS=0 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # --- Go --- | ||||||||||||||||||||||||||||||
| if [[ -n "$GO_FILES" ]]; then | ||||||||||||||||||||||||||||||
| echo "=== Go: gofmt (auto-fix) ===" | ||||||||||||||||||||||||||||||
| echo "$GO_FILES" | xargs -I{} gofmt -w "{}" 2>/dev/null || true | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
| echo "$GO_FILES" | xargs -I{} gofmt -w "{}" 2>/dev/null || true | |
| if ! echo "$GO_FILES" | xargs -I{} gofmt -w "{}"; then | |
| echo "gofmt: failed to format one or more files" | |
| ERRORS=1 | |
| fi |
Copilot
AI
Mar 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The grep "^${file}:" pattern treats file as a regex fragment, so paths containing regex metacharacters (e.g., [, ], .) can mis-match and cause false positives/negatives in filtering. Use a fixed-string match (or escape the filename before constructing the regex) to ensure only issues from the exact changed file paths are included.
| MATCH=$(echo "$LINT_OUTPUT" | grep "^${file}:" || true) | |
| MATCH=$(echo "$LINT_OUTPUT" | awk -v f="$file" 'substr($0, 1, length(f) + 1) == f ":" { print }' || true) |
Copilot
AI
Mar 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the Go section, these steps suppress errors and stderr, which can hide a misconfigured environment (missing ruff, invalid config, etc.) and lead to confusing “success” runs. Consider failing the script when these commands fail (or capturing failures into ERRORS) so the pipeline outcome reflects actual formatter/linter execution.
| echo "$PY_FILES" | xargs ruff format 2>/dev/null || true | |
| echo "=== Python: ruff check --fix ===" | |
| echo "$PY_FILES" | xargs ruff check --fix 2>/dev/null || true | |
| if ! echo "$PY_FILES" | xargs ruff format; then | |
| echo "ruff format: failed" | |
| ERRORS=1 | |
| fi | |
| echo "=== Python: ruff check --fix ===" | |
| if ! echo "$PY_FILES" | xargs ruff check --fix; then | |
| echo "ruff check --fix: failed" | |
| ERRORS=1 | |
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cat -n .airlock/lint.sh | sed -n '15,70p'Repository: KooshaPari/cliproxyapi-plusplus
Length of output: 2119
🏁 Script executed:
# Verify fail-open consequence: if golangci-lint crashes, LINT_OUTPUT is empty
bash -c 'LINT_OUTPUT=$(/nonexistent/golangci-lint run 2>&1 || true); if [[ -n "$LINT_OUTPUT" ]]; then echo "HAS OUTPUT"; else echo "NO OUTPUT - SILENT PASS"; fi'Repository: KooshaPari/cliproxyapi-plusplus
Length of output: 85
🏁 Script executed:
# Test ruff fail-through with || true: does script continue with exit 0?
bash -c 'echo "invalid" | xargs ruff check 2>/dev/null || true; echo "Exit code: $?"'Repository: KooshaPari/cliproxyapi-plusplus
Length of output: 197
Failure suppression bypasses lint gating.
Lines 21, 27, 52, and 55 suppress failures (|| true, 2>/dev/null), allowing the script to report success even if linters/formatters fail to execute. Line 27 also uses unquoted $GO_DIRS, causing unsafe word-splitting. When golangci-lint or ruff encounters an execution error (missing binary, config failure, crash), the error output doesn't match the file-path filter pattern (line 32), gets silently dropped, and the script falsely reports "OK". This breaks the lint enforcement gate.
Suggested fix
- echo "$GO_FILES" | xargs -I{} gofmt -w "{}" 2>/dev/null || true
+ while IFS= read -r file; do
+ [[ -n "$file" ]] || continue
+ gofmt -w "$file"
+ done <<< "$GO_FILES"
- GO_DIRS=$(echo "$GO_FILES" | xargs -I{} dirname "{}" | sort -u | sed 's|$|/...|')
+ mapfile -t GO_DIRS < <(
+ printf '%s\n' "$GO_FILES" | xargs -I{} dirname "{}" | sort -u | sed 's|$|/...|'
+ )
- LINT_OUTPUT=$(golangci-lint run --out-format line-number $GO_DIRS 2>&1 || true)
- if [[ -n "$LINT_OUTPUT" ]]; then
+ set +e
+ LINT_OUTPUT=$(golangci-lint run --out-format line-number "${GO_DIRS[@]}" 2>&1)
+ LINT_EXIT=$?
+ set -e
+ if [[ $LINT_EXIT -ne 0 || -n "$LINT_OUTPUT" ]]; then
# Filter to only issues in changed files
FILTERED=""
@@
- else
+ elif [[ $LINT_EXIT -eq 0 ]]; then
echo "golangci-lint: OK (issues only in unchanged files, skipping)"
+ else
+ echo "$LINT_OUTPUT"
+ echo "golangci-lint: execution/config failure"
+ ERRORS=1
fi
else
echo "golangci-lint: OK"
fi
- echo "$PY_FILES" | xargs ruff format 2>/dev/null || true
+ echo "$PY_FILES" | xargs ruff format
- echo "$PY_FILES" | xargs ruff check --fix 2>/dev/null || true
+ echo "$PY_FILES" | xargs ruff check --fix🧰 Tools
🪛 Shellcheck (0.11.0)
[info] 27-27: Double quote to prevent globbing and word splitting.
(SC2086)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.airlock/lint.sh around lines 21 - 63, The script currently swallows errors
and mis-splits paths: remove the failure suppressions and silent stderr
redirects so linters' exit codes and messages are preserved (replace uses of "||
true" and "2>/dev/null" around gofmt, golangci-lint, ruff format/check), quote
variables like "$GO_DIRS" and "$GO_FILES" to avoid word-splitting, capture both
stdout and stderr from golangci-lint into LINT_OUTPUT and if the command exits
non‑zero, propagate that by setting ERRORS=1 unless FILTERED contains legitimate
findings; likewise treat ruff format/check non‑zero exits as failures by
checking their exit status (use explicit if/else on the commands rather than
silencing) so missing binaries or crashes fail the gate instead of being hidden.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Airlock workflow configuration | ||
| # Documentation: https://github.com/airlock-hq/airlock | ||
|
|
||
| name: Main Pipeline | ||
|
|
||
| on: | ||
| push: | ||
| branches: ['**'] | ||
|
|
||
| jobs: | ||
| default: | ||
| name: Lint, Test & Deploy | ||
| steps: | ||
| # Rebase onto upstream to handle drift | ||
| - name: rebase | ||
| uses: airlock-hq/airlock/defaults/rebase@main | ||
|
|
||
| # Run linters and formatters, auto-fix issues | ||
| - name: lint | ||
| uses: airlock-hq/airlock/defaults/lint@main | ||
|
|
||
| # Commit auto-fix patches and lock the worktree | ||
| - name: freeze | ||
| run: airlock exec freeze | ||
|
|
||
| # Generate PR title and description from the diff | ||
| - name: describe | ||
| uses: airlock-hq/airlock/defaults/describe@main | ||
|
|
||
| # Update documentation to reflect changes | ||
| - name: document | ||
| uses: airlock-hq/airlock/defaults/document@main | ||
|
|
||
| # Run tests | ||
| - name: test | ||
| uses: airlock-hq/airlock/defaults/test@main | ||
|
|
||
| # Push changes to upstream (pauses for user approval first) | ||
| - name: push | ||
| uses: airlock-hq/airlock/defaults/push@main | ||
| require-approval: true | ||
|
|
||
| # Create pull/merge request | ||
| - name: create-pr | ||
| uses: airlock-hq/airlock/defaults/create-pr@main | ||
|
Comment on lines
+16
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
# First, verify the mutable action refs exist
echo "=== Checking for `@main` refs ==="
rg -n 'uses:\s+airlock-hq/airlock/.+@main' .airlock/workflows/main.yml
echo ""
echo "=== Full workflow file ==="
cat .airlock/workflows/main.ymlRepository: KooshaPari/cliproxyapi-plusplus Length of output: 1728 Pin action references to immutable commits instead of All seven action references in this workflow use mutable Suggested fix pattern- uses: airlock-hq/airlock/defaults/rebase@main
+ uses: airlock-hq/airlock/defaults/rebase@<full-commit-sha>Apply the same pinning pattern to all 🤖 Prompt for AI Agents |
||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git diff --name-onlyis newline-delimited; piping throughecho | grep | xargslater will break on filenames containing spaces, tabs, or newlines. Prefer a NUL-delimited pipeline (e.g.,git diff -z ...withgrep -z/xargs -0) so formatting/linting reliably targets the intended files.