I encountered what appears to be an internal credential expiration issue with a Gemini 4 Argon background Interaction.
Environment:
Model: gemini-4-argon
API: Interactions API
Background execution: enabled
Service tier: Flex
Thinking level: low
Python SDK: google-genai 2.29.0
Approximate failure time: October 23, 2026, 12:57 UTC
Final status: 401 UNAUTHENTICATED
Elapsed time shown by the client: approximately 364 seconds
The Interaction was accepted successfully and remained in progress while being polled. It eventually failed with this error in Google AI Studio:
Agent finished with error: Failed to close Interaction stream: Rejected by RpcSecurityPolicy for /GenerativeService.StreamGenerateContent: mint used too late, now=2026-10-23T05:57:50.233662941-07:00, not_after=2026-10-23T05:56:51-07:00, not_before=2026-10-23T05:50:51-07:00; UberMint invalid
The internal mint appears to have been valid for six minutes and had expired by approximately 59 seconds when Google attempted to close the Interaction stream.
The same authorization key:
successfully works with regular generateContent requests;
successfully works with Gemini 3.8 Flash and Gemini 4 Argon Standard;
had also successfully completed an earlier Gemini 4 Argon Flex background Interaction.
This suggests that the external API key itself is valid and that the failure occurred because an internal credential was not refreshed during the long-running background execution.
Expected behavior:
A background Interaction should remain authenticated until it completes, even when generation takes longer than the lifetime of an internal credential.
Could you please confirm:
Whether this is a known issue with long-running Gemini 4 Argon background Interactions;
Whether internal credentials should be refreshed automatically;
Whether failed Interactions of this type may still incur token charges;
Whether any client-side workaround is currently recommended.
I can provide the Interaction ID and Google Cloud project information privately to a Google team member if needed.
Thanks for the detailed report and reproduction script.
The earlier update covered polling for long-running background interactions rather than keeping an event stream open past about 5 minutes. For runs that take longer than 5 minutes, create the interaction with background: true and store: true (without stream: true) and poll GET until completion, as shown in the Background execution polling guide.
Thanks for looking into this and for your reply. My understanding is that you are advising us to move to polling for long-running Gemini background tasks, so we will go with that recommendation.
One question and one request:
Is the limit of about 5 minutes on an open stream intended? The background execution guide shows the streaming pattern with no time limit. When the limit is reached, the Interaction itself is marked failed, so the guide’s reconnect loop has nothing to resume. If the limit is intended, it would help to state it in the guide.
Streaming lets us show agent activity to users, which builds confidence that the run is still going (it hasn’t stalled or hit an error) and that it is taking appropriate steps for the request. With polling we lose that: the details of what happened and what evidence was read are only available once the run completes. This is a UX deficiency, IMHO. Ideally, reaching the stream limit would close the stream without failing the run, so a client could reconnect with last_event_id. Alternatively, a polled Interaction could return its steps while it is in progress. Kindly consider this a product enhancement request.