Skip to content

fix(google): surface blocked prompts and preserve usage accounting - #116756

Merged
steipete merged 1 commit into
mainfrom
codex/auto-qa-google-feedback
Jul 31, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/auto-qa-google-feedback

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • Surface a visible, typed PROMPT_BLOCKED error when Gemini returns prompt safety feedback without a response candidate or explicit block reason.
  • Preserve observed token usage and cost on the rejected response across both the SDK and direct Google/Vertex transports.

Verification

  • Google owner and shared transport suites: 108 tests passed.
  • A separate reviewer reran 8 exact blocked-prompt regressions and inspected official Gemini safety contracts, the installed SDK types, Vertex siblings, and error lifecycle ownership; no blockers.
  • Automated autoreview is unavailable because the mandatory TruffleHog binary is missing; independent manual diff and secret review completed.

Root causes fixed

1 canonical blocked-response lifecycle defect affecting Google and Vertex transports.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 31, 2026
@clawsweeper

clawsweeper Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 31, 2026, 7:09 AM ET / 11:09 UTC.

ClawSweeper review

What this changes

The PR makes Gemini and Vertex prompt-safety blocks return typed errors and retains observed token usage and calculated cost when the provider rejects a prompt before producing a candidate.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 3 items remain

Keep this PR open for human review. The patch has no concrete correctness finding from the supplied diff, but it still lacks inspectable after-fix evidence from a real blocked Google or Vertex request; its protected maintainer label also requires explicit maintainer handling. Likely related people: steipete is the visible recent contributor on this repair (low-confidence routing; local history inspection was unavailable).

Priority: P2
Reviewed head: 5d54a360edf685071c4440b1e4350a1174bd5d4d

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation is focused and regression-covered, but merge readiness is capped by missing real provider behavior proof.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR reports 108 automated tests and a manual contract review, but no inspectable redacted after-fix output from a real blocked Google or Vertex request; add a terminal capture, runtime log, or linked live artifact and redact private details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR reports 108 automated tests and a manual contract review, but no inspectable redacted after-fix output from a real blocked Google or Vertex request; add a terminal capture, runtime log, or linked live artifact and redact private details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Changed shared lifecycle: The shared Google lifecycle records usage metadata before recognizing a candidate-less prompt-feedback block, then assigns a typed Google prompt-blocked error; this preserves accounting on the rejected response.
Changed direct transport: The bundled Google streaming transport recognizes promptFeedback without a candidate and raises a typed error after updating usage for the incoming chunk.
Regression coverage added: The branch adds Google and Vertex cases for explicit and absent provider block reasons in both the shared lifecycle and direct transport tests.
Findings None None.
Security None None.

How this fits together

Google provider requests enter either the bundled Google transport or the shared AI lifecycle, which convert streamed provider chunks into an assistant result. Prompt feedback and usage metadata must survive that conversion so callers receive a visible failure and accurate accounting.

flowchart LR
  A[Google or Vertex request] --> B[Streaming provider response]
  B --> C[Prompt feedback and usage metadata]
  C --> D[Google transport or shared lifecycle]
  D --> E[Assistant result]
  E --> F[Visible typed error]
  E --> G[Usage and cost accounting]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR reports 108 automated tests and a manual contract review, but no inspectable redacted after-fix output from a real blocked Google or Vertex request; add a terminal capture, runtime log, or linked live artifact and redact private details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - Merging without redacted after-fix output from a real blocked Google or Vertex request leaves the provider’s actual streamed prompt-feedback shape and resulting visible error/accounting behavior unverified outside mocks and fixtures.
  • Complete next step (P2) - Human review is required because the PR has the protected maintainer label and needs contributor-supplied real provider behavior proof before merge.
Agent review details

Security

None.

PR surface

Source +24, Tests +115. Total +139 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 46 22 +24
Tests 2 115 0 +115
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 161 22 +139

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Add a redacted terminal capture, runtime log, or linked live-output artifact showing a real Google or Vertex blocked prompt produces the typed error and retains usage/cost, then complete maintainer review of the exact head.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Add a redacted terminal capture, runtime log, or linked live-output artifact showing a real Google or Vertex blocked prompt produces the typed error and retains usage/cost, then complete maintainer review of the exact head.

Do we have a high-confidence way to reproduce the issue?

No live current-main reproduction was provided, but the source-level path is clear: a streamed Google or Vertex response with promptFeedback and no candidate reaches the newly covered error path.

Is this the best way to solve the issue?

Yes, provisionally. Handling the condition at the shared lifecycle and direct transport boundaries addresses both provider paths while preserving the usage metadata observed in the same streamed chunk.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 718e9c882047.

Labels

Label justifications:

  • P2: This is a focused provider reliability and observability repair with limited blast radius, pending real behavior proof.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR reports 108 automated tests and a manual contract review, but no inspectable redacted after-fix output from a real blocked Google or Vertex request; add a terminal capture, runtime log, or linked live artifact and redact private details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Changed shared lifecycle: The shared Google lifecycle records usage metadata before recognizing a candidate-less prompt-feedback block, then assigns a typed Google prompt-blocked error; this preserves accounting on the rejected response. (packages/ai/src/providers/google-shared.ts:779, 5d54a360edf6)
  • Changed direct transport: The bundled Google streaming transport recognizes promptFeedback without a candidate and raises a typed error after updating usage for the incoming chunk. (extensions/google/transport-stream.ts:1347, 5d54a360edf6)
  • Regression coverage added: The branch adds Google and Vertex cases for explicit and absent provider block reasons in both the shared lifecycle and direct transport tests. (extensions/google/transport-stream.test.ts:541, 5d54a360edf6)
  • Prior review continuity: The prior ClawSweeper cycle reported no code findings and requested real behavior proof. The current PR body still reports automated tests and manual inspection, not inspectable after-fix runtime output. (9299d92aa747)
  • Current validation state: The supplied check state shows multiple repository checks already succeeding, while build, lint, type, compact-node, and QA Smoke checks are still in progress; this is not treated as a defect or priority escalation. (5d54a360edf6)

Likely related people:

  • steipete: Authored the current focused Google blocked-prompt repair; no local git-history result was available to establish broader ownership from current main. (role: recent area contributor; confidence: low; commits: 5d54a360edf6; files: extensions/google/transport-stream.ts, packages/ai/src/providers/google-shared.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted after-fix live output for a blocked Google or Vertex prompt, including the typed error and retained usage/cost.
  • Allow the in-progress repository checks to finish against the current head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-07-31T10:09:59.338Z sha 9299d92 :: needs real behavior proof before merge. :: none

@steipete
steipete force-pushed the codex/auto-qa-google-feedback branch from 9299d92 to 5d54a36 Compare July 31, 2026 11:05
@steipete
steipete merged commit 0d40cfb into main Jul 31, 2026
120 checks passed
@steipete
steipete deleted the codex/auto-qa-google-feedback branch July 31, 2026 11:29
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

extensions: google maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant