Skip to content

feat(eval): report quality-constrained localization cost - #427

Merged
fishmingyu merged 2 commits into
mainfrom
feat/quality-cost-report
Aug 5, 2026
Merged

feat(eval): report quality-constrained localization cost#427
fishmingyu merged 2 commits into
mainfrom
feat/quality-cost-report

Conversation

@fishmingyu

Copy link
Copy Markdown
Member

Summary

Adds an auditable cost-per-success evaluation path for repository localization. The report applies a paired localization-quality guard before choosing the least-cost policy, preserves raw usage provenance, and treats unpriced or incomplete usage as unavailable rather than free.

Closes #426.

Changes

  • Preserve prompt, completion, cache-read, cache-write, and cost-calculator provenance in query-sweep cells, including failure records.
  • Add recursive result loading with duplicate, retry, denominator, model, query, and arm audits.
  • Report token and USD cost per successful localization only after a repository-clustered paired quality guard.
  • Add explicit arm allowlists, portable input provenance, immutable content-hashed pricing snapshots, CLI documentation, and package data.
  • Validate retained five-model, 500-query-per-model results without issuing new model calls.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Performance improvement
  • Tests

Testing

  • Tests pass locally
  • Added new tests for the changes

Validated with:

  • pytest -m "not slow and not integration and not integration_serial and not integration_serial_consumer" -x --tb=short (2552 passed, 10 skipped, 183 deselected)
  • pre-commit run --all-files
  • mkdocs build --strict and python scripts/check_public_docs.py
  • frontend production build required by wheel packaging
  • wheel build, isolated installation, and codenib-quality-cost-report smoke on the retained 500-query Gemini result set
  • five-model report audit: 8,500 input cells, 7,500 analyzed cells, 2,500 strictly paired queries across 25 repositories per model

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Copilot AI lite review requested due to automatic review settings August 5, 2026 08:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@fishmingyu
fishmingyu marked this pull request as ready for review August 5, 2026 08:08
@github-actions github-actions Bot added type/docs Documentation type/test Test-related type/chore Build, CI, dependency updates scope/agent Agent runner, skills, tool execution scope/eval Evaluation, baselines, experiment scripts scope/llm LiteLLM chat, prompts labels Aug 5, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c833068dc4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"claude-haiku-4-5-20251001"
],
"channel": "anthropic-api-direct",
"token_semantics": "prompt_excludes_cache",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fix Anthropic cache-hit repricing

When this bundled snapshot is used to reprice CodeNib cells produced through LiteLLM, Anthropic cache hits are overbilled: LiteLLM documents prompt_tokens as including cache-hit input tokens (https://docs.litellm.ai/docs/completion/prompt_caching), but prompt_excludes_cache makes project_cell_cost() leave those tokens in uncached_input and also add them again as cache_read_input whenever cache_read_input_tokens > 0. This inflates projected USD for cached runs and can change the constrained optimum, so the Anthropic/LiteLLM snapshot needs semantics that subtract cached reads (or a separate read/write-aware mode).

Useful? React with 👍 / 👎.

required = {
"model",
"instance_id",
"query_id",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept per-instance sweep cells

When users pass a complete output directory from the existing run_sweep() path, every cell is skipped as a non-cell because those records include instance_id, subset_id, model, and rep but no query_id (checked codenib/eval/agent_runner/sweep.py), while the new docs say complete sweep directories are valid inputs. That makes the CLI fail with no agent-runner cells found for those sweep artifacts; either emit a stable query id for run_sweep() cells (for example the instance id) or narrow the loader/docs to query-sweep outputs only.

Useful? React with 👍 / 👎.

Comment on lines +82 to +83
if not _looks_like_cell(value):
skipped_non_cells += 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include recorded load failures in denominators

When a query sweep records an instance-level load failure, that failure lives only in query_sweep_summary.json (checked the run_query_sweep() load-exception path), but the new loader discards every non-cell JSON file here. As a result, a complete sweep directory can silently drop all planned attempts for a failed repository, so strict denominators still pass and the report contradicts its infrastructure_failures_score_zero_quality contract by biasing cost and quality toward the instances that loaded successfully.

Useful? React with 👍 / 👎.

Persist prompt, completion, cache, and cost provenance fields in agent-runner cells, including schema-complete failure records. Correct the provider-specific cache token documentation and retain the LiteLLM calculator version for runtime estimates.\n\nVerified with focused runner tests, the full unit tier, and pre-commit.
Add strict recursive cell and retry audits, repository-clustered paired quality guards, token and USD cost per successful localization, and constrained arm selection. Bundle an immutable direct-provider pricing schema while keeping runtime estimates and local-model prices explicit.\n\nValidated against the retained five-model 500-query study without model calls. The report records 8,500 input cells, 7,500 analyzed cells, and explicit exclusion of unrelated Haiku arms.\n\nVerified with 2552 unit tests, pre-commit, strict docs, a built wheel, and an installed console-script smoke.
Copilot AI review requested due to automatic review settings August 5, 2026 08:40
@fishmingyu
fishmingyu force-pushed the feat/quality-cost-report branch from c833068 to 437e955 Compare August 5, 2026 08:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@fishmingyu
fishmingyu merged commit 025fc7e into main Aug 5, 2026
4 checks passed
@fishmingyu
fishmingyu deleted the feat/quality-cost-report branch August 5, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/agent Agent runner, skills, tool execution scope/eval Evaluation, baselines, experiment scripts scope/llm LiteLLM chat, prompts type/chore Build, CI, dependency updates type/docs Documentation type/test Test-related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(eval): report quality-constrained cost per localization

2 participants