diff --git a/.github/workflows/pr-agent.yml b/.github/workflows/pr-agent.yml index b320d67..b66d362 100644 --- a/.github/workflows/pr-agent.yml +++ b/.github/workflows/pr-agent.yml @@ -27,7 +27,7 @@ jobs: - name: Sign in to OpenCode env: AUDIENCE: https://opencode.ai/console - CLIENT_ID: ${{ vars.OPENCODE_OIDC_CLIENT_ID }} + CLIENT_ID: ${{ secrets.OPENCODE_OIDC_CLIENT_ID }} shell: bash run: | set -euo pipefail @@ -38,14 +38,28 @@ jobs: "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=$AUDIENCE" \ | jq -er '.value') - token=$(curl -sSf https://opencode.ai/console/auth/oauth/token \ + echo "GitHub OIDC request succeeded" + + response=$(mktemp) + trap 'rm -f "$response"' EXIT + + status=$(curl -sS -o "$response" -w '%{http_code}' \ + https://opencode.ai/console/auth/oauth/token \ -d grant_type=urn:ietf:params:oauth:grant-type:token-exchange \ -d subject_token_type=urn:ietf:params:oauth:token-type:jwt \ -d "client_id=$CLIENT_ID" \ - -d "subject_token=$oidc" \ - | jq -er '.access_token') + -d "subject_token=$oidc") + + if [[ "$status" != "200" ]]; then + echo "OpenCode token exchange failed: HTTP $status" + jq -r '.error // .code // "No structured error code"' "$response" + exit 1 + fi + + token=$(jq -er '.access_token' "$response") echo "::add-mask::$token" + echo "OpenCode token exchange succeeded" echo "OPENAI_KEY=$token" >> "$GITHUB_ENV" - name: Review with PR-Agent diff --git a/.pr_agent.toml b/.pr_agent.toml index d80555b..d271549 100644 --- a/.pr_agent.toml +++ b/.pr_agent.toml @@ -2,8 +2,8 @@ # Read-only reviewer with inline comments. No auto-approval or automatic edits. [config] -ai_timeout = 120 -num_retries = 2 +ai_timeout = 300 +num_retries = 4 # All paths are always included, subject to the line budget. repo_context_from_default_branch = true @@ -12,24 +12,11 @@ repo_context_files = [ "AGENTS.md" ] -persistent_inline_comments = true output_run_details = true -publish_output = true -enable_auto_approval = false [pr_reviewer] inline_key_issues = true num_max_findings = 5 -persistent_comment = true -persistent_finding_state = true -publish_output_no_suggestions = false -enable_review_labels_security = false -enable_review_labels_effort = false -require_estimate_effort_to_review = false -require_tests_review = true -require_security_review = true -require_ticket_analysis_review = true -enable_review_coverage_footer = true enable_large_pr_chunking = true max_number_of_calls = 3