YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(connections): github proxy 403 — inject required User-Agent (#3735)
Ansh Grover7f4e4ca1af8e
diff --git a/crates/screenpipe-connect/src/connections/github_issues.rs b/crates/screenpipe-connect/src/connections/github_issues.rsindex e8e600074..5bdefb28a 100644--- a/crates/screenpipe-connect/src/connections/github_issues.rs+++ b/crates/screenpipe-connect/src/connections/github_issues.rs@@ -41,12 +41,26 @@ impl Integration for GithubIssues {}fn proxy_config(&self) -> Option<&'static ProxyConfig> {+ // GitHub's REST API edge rejects requests with a missing or empty+ // User-Agent before they ever hit auth, returning 403 with body:+ // "Request forbidden by administrative rules. Please make sure+ // your request has a User-Agent header."+ // reqwest 0.13's default Client sends no User-Agent at all, so the+ // proxy MUST inject one for every outbound call. Accept + version+ // headers follow GitHub's documented REST conventions and pin the+ // API version so server-side changes don't surprise pipes.+ // Refs: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#user-agent-required+ // https://docs.github.com/en/rest/overview/api-versionsstatic CFG: ProxyConfig = ProxyConfig {base_url: "https://api.github.com",auth: ProxyAuth::Bearer {credential_key: "api_key",},- extra_headers: &[],+ extra_headers: &[+ ("User-Agent", "screenpipe"),+ ("Accept", "application/vnd.github+json"),+ ("X-GitHub-Api-Version", "2022-11-28"),+ ],};Some(&CFG)}diff --git a/crates/screenpipe-engine/src/connections_api.rs b/crates/screenpipe-engine/src/connections_api.rsindex 266eb960e..51dd5db7c 100644--- a/crates/screenpipe-engine/src/connections_api.rs+++ b/crates/screenpipe-engine/src/connections_api.rs@@ -1695,6 +1695,27 @@ async fn connection_proxy(}}+ // Forward User-Agent and Accept from the caller when present. Two reasons:+ // 1. Some upstreams (e.g. GitHub) reject requests with an empty/missing+ // UA at the edge with 403 — and reqwest's default Client sends no UA.+ // This makes the proxy behave like the caller's HTTP client would.+ // 2. Pipes that hit content-negotiated APIs need to set Accept to pick a+ // media type; silently dropping it forces 406s or wrong serializations.+ // Per-integration `extra_headers` are injected AFTER these and therefore+ // override on key collision — integration policy still wins over caller hint.+ if let Some(ua) = headers.get("user-agent") {+ if let Ok(s) = ua.to_str() {+ if !s.is_empty() {+ req = req.header("user-agent", s);+ }+ }+ }+ if let Some(accept) = headers.get("accept") {+ if let Ok(s) = accept.to_str() {+ req = req.header("accept", s);+ }+ }+// Inject authmatch auth {ResolvedAuth::Header(name, value) => {