Commit Graph

11 Commits

Author SHA1 Message Date
Luis Pater
cdbda2f2dc fix(antigravity): persist execution-time token refreshes and preserve refresh context values
- Route Antigravity execution-time OAuth refreshes through a Manager refresh coordinator that serializes per-credential refreshes, persists rotated tokens with detached cancellation, updates in-flight MarkResult auth state, and keeps Home-dispatched snapshots isolated from local credentials.
- Preserve non-cancellation context values such as httptransport.Decorator and custom round trippers via context.WithoutCancel while stripping execution-scoped RequestProxyURL across OAuth refresh, project discovery, and credits hint refreshes.
- Add race-tested regression tests covering single refresh persistence, client cancellation, project discovery failure, safety-window crossing, unsupported attachments, Home isolation, request preparation context preservation, and proxy isolation.

Closes: #7749
2026-11-21 16:10:40 +08:00
Luis Pater
204be8b9ae fix(antigravity): preserve project discovery error classification
- Classify genuinely missing Antigravity project_id as a credential-scoped 503 instead of HTTP 400 so broken credentials cool down and rotate.
- Preserve underlying cause chains, transient transport classification, and request-retry round eligibility for transport timeouts, internal discovery deadlines, and incomplete or transient onboardUser failures.
- Preserve full upstream response bodies, single-attempt discovery after token refresh, and structured TOS_VIOLATION and 429 metadata across loadCodeAssist and onboardUser responses.

Closes: #7751
2026-11-21 15:41:59 +08:00
Luis Pater
2f57a5a67e fix(auth): honor request-scoped-errors, Retry-After, and credential scope on PrepareRequestAuth failure
- Route errPrepare through the same error pipeline as execution errors in all four conductor paths (Execute/CountTokens/Stream/Home): record RetryAfter and CredentialScope, match request-scoped error rules, stop on stop-actions and invalid requests, and preserve the upstream attempt via markUpstreamExecutionAttemptFromContext plus annotateTrustedRetryAfterByHint/syncPreferredUpstreamError so stop responses keep their retry hint.
- Mark upstream attempts only at real HTTP boundaries (OAuth token refresh, project discovery) and propagate upstream Retry-After and credential scope from Antigravity prepare failures, while keeping local missing-credential errors and status-less transport faults from being misclassified or outranking a genuine upstream rejection.

Closes: #7726
2026-11-20 20:56:13 +08:00
Luis Pater
0861f9e1d1 fix(antigravity): align OAuth token refresh transport and User-Agent
- Remove hardcoded Go-http-client/2.0 User-Agent and redundant Host header in refreshTokenSingleFlight so net/http emits a User-Agent matching the negotiated wire protocol.
- Route Antigravity OAuth token refreshes through an isolated HTTP/2-capable client with per-refresh idle connection cleanup while keeping HTTP/1.1 without ALPN scoped to Cloud Code PA endpoints.
- Add real-TLS regression tests covering HTTP/2 negotiation, HTTP/1.1 fallback, CONNECT proxy tunneling, decorator behavior, and per-credential connection isolation.

Closes: #7700
2026-11-20 02:15:31 +08:00
Luis Pater
508f8708d0 chore: replace standard JSON package with moego JSON throughout the project 2026-11-16 09:58:12 +08:00
sususu
d7c3c0aaaa feat(antigravity): trace upstream connection reuse in debug logs 2026-10-02 22:13:24 +08:00
Luis Pater
81756a57e3 fix(auth): track auto-refresh job epochs and bound credential acquisition
- Track auto-refresh jobs with registration epochs to prevent stale or phantom pending states
- Enforce bounded timeouts for Antigravity token refresh and project discovery
- Manage Antigravity credits refresh tasks with epoch validation and lifecycle cancellation

Closes: #6199
2026-09-30 06:57:24 +08:00
Luis Pater
31f4cfab3f feat: migrate CLIProxyAPI to version 8 2026-09-27 14:42:26 +08:00
Luis Pater
7070785140 fix(auth): preserve upstream status codes in antigravity auth errors
- Introduce `HTTPStatusError` to retain upstream HTTP status codes across Antigravity OAuth and project lookup calls.
- Propagate status codes and retry-after metadata from cause errors in `missingAntigravityProjectIDError`.

Closes: #5368
2026-09-01 08:37:02 +08:00
hkfires
6a489fa84d fix(auth): prefer errors from upstream attempts
Track when executor calls cross an upstream transport boundary and use that
signal to keep model/provider errors from being replaced by later local
preparation, selection, or internal failures.

Mark HTTP, websocket, relay, and usage-tracked transports as upstream
attempts, while avoiding marks for local validation, logging, missing
sessions, and successful websocket handshakes before request send.

Parse relative auth expiry metadata and adjust Antigravity refresh timing.
2026-08-29 12:50:46 +08:00
Luis Pater
fe4ae4989c chore(pluginhost): refactor and remove unused interceptors and executor methods
- Removed deprecated interceptor and executor-related methods, including `callRequestInterceptor`, `callResponseInterceptor`, and `callStreamChunkInterceptor`.
- Consolidated unused logic and pruned redundant imports to streamline `adapters.go`.
- No functional changes.
2026-07-26 14:31:45 +08:00