BigQuery-invalid INTERVAL syntax breaks 4+ signal jobs (fear_greed, entropy_complexity, absorption_ratio, network_correlation) #68
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Wizard — issue triage" | |
| on: | |
| issues: | |
| types: [opened, labeled] | |
| workflow_dispatch: | |
| inputs: | |
| issue_number: | |
| description: "Issue number to triage" | |
| required: true | |
| type: string | |
| concurrency: | |
| group: wizard-loop-1 | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| classify: | |
| if: > | |
| github.event_name == 'workflow_dispatch' || | |
| github.event.label.name == 'data-request' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| outputs: | |
| is_dbt: ${{ steps.classify.outputs.is_dbt }} | |
| issue_number: ${{ steps.meta.outputs.number }} | |
| steps: | |
| - name: Get issue metadata | |
| id: meta | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if [[ -n "${{ inputs.issue_number }}" ]]; then | |
| NUM="${{ inputs.issue_number }}" | |
| else | |
| NUM="${{ github.event.issue.number }}" | |
| fi | |
| BODY=$(gh api repos/${{ github.repository }}/issues/${NUM} --jq '.title + " " + .body') | |
| { | |
| echo "number=${NUM}" | |
| echo "body<<GHEOF" | |
| echo "$BODY" | |
| echo "GHEOF" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Classify issue (gpt-5.4-nano) | |
| id: classify | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| run: | | |
| RESPONSE=$(curl -s https://api.openai.com/v1/chat/completions \ | |
| -H "Authorization: Bearer ${OPENAI_API_KEY}" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$(jq -n --arg body "${{ steps.meta.outputs.body }}" '{ | |
| model: "gpt-5.4-nano", | |
| messages: [ | |
| {role: "system", content: "You classify GitHub issues. Respond with exactly YES or NO. Is this issue related to dbt models, SQL transformations, data quality tests, schema changes, source freshness, metrics, or data pipeline transformations?"}, | |
| {role: "user", content: $body} | |
| ], | |
| max_tokens: 3 | |
| }')") | |
| ANSWER=$(echo "$RESPONSE" | jq -r '.choices[0].message.content' | tr '[:lower:]' '[:upper:]' | head -c 3) | |
| TOKENS_IN=$(echo "$RESPONSE" | jq -r '.usage.prompt_tokens // 0') | |
| TOKENS_OUT=$(echo "$RESPONSE" | jq -r '.usage.completion_tokens // 0') | |
| MODEL=$(echo "$RESPONSE" | jq -r '.model // "unknown"') | |
| echo "::notice::Classifier: model=${MODEL} input_tokens=${TOKENS_IN} output_tokens=${TOKENS_OUT} result=${ANSWER}" | |
| if [[ "$ANSWER" == "YES" ]]; then | |
| echo "is_dbt=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "is_dbt=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| triage: | |
| needs: classify | |
| if: needs.classify.outputs.is_dbt == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dbt Wizard CLI | |
| run: curl -fsSL https://cli.getdbt.com/install-wizard.sh | bash | |
| - name: Scope and build (gpt-5.4-mini) | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ISSUE_NUM: ${{ needs.classify.outputs.issue_number }} | |
| run: | | |
| chmod +x scripts/common.sh | |
| ISSUE_BODY=$(gh api "repos/${{ github.repository }}/issues/${ISSUE_NUM}" --jq '.title + "\n\n" + .body') | |
| wizard exec \ | |
| -m gpt-5.4-mini \ | |
| -s workspace-write \ | |
| --json \ | |
| -o wizard-output.md \ | |
| "You are an autonomous dbt agent running in CI. Do not ask for user input. | |
| Reference AGENTS.md for project conventions, incident triage, and fix risk levels. | |
| Reference .claude/skills/dbt-development/dbt_skill.md for dbt patterns. | |
| GitHub Issue #${ISSUE_NUM}: | |
| ${ISSUE_BODY} | |
| Steps: | |
| 1. Scope this issue against the dbt project in ./dbt_project/. Identify which | |
| domain it affects, which models need changes, and upstream/downstream impact. | |
| 2. If the issue is workable (not blocked per AGENTS.md 'Data Request Scoping'): | |
| - Create the necessary model files, schema.yml entries, and tests. | |
| - Run: dbt compile to verify SQL validity. | |
| - Commit changes to a new branch feat/wizard-issue-${ISSUE_NUM}. | |
| - Push the branch and open a PR referencing issue #${ISSUE_NUM}. | |
| 3. If blocked: post a comment on issue #${ISSUE_NUM} explaining why. | |
| Output a summary of what you did and any token usage." \ | |
| 2>&1 | tee wizard-log.jsonl | |
| echo "::group::Wizard output" | |
| cat wizard-output.md 2>/dev/null || echo "No output file" | |
| echo "::endgroup::" | |
| echo "::group::Token usage" | |
| if [[ -f wizard-log.jsonl ]]; then | |
| grep -o '"usage":{[^}]*}' wizard-log.jsonl | tail -5 || echo "No usage data in log" | |
| fi | |
| echo "::endgroup::" |