fix(agent): consume Gemini replay metadata once - #3824
Conversation
Provider replay metadata describes one signed assistant response and is valid only for the immediately following provider request. Record source/runtime message pairs during conversion, trim unsupported assistant tails, and consume only attachments that remain in the outbound prompt. Constraint: Gemini 3 requires the exact signed function-call part on its matching tool-result leg. Rejected: Delete metadata while converting every assistant message | trailing assistant messages may be trimmed without being sent. Confidence: high Scope-risk: narrow Directive: Keep history conversion non-consuming and consume replay metadata only after an assistant message survives provider-request trimming. Tested: Three-request generate, legacy stream, active stream, trimmed-assistant replay, 110-step focused matrix, typecheck, lint, format, anti-slop, docs checks. Not-tested: Live credentialed Gemini request.
|
@codex review |
|
@coderabbitai review |
📦 Client bundle boundary
A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in |
|
|
Warning Review limit reached
Next review available in: 36 minutes Limit details: You’ve used all 1 included review currently available under your plan. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Closing as invalid after Primary source: https://ai.google.dev/gemini-api/docs/generate-content/thought-signatures#sequential_function_calling_example |
Summary
Follow-up to #3820 and veryfront/veryfront-issue-inbox#549. The internal WeakMap replay metadata added by #3820 was read without being consumed, so a signature from tool step 1 could be replayed again on tool step 3 alongside the current signature. Gemini rejects that stale cross-step replay.
This change makes provider-request replay metadata single-use while preserving ordinary/history conversion behavior. Metadata is consumed only for assistant runtime messages that remain in the final outbound prompt; a trailing assistant message trimmed from the current request retains its metadata for the later request that actually sends it.
RED → GREEN
[signature1, signature2]on request 3 instead of only[signature2].Verification
deno check, lint, format, diff check, anti-slop, test-typecheck, public/error docs, and pinned Deno 2.7.7 API docs checks green.Fixes veryfront/veryfront-issue-inbox#549