Files
imeai-aKode/akode-rs/http-client
andrea.difonzo 854c7a66c9 aKode: rimossa la memoria nativa di Codex e le funzioni senza codice; meno chiamate al modello
Memoria nativa (memories) rimossa del tutto:
- features: memories, memory_tool, external_agent_memory_import, chronicle
  (alias telepathy) diventano Removed; le chiavi restano accettate e
  memories/memory_tool/[memories] producono un solo avviso senza link
  («La sezione [memories] e la chiave memory_tool non sono più usate da
  aKode: la memoria a lungo termine è il plugin memoria di imeAI.»).
- Tolti i crate memories/read, memories/write ed ext/memories, l'avvio
  della pipeline a ogni turno (app-server), l'estensione, /memories e la
  richiesta di attivazione nella TUI, `akode debug clear-memories`,
  l'importazione delle memorie da altri agenti (memory_import.rs,
  detect/memory.rs; il resto di /import resta).
- core: niente più MemoriesConfig, citazioni delle memorie, metriche e
  marcatura «polluted» dei thread; [memories] (MemoriesToml) resta solo
  come sezione accettata e ignorata.
- state: memories_1.sqlite e memories_v2_1.sqlite non vengono più aperti né
  cancellati; la colonna threads.memory_mode resta, nessuna migrazione.
- Protocollo app-server invariato per compatibilità col daemon:
  memory/reset risponde «non supportato» senza cancellare nulla,
  memory/status non è mai pronto, thread/memory/read non ha riassunto.

Altre rimozioni:
- I 14 flag dell'app desktop di OpenAI senza codice (tool_suggest,
  in_app_*, browser_use*, computer_use, bedrock_setup_wizard,
  workspace_dependencies) e analytics_plan_history: Removed, chiavi
  accettate; analytics_plan_history esce da /experimental.
- Skill: tolto l'esperimento «shadow selection» e i selettori collegati.

Meno chiamate al modello non richieste:
- Titoli dei thread: il primo messaggio dell'utente su una riga, troncato a
  36 caratteri; `[tui] auto_title = true` riattiva i titoli generati.
- `[tui] auto_recap` predefinito false; `goals` spento di default.

Privacy: installation_id e gli id di sessione/thread/finestra (e il blocco
dei metadati del turno che li ripete) vanno in client_metadata e negli
header di compatibilità solo ai provider locali (loopback, IP privati
10/8, 172.16/12, 192.168/16, host .local/.lan).

Domini OpenAI: tolti i link visibili (avviso dei flag deprecati, profili,
bubblewrap), l'attribuzione Codex nei commit (sempre spenta), la
riscrittura dell'URL della documentazione OpenAI via MCP e la
registrazione remota dell'exec-server verso host OpenAI (ora solo
loopback); il riconoscimento delle destinazioni OpenAI confronta i domini
etichetta per etichetta. Il binario non contiene più «openai.com» né
«chatgpt.com».

Test adattati (sicurezza compresa: guardian, ruolo ostile, exec-server
ora più restrittivo); rimossi solo quelli del codice tolto.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 00:49:41 +01:00
..

akode-http-client

akode-http-client is the low-level HTTP transport shared by Codex crates. It is the intended owner of the workspace's direct reqwest integration; product crates should use the types in this crate instead of constructing reqwest::Client values themselves.

Centralizing client construction keeps outbound requests on the same policies and avoids creating short-lived clients that fragment reqwest's connection pool. In particular, this crate owns:

  • the request, response, streaming, and transport types used for outbound HTTP calls;
  • custom CA handling through AKODE_CA_CERTIFICATE and SSL_CERT_FILE;
  • explicit outbound proxy policy, including system, PAC/WPAD, environment, and direct routes;
  • route-aware client pooling and redirect handling;
  • tracing-header injection and optional request diagnostics.

Another important motivation is consistent support for the respect_system_proxy feature. That feature requires more than enabling reqwest's default proxy behavior: Codex must resolve platform system settings and PAC/WPAD for each destination, pool connections without mixing routes, and resolve redirect targets independently.

Higher-level retry, SSE, and request-attempt telemetry policy remains in akode-client.

Outbound proxy policy

Construct one HttpClientFactory from the effective application configuration and pass it to the components that make requests. Call sites should not independently inspect the feature flag or choose OutboundProxyPolicy::ReqwestDefault.

The factory's policy has two modes:

  • RespectSystemProxy resolves the route for the complete request URL. Platform system settings and PAC/WPAD are considered first, followed by explicit proxy environment variables and then a direct connection.
  • ReqwestDefault preserves the transport's legacy proxy behavior. It exists for configurations where system-proxy support is disabled, not as a convenient default for new call sites.

These two modes exist because respect_system_proxy is currently configurable. If it graduates to non-configurable built-in behavior, the application-level feature resolution, policy selection, and most conditional ReqwestDefault plumbing can go away. The route-aware implementation would still be needed: system and PAC decisions can vary by complete URL, redirects can select a different route, and exceptional direct-routing requirements must remain explicit and auditable.

For a client that talks to one known destination, build it once and retain it:

use akode_http_client::ClientRouteClass;

let client = http_client_factory.build_client(api_url, ClientRouteClass::Api)?;
let response = client.get(api_url).send().await?;

Use HttpClientBuilder when the client needs additional shared configuration:

use akode_http_client::ClientRouteClass;
use akode_http_client::HttpClientBuilder;

let client = HttpClientBuilder::new()
    .default_headers(default_headers)
    .build_respecting_outbound_proxy_policy(
        &http_client_factory,
        api_url,
        ClientRouteClass::Api,
    )?;

The terminal method is intentionally explicit. Product traffic should normally use build_respecting_outbound_proxy_policy. build_direct is exceptional-use-only and should be reserved for a documented requirement such as a hermetic local test fixture, localhost callback, or sandbox traffic whose egress routing is handled separately. The transport-default and custom-CA-fallback terminal methods are deprecated legacy compatibility paths and must not be used for new product traffic.

Route-aware pooling

Use a long-lived RouteAwareClientPool when a component can send requests to more than one URL or follow redirects:

use akode_http_client::ClientRouteClass;
use akode_http_client::RouteAwareClientPool;

let client_pool =
    RouteAwareClientPool::new(http_client_factory.clone(), ClientRouteClass::Api);
let response = client_pool.get(request_url).send().await?;

With RespectSystemProxy, proxy selection can depend on the full URL rather than only its origin. The pool therefore resolves every request URL and caches up to 16 transport clients by resolved route. This preserves connection reuse without accidentally sending a URL over a client pinned to the wrong route.

Redirects need the same treatment. Reqwest normally follows them inside one client execution, which would skip Codex's route selection for the redirect target. In RespectSystemProxy mode the pool follows redirects itself, resolves every hop, and removes sensitive headers when an origin changes.

Do not create a new HttpClient, HttpClientFactory, or RouteAwareClientPool for every request. Store the client or pool on the component that owns the traffic so its connections can be reused.

Sensitive request data

Normal clients emit debug diagnostics containing the request URL and response headers. For endpoints where those values may contain credentials, use HttpClientFactory::build_client_without_request_logging or RouteAwareClientPool::new_without_request_logging.

The wrapper's Debug implementations redact request URLs and resolved proxy settings, but callers should still avoid putting secrets in URLs whenever possible.

Adapting to higher-level clients

Code using the transport abstraction should convert a configured wrapper rather than constructing a raw reqwest client:

use akode_http_client::ClientRouteClass;
use akode_http_client::ReqwestTransport;

let client = http_client_factory.build_client(api_url, ClientRouteClass::Api)?;
let transport = ReqwestTransport::from_http_client(client);

If the existing wrapper surface cannot support a use case, extend akode-http-client rather than adding a direct reqwest dependency to another first-party crate.