Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 14, 2026, 8:01 AM ET / 12:01 UTC. ClawSweeper reviewWhat this changesThis PR wraps malformed JSON errors from Google prompt-cache responses with cache-specific context and adds a test for an invalid successful response. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 9 items remain Keep this PR open: the parser-level fix is in the right owner, but its added regression test already passes against the raw current behavior and therefore does not prove the new diagnostic. Priority: P3 Review scores
Verification
How this fits togetherThe embedded Google agent runner creates or refreshes provider-side prompt caches before streaming a model response. Successful cache API responses are size-bounded, parsed, and then used to either attach cached content or continue without it. flowchart LR
A[Agent prompt] --> B[Google cache request]
B --> C[Size-bounded response]
C --> D[JSON parsing]
D --> E[Cache entry]
E --> F[Model stream]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +6, Tests +26. Total +32 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the parse-owner wrapper, assert its contextual prefix rather than the generic parser text, preserve the original error as its cause, and add redacted provider-boundary proof. Do we have a high-confidence way to reproduce the issue? Yes at source level: a successful cache response with malformed JSON reaches the raw parser through cache creation. A live Google response-path reproduction was not supplied. Is this the best way to solve the issue? No. Catching at the parse owner is the right shape, but the current test does not prove the new contextual message; preserve the original error as a cause while making the assertion specific. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 94cdb6c46e12. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(agents): wrap JSON.parse in readGooglePromptCacheJson with descriptive error This is item 3/3 in the current shard. Shard 23/41. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Closing in favor of newer PR with updated implementation. |
Summary
readGooglePromptCacheJsonat line 296 callsJSON.parse(buffer.toString("utf8"))without a try/catch. If the Google cachedContents endpoint returns a non-JSON response (e.g., HTML error page, truncated body), a rawSyntaxErrorpropagates with no context about its origin.JSON.parsein a try/catch and throw a descriptiveErrorthat identifies the response as a Google prompt cache response.src/agents/embedded-agent-runner/google-prompt-cache.ts- added try/catch with descriptive error;src/agents/embedded-agent-runner/google-prompt-cache.test.ts- added regression test with non-JSON response.Real behavior proof
SyntaxError: Unexpected token 'o', "not-json-at-all" is not valid JSONwith no indication of which API call failed.preparePromptCacheStreamwith a mock fetch returning"not-json-at-all"as the response body.Regression Test Plan
src/agents/embedded-agent-runner/google-prompt-cache.test.tspreparePromptCacheStreamto reject with an error matching/not valid JSON/i.Root Cause