Skip to content

fix: full pricing snippet and suppress engine error on missing model pricing - #48594

Merged
pelikhan merged 4 commits into
mainfrom
copilot/review-no-model-pricing-error-template
Jul 28, 2026
Merged

fix: full pricing snippet and suppress engine error on missing model pricing#48594
pelikhan merged 4 commits into
mainfrom
copilot/review-no-model-pricing-error-template

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

When a model has no pricing configured, the failure issue showed an incomplete YAML snippet (missing cache fields) and a noisy engine error block that restated the same root cause.

Changes

  • Full pricing snippet: buildManualModelPricingFrontmatterSnippet now emits all four cost fields so users can fill in actual values without guessing the schema:

    cost:
      input: "0e0"       # $0.00 per million input tokens
      output: "0e0"      # $0.00 per million output tokens
      cache_read: "0e0"  # $0.00 per million cache-read tokens
      cache_write: "0e0" # $0.00 per million cache-write tokens
  • Engine error suppressed: shouldBuildEngineFailureContext now returns false when hasMissingModelPricingError is true. The engine terminates because of the HTTP 400 pricing rejection — the raw stdio dump adds no actionable signal on top of the pricing remediation block.

…rror

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title fix: improve no model pricing error template fix: full pricing snippet and suppress engine error on missing model pricing Jul 28, 2026
Copilot AI requested a review from pelikhan July 28, 2026 11:52
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot ensure the snippet shown in the message has correct yaml syntax

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@copilot ensure the snippet shown in the message has correct yaml syntax

Fixed in the latest commit. The model name key was indented at 10 spaces — same level as cost: — making them siblings in YAML instead of parent/child. The model name is now at 8 spaces so cost: nests correctly under it:

models:
  providers:
    anthropic:
      models:
        claude-3-5-sonnet:
          cost:
            input: "0e0"      # $0.00 per million input tokens
            output: "0e0"     # $0.00 per million output tokens
            cache_read: "0e0"  # $0.00 per million cache-read tokens
            cache_write: "0e0" # $0.00 per million cache-write tokens

@pelikhan
pelikhan marked this pull request as ready for review July 28, 2026 12:09
Copilot AI review requested due to automatic review settings July 28, 2026 12:09
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (default_business_additions=0, file_count=2).

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@pelikhan

Copy link
Copy Markdown
Collaborator

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Improves missing-model-pricing failure reports.

Changes:

  • Adds all four pricing fields to fallback YAML.
  • Suppresses redundant engine errors.
  • Extends regression tests.
Show a summary per file
File Description
actions/setup/js/handle_agent_failure.cjs Updates pricing snippets and error suppression.
actions/setup/js/handle_agent_failure.test.cjs Tests the updated behavior.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Medium

*/
function shouldBuildEngineFailureContext(agentConclusion, hasToolDenialsExceeded, isTimedOut) {
return agentConclusion === "failure" && !hasToolDenialsExceeded && !isTimedOut;
function shouldBuildEngineFailureContext(agentConclusion, hasToolDenialsExceeded, isTimedOut, hasMissingModelPricingError) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 45a7c8c by updating the helper JSDoc to include @param {boolean} hasMissingModelPricingError so the signature and contract are aligned.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes look correct and well-tested.

  • shouldBuildEngineFailureContext correctly suppresses the redundant engine block when pricing is the root cause, with the new parameter wired in both call sites.
  • buildManualModelPricingFrontmatterSnippet now emits all four cost fields — the YAML indentation fix for ${quotedModelName} is also a valid correctness improvement.
  • Tests added for both behaviours.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 14.6 AIC · ⌖ 5.19 AIC · ⊞ 5K

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review

Applied /diagnosing-bugs and /tdd — this is a clean, well-scoped bug fix with good test coverage. No blocking issues found.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 23.5 AIC · ⌖ 4.52 AIC · ⊞ 6.7K
Comment /matt to run again

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 85/100 — Excellent

Analyzed 2 test(s): 2 design, 0 implementation, 0 violation(s).

📊 Metrics (2 tests)
Metric Value
Analyzed 2 (Go: 0, JS: 2)
✅ Design 2 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 1 (50%)
Duplicate clusters 0
Inflation No (0.6:1)
🚨 Violations 0
Test File Classification Issues
shouldBuildEngineFailureContext returns false when missing model pricing error is present handle_agent_failure.test.cjs:2232 behavioral_contract, high_value, design_test None
quotes model names when building frontmatter pricing snippets (2 new assertions) handle_agent_failure.test.cjs:3149 behavioral_contract, high_value, design_test None

Verdict

passed. 0% implementation tests (threshold: 30%). Tests cover both new behaviors: suppression of engine error context when missing model pricing, and inclusion of cache_read/cache_write fields in the pricing YAML snippet.

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 · 41.1 AIC · ⌖ 8.76 AIC · ⊞ 8.1K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: 85/100. 0% implementation tests (threshold: 30%). Both new tests cover behavioral contracts directly tied to the production changes.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small, correct fix; no blocking issues found — two minor non-blocking notes left inline.

Themes
  • The shouldBuildEngineFailureContext suppression logic and buildManualModelPricingFrontmatterSnippet cache-field addition are both logically sound and covered by new tests.
  • Left two low/medium-severity comments: (1) manual pricing fallback presents cache_read/cache_write as confirmed $0 rather than a placeholder, and (2) the new boolean parameter lacks an explicit default, relying on implicit undefined-to-falsy coercion.
  • Neither issue is a correctness bug in the current call sites; both are hardening suggestions.

🔎 Code quality review by PR Code Quality Reviewer · sonnet50 · 51.4 AIC · ⌖ 4.39 AIC · ⊞ 7.4K
Comment /review to run again

*/
function buildManualModelPricingFrontmatterSnippet(modelName, engineId) {
return buildModelPricingFrontmatterSnippet(modelName, engineId, { input: 0, output: 0 });
return buildModelPricingFrontmatterSnippet(modelName, engineId, { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Manual pricing fallback now always shows cache_read/cache_write at $0.00, which could mislead users into thinking $0 is a confirmed rate rather than a placeholder for engines/models that do not support prompt caching at all.

💡 Details

All four fields are now hardcoded as { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }. For engines/models with no caching support, presenting cache_read: "0e0" # $0.00 per million cache-read tokens reads as an authoritative confirmed price rather than a fill-in placeholder. Consider a comment noting these are placeholders, or omitting cache fields when the engine is known not to support caching.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 45a7c8c by marking the manual zero-value pricing block as placeholders in the generated YAML snippet, so the values are clearly guidance to replace.

*/
function shouldBuildEngineFailureContext(agentConclusion, hasToolDenialsExceeded, isTimedOut) {
return agentConclusion === "failure" && !hasToolDenialsExceeded && !isTimedOut;
function shouldBuildEngineFailureContext(agentConclusion, hasToolDenialsExceeded, isTimedOut, hasMissingModelPricingError) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new hasMissingModelPricingError parameter has no default value, so it silently relies on JS undefined-to-falsy coercion for any caller that omits it.

💡 Details

shouldBuildEngineFailureContext(agentConclusion, hasToolDenialsExceeded, isTimedOut, hasMissingModelPricingError) works today only because both call sites and the pre-existing 3-arg unit tests happen to pass undefined which coerces to falsy. This is accidentally-correct rather than defensively-correct: a future refactor (param reordering, or inserting a 5th flag before this one) could silently change behavior with no type error. Suggest hasMissingModelPricingError = false as an explicit default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 45a7c8c by defaulting hasMissingModelPricingError = false in shouldBuildEngineFailureContext so omitted arguments are handled explicitly.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix typecheck issues https://github.com/github/gh-aw/actions/runs/30357766324/job/90269950794?pr=48594

Fixed in commit 72b5398. I addressed the reported typecheck failures by updating the safe output validator JSDoc type definition for data fields and adjusting the schema variable initialization in safe output handlers; local typecheck and targeted tests now pass.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Done. I ran the PR-finisher pass and pushed 45a7c8c, which addresses all unresolved in-scope review feedback on this PR. Local validation passed (make fmt, make lint, make test-unit, make test, plus make recompile).

@pelikhan
pelikhan merged commit d283192 into main Jul 28, 2026
8 of 9 checks passed
@pelikhan
pelikhan deleted the copilot/review-no-model-pricing-error-template branch July 28, 2026 12:42
Copilot stopped work on behalf of pelikhan due to an error July 28, 2026 12:43
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.83.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants