Compare commits

..

1 Commits

Author SHA1 Message Date
peptiderepo
0bac52d268 Fix cost-tracker SELECT against canonical schema (v0.15.1)
The cost-preview probe in get_avg_tokens_for_stages() referenced
input_tokens/output_tokens/timestamp, which don't exist. Canonical
columns are prompt_tokens/completion_tokens/created_at. Empty-result
fallback was masking the failure functionally, but the wpdb debug
notice was visibly leaking to every admin visit of the AI Models tab.

Adds regression tests that assert $wpdb->last_error after the call,
so the next schema drift won't be masked the same way.

Bug present since v0.11.0 (2026-04-23).

Agent-Session: engineer-prautoblogger cost-tracker-schema-mismatch
2026-05-14 16:40:51 +08:00
2 changed files with 8 additions and 11 deletions

View File

@@ -123,18 +123,17 @@ jobs:
git fetch origin ${{ github.event.pull_request.base.ref }} --depth=50 git fetch origin ${{ github.event.pull_request.base.ref }} --depth=50
BASE_SHA="${{ github.event.pull_request.base.sha }}" BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}" HEAD_SHA="${{ github.event.pull_request.head.sha }}"
# Write the diff to a file, not a step output / env var. Passing a DIFF=$(git diff --no-color "$BASE_SHA" "$HEAD_SHA" | head -c 400000)
# ~400KB diff through the process env (execve argv+envp) exceeds the
# runner ARG_MAX and fails the next step with "Argument list too long"
# (issue #110). File transport also sidesteps the ~1MB step-output cap.
git diff --no-color "$BASE_SHA" "$HEAD_SHA" | head -c 400000 > /tmp/cto-review-diff.txt
FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA") FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA")
SIZE=$(wc -c < /tmp/cto-review-diff.txt) SIZE=$(echo -n "$DIFF" | wc -c)
{ {
echo "size=$SIZE" echo "size=$SIZE"
echo "files<<EOF_FILES" echo "files<<EOF_FILES"
echo "$FILES" echo "$FILES"
echo "EOF_FILES" echo "EOF_FILES"
echo "diff<<EOF_DIFF"
echo "$DIFF"
echo "EOF_DIFF"
} >> "$GITHUB_OUTPUT" } >> "$GITHUB_OUTPUT"
- name: Load repo conventions - name: Load repo conventions
@@ -162,7 +161,7 @@ jobs:
PR_AUTHOR: ${{ github.event.pull_request.user.login }} PR_AUTHOR: ${{ github.event.pull_request.user.login }}
PR_NUMBER: ${{ github.event.pull_request.number }} PR_NUMBER: ${{ github.event.pull_request.number }}
REPO_NAME: ${{ github.event.repository.name }} REPO_NAME: ${{ github.event.repository.name }}
DIFF_PATH: /tmp/cto-review-diff.txt DIFF: ${{ steps.diff.outputs.diff }}
DIFF_SIZE: ${{ steps.diff.outputs.size }} DIFF_SIZE: ${{ steps.diff.outputs.size }}
CHANGED_FILES: ${{ steps.diff.outputs.files }} CHANGED_FILES: ${{ steps.diff.outputs.files }}
CONVENTIONS: ${{ steps.conventions.outputs.content }} CONVENTIONS: ${{ steps.conventions.outputs.content }}
@@ -230,9 +229,7 @@ jobs:
user_blocks.append(f"**Changed files:**\n```\n{os.environ['CHANGED_FILES']}\n```\n") user_blocks.append(f"**Changed files:**\n```\n{os.environ['CHANGED_FILES']}\n```\n")
if os.environ.get("CONVENTIONS", "").strip(): if os.environ.get("CONVENTIONS", "").strip():
user_blocks.append(f"# Repo CONVENTIONS.md\n{os.environ['CONVENTIONS']}\n") user_blocks.append(f"# Repo CONVENTIONS.md\n{os.environ['CONVENTIONS']}\n")
with open(os.environ["DIFF_PATH"], encoding="utf-8", errors="replace") as _df: user_blocks.append(f"# Diff\n```diff\n{os.environ['DIFF']}\n```\n")
_diff_text = _df.read()
user_blocks.append(f"# Diff\n```diff\n{_diff_text}\n```\n")
user_message = "\n\n".join(user_blocks) user_message = "\n\n".join(user_blocks)
tools = [{ tools = [{

View File

@@ -71,7 +71,7 @@ jobs:
deploy-production: deploy-production:
name: Deploy to Production name: Deploy to Production
needs: [validate, deploy-staging] needs: [validate, deploy-staging, smoke]
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: production environment: production
steps: steps: