Commit Graph

16 Commits

Author SHA1 Message Date
Luis Pater
06225fcf6e fix(antigravity): preserve signature cache scope on first refresh
- Retain the pre-refresh grant identity when initializing signature cache metadata for legacy credentials.
- Add a regression test proving cached Claude thinking signatures remain recoverable after the first token rotation.

Closes: #7968
2026-11-24 07:06:15 +08:00
Luis Pater
85225381d8 fix(antigravity): isolate signature cache by credential
- Scope Claude signature recovery and writes to the active credential.
- Preserve scoped cache continuity across verified token refreshes.
- Fail closed for unscoped recovery and credential replacement.
- Add stream and non-stream multi-account isolation regression coverage.

Closes: #7960
2026-11-23 22:46:33 +08:00
Luis Pater
d2086b4c17 fix(antigravity): guard credits refresh and project discovery on config and disabled auth
- Guard maybeRefreshAntigravityCreditsHint, queueAntigravityCreditsRefresh, and updateAntigravityCreditsBalanceForTask so Cloud Code PA credits queries are skipped when antigravity-credits is disabled or the auth is Disabled/StatusDisabled.
- Skip ensureAntigravityProjectID and post-refresh credits queueing in refreshTokenWithOptions (and guard ensureAntigravityProjectID directly) for Disabled/StatusDisabled credentials while keeping OAuth token refresh active.
- Add synctest-based race-safe regression tests for Issue #7785 and enable AntigravityCredits in existing credits unit test fixtures that exercise loadCodeAssist.

Closes: #7785
2026-11-22 14:02:47 +08:00
Luis Pater
d3e4db8b06 fix(antigravity): scope 403 validation and 401 inference errors to credential
- Mark Antigravity 403 VALIDATION_REQUIRED and 401 inference/auth errors as credential-scoped and close idle pooled transports on 403 TOS_VIOLATION and VALIDATION_REQUIRED.
- Propagate non-429 credential-scoped cooldowns to auth-level retry state and model projections so sibling models stop selecting blocked credentials.
- Separate refresh-clearable auth/grant cooldowns from non-auth credential cooldowns across OAuth refresh, token rotation, shadow unwrapping, and restart recovery.

Closes: #7814
2026-11-22 02:08:57 +08:00
Luis Pater
cec8a7f390 fix(proxyutil): honor context cancellation on SOCKS5 HTTP transports
- Delegate SOCKS5/SOCKS5H Transport.DialContext calls in BuildHTTPTransport through proxy.ContextDialer so caller deadlines and cancellation abort stalled dials and handshakes without adding a fixed dialer timeout.
- Isolate Antigravity project-discovery HTTP/1.1 transports via newAntigravityProjectDiscoveryHTTPClient with deferred CloseIdleConnections so canceled credential acquisition cancels abandoned in-flight dials without affecting the shared pool.
- Add SOCKS5/SOCKS5H cancellation, deadline, tunnel, and HTTP client regression tests verifying prompt request exit and peer socket closure.

Closes: #7819
2026-11-22 02:08:54 +08:00
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