bug: discharge gate compares an undiscounted shadow price against buy*eta -- 5.3% too strict, wrong on exact ties #970
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
| # Stage 3 — Implement Fix (gated) | |
| # | |
| # Triggered manually with `@claude-bot fix` on an issue. Reads the | |
| # Stage 2 diagnosis comment, implements the minimal fix, runs the | |
| # quality gate, and opens a draft PR. | |
| name: Issue Fix | |
| on: | |
| issue_comment: | |
| types: [created] | |
| jobs: | |
| fix: | |
| name: Implement Fix | |
| if: | | |
| github.event.comment.user.login == github.repository_owner && | |
| github.event.issue.pull_request == null && | |
| contains(github.event.comment.body, '@claude-bot fix') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/create-github-app-token@v2 | |
| id: app-token | |
| with: | |
| app-id: ${{ secrets.CLAUDE_REVIEWER_APP_ID }} | |
| private-key: ${{ secrets.CLAUDE_REVIEWER_PRIVATE_KEY }} | |
| - uses: actions/setup-python@v5 | |
| with: | |
| # Must match ci.yml and the add-on base image. This stage runs the | |
| # test suite before opening its PR, so on a different interpreter it | |
| # would green-light a change that ci.yml then rejects. | |
| python-version: "3.13" | |
| cache: pip | |
| # quality-check.sh now fails when pytest/black/ruff are missing, so the | |
| # fix agent needs the dev toolchain installed before it runs the gate. | |
| - name: Install Python dependencies | |
| run: | | |
| pip install -r backend/requirements.txt | |
| pip install -r requirements-dev.txt | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - uses: anthropics/claude-code-action@v1 | |
| with: | |
| # Auth switch: BOT_AUTH=api_key uses the Anthropic API key (pay-per-token); | |
| # unset or 'oauth' uses Claude subscription credits. Change the repo variable | |
| # to flip without a code change. | |
| anthropic_api_key: ${{ vars.BOT_AUTH == 'api_key' && secrets.ANTHROPIC_API_KEY || '' }} | |
| claude_code_oauth_token: ${{ vars.BOT_AUTH != 'api_key' && secrets.CLAUDE_CODE_OAUTH_TOKEN || '' }} | |
| github_token: ${{ steps.app-token.outputs.token }} | |
| trigger_phrase: "@claude-bot fix" | |
| claude_args: "--max-turns 120 --permission-mode bypassPermissions" | |
| prompt: | | |
| You are the **Stage 3 Fix** bot for issue #${{ github.event.issue.number }} in johanzander/bess-manager. | |
| The fix process is NOT defined here. Read | |
| `.claude/skills/implement-issue/SKILL.md` and follow its Process | |
| in **CI mode** (the skill's "CI mode" section maps each step to | |
| this pipeline; its required reading — docs/agents/rules.md first, | |
| NON-NEGOTIABLE — applies in full). | |
| This workflow owns only the CI plumbing: | |
| 1. The issue is #${{ github.event.issue.number }}: | |
| gh issue view ${{ github.event.issue.number }} --json title,body,labels,comments | |
| 2. Per CI mode, a Stage 2 analysis comment ("Root cause" / | |
| "Evidence" / "Proposed fix") is required. If absent, STOP: | |
| post "No deep analysis found. Run `@claude-bot analyze` first | |
| so the fix is grounded in a confirmed root cause." and exit. | |
| 3. Branch: fix/issue-${{ github.event.issue.number }}-<short-kebab-slug> | |
| 4. Open the PR as **DRAFT** against main, titled | |
| "Fix #${{ github.event.issue.number }}: <one-line summary>", | |
| body per the skill's Step 9 template (including the | |
| `## Scope assessment` section from CI-mode Step 3, and | |
| `Closes #${{ github.event.issue.number }}`). | |
| 5. Comment on the issue with the PR link, then: | |
| gh issue edit ${{ github.event.issue.number }} --add-label has-fix-pr | |
| ────────────────────────────────────────────────────────────────── | |
| HARD CONSTRAINTS (in addition to the skill's Step 10) | |
| ────────────────────────────────────────────────────────────────── | |
| - PR MUST be a draft. Never auto-merge. Never push to `main`. | |
| - If quality-check.sh keeps failing after 3 fix attempts, stop, | |
| push the branch as-is, and post a comment explaining what | |
| failed so the human can take over. |