Auditor drill: OpenRouter lane sweep + warren Gitea repoint (post-PR11 polish) #14

Open
profit wants to merge 65 commits from demo/post-pr11-polish-2026-04-28 into main
Showing only changes of commit 8bdceda883 - Show all commits
+14 -2
View File
@@ -20,7 +20,19 @@ use serde::{Deserialize, Serialize};
use super::{ChatRequest, ChatResponse, Choice, Message, UsageBlock};
const OR_BASE_URL: &str = "https://openrouter.ai/api/v1";
const OR_TIMEOUT_SECS: u64 = 180;
// Default request ceiling. 180s starves long-context calls (kimi_architect's
// ~180K-char second pass died at exactly this wall on 2026-09-02, surfacing
// as a misleading "error decoding response body") — override per host with
// OR_TIMEOUT_SECS. The auditor budgets up to 900s client-side.
const OR_TIMEOUT_SECS_DEFAULT: u64 = 180;
fn or_timeout_secs() -> u64 {
std::env::var("OR_TIMEOUT_SECS")
.ok()
.and_then(|v| v.trim().parse::<u64>().ok())
.filter(|&s| s > 0)
.unwrap_or(OR_TIMEOUT_SECS_DEFAULT)
}
pub fn resolve_openrouter_key() -> Option<String> {
if let Ok(k) = std::env::var("OPENROUTER_API_KEY") {
@@ -72,7 +84,7 @@ pub async fn chat(
};
let client = reqwest::Client::builder()
.timeout(Duration::from_secs(OR_TIMEOUT_SECS))
.timeout(Duration::from_secs(or_timeout_secs()))
.build()
.map_err(|e| format!("build client: {e}"))?;