chore(marmel): bump 0-unstable-2026-11-07 -> 0-unstable-2026-11-13
CI / check (push) Has been cancelled
CI / check (push) Has been cancelled
Rebased arbitrary-http-headers.patch onto the new main: upstream renamed resolve_validator_backend to resolve_validator_backend_with_lease, added backend_urls/validator_backend_urls to SpecialistConfig, replaced MCP_REQUEST_TIMEOUT with per-server cfg.request_timeout(), and restructured McpManager::boot_one behind connect_client. cargoHash is unchanged because Cargo.lock did not move. Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
From 56d0b1f73e9e80596e3494ae14c8af6debdc5789 Mon Sep 17 00:00:00 2001
|
||||
From 0b34115d0b50728ad37d66c4bf29accc4d029723 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Miroshnichenko <alex@millerson.name>
|
||||
Date: Mon, 9 Nov 2026 09:37:42 +0300
|
||||
Date: Thu, 19 Nov 2026 19:30:31 +0300
|
||||
Subject: [PATCH] feat(config): add arbitrary HTTP headers for LLM and MCP
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@@ -17,7 +17,7 @@ construction warns and skips them.
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
README.md | 26 +++-
|
||||
marmel.toml.example | 21 ++-
|
||||
marmel.toml.example | 22 +++-
|
||||
src/agents/runner/fix_loop.rs | 67 ++++++++++
|
||||
src/agents/runner/mod.rs | 55 +++++++-
|
||||
src/agents/validation.rs | 8 +-
|
||||
@@ -32,33 +32,33 @@ Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
src/orchestrator/delegate.rs | 2 +-
|
||||
src/ui/session_tests.rs | 2 +
|
||||
src/ui/tui/tests_new_ui.rs | 2 +
|
||||
16 files changed, 766 insertions(+), 13 deletions(-)
|
||||
16 files changed, 767 insertions(+), 13 deletions(-)
|
||||
create mode 100644 src/net/headers.rs
|
||||
|
||||
diff --git a/README.md b/README.md
|
||||
index a243f8d2cd08..fcb58af326f3 100644
|
||||
index e87af3f0d6dc..2d895eb7f675 100644
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -215,6 +215,7 @@ Marmel loads the first configuration file found from this list (files are not me
|
||||
|---|---|---|
|
||||
@@ -216,6 +216,7 @@ Marmel loads the first configuration file found from this list (files are not me
|
||||
| `backend_url` | `http://localhost:8000/v1` | Base URL for OpenAI-compatible chat completions (no trailing slash). |
|
||||
| `backend_urls` | `[]` | Optional list of backend URLs evaluated in priority order (primary -> spillover/fallback). |
|
||||
| `auth_token` | `""` | Optional Bearer token for authentication. |
|
||||
+| `headers` | `{}` | Extra HTTP headers for LLM requests. `x-opencode-session = true` generates one stable session id per process. |
|
||||
| `model` | `qwen-3.8-27b` | Model identifier requested from the backend. |
|
||||
| `temperature` | `0.7` | Sampling temperature. |
|
||||
| `top_p` | `0.9` | Nucleus sampling probability. |
|
||||
@@ -239,8 +240,8 @@ Marmel loads the first configuration file found from this list (files are not me
|
||||
@@ -240,8 +241,8 @@ Marmel loads the first configuration file found from this list (files are not me
|
||||
| `[monitoring]` | — | Settings for repetition breakers and token ceilings (`repetition_threshold = 5`, `min_pattern_len = 5`). |
|
||||
| `[orchestration]` | — | Top-level concurrency and delegation settings (`max_recursion_depth = 3`). |
|
||||
| `[orchestration.concurrency]` | _unset_ | Concurrency caps per backend URL and model pair. |
|
||||
-| `[orchestration.specialists.<role>]` | — | Per-role configuration overrides (`model`, `backend_url`, `tools`, `mcp_servers`, `reasoning_effort`, `max_validator_iterations`). |
|
||||
-| `[mcp_servers.<name>]` | — | External MCP server registration (`command`, `args`, `env`, `url`, `prompt`). |
|
||||
+| `[orchestration.specialists.<role>]` | — | Per-role configuration overrides (`model`, `backend_url`, `auth_token`, `headers`, `validator_headers`, `tools`, `mcp_servers`, `reasoning_effort`, `max_validator_iterations`). |
|
||||
+| `[mcp_servers.<name>]` | — | External MCP server registration (`command`, `args`, `env`, `url`, `headers`, `prompt`). |
|
||||
-| `[orchestration.specialists.<role>]` | — | Per-role configuration overrides (`model`, `backend_url`, `backend_urls`, `tools`, `mcp_servers`, `reasoning_effort`, `max_validator_iterations`). |
|
||||
-| `[mcp_servers.<name>]` | — | External MCP server registration (`command`, `args`, `env`, `url`, `prompt`, `idle_timeout_secs`, `request_timeout_secs`). |
|
||||
+| `[orchestration.specialists.<role>]` | — | Per-role configuration overrides (`model`, `backend_url`, `backend_urls`, `auth_token`, `headers`, `validator_headers`, `tools`, `mcp_servers`, `reasoning_effort`, `max_validator_iterations`). |
|
||||
+| `[mcp_servers.<name>]` | — | External MCP server registration (`command`, `args`, `env`, `url`, `headers`, `prompt`, `idle_timeout_secs`, `request_timeout_secs`). |
|
||||
|
||||
### Example `marmel.toml`
|
||||
|
||||
@@ -294,6 +295,27 @@ reasoning_effort = "low"
|
||||
@@ -306,6 +307,27 @@ reasoning_effort = "low"
|
||||
validator_reasoning_effort = "minimal"
|
||||
```
|
||||
|
||||
@@ -87,10 +87,10 @@ index a243f8d2cd08..fcb58af326f3 100644
|
||||
|
||||
When running against a local LLM server with limited GPU memory, running multiple subagents, validator loops, and JIT prompt architects in parallel can cause severe queuing and out-of-memory errors. The concurrency table caps simultaneous streams per backend URL and model:
|
||||
diff --git a/marmel.toml.example b/marmel.toml.example
|
||||
index 16d3d613c90b..aec261cfb609 100644
|
||||
index 1da4c66165e7..115bd4f023af 100644
|
||||
--- a/marmel.toml.example
|
||||
+++ b/marmel.toml.example
|
||||
@@ -6,6 +6,14 @@ backend_url = "http://localhost:8000/v1"
|
||||
@@ -14,6 +14,14 @@ backend_url = "http://localhost:8000/v1"
|
||||
# Optional bearer token sent as `Authorization: Bearer <token>`.
|
||||
auth_token = ""
|
||||
|
||||
@@ -105,7 +105,7 @@ index 16d3d613c90b..aec261cfb609 100644
|
||||
# Model identifier to send in the chat request.
|
||||
model = "qwen-3.8-27b"
|
||||
|
||||
@@ -206,6 +214,10 @@ model = "deepseek-v4-flash:cloud"
|
||||
@@ -214,6 +222,10 @@ model = "deepseek-v4-flash:cloud"
|
||||
# Optional unique backend and token for coder:
|
||||
# backend_url = "http://localhost:11434/v1"
|
||||
# auth_token = ""
|
||||
@@ -116,7 +116,7 @@ index 16d3d613c90b..aec261cfb609 100644
|
||||
# Optional: set false to disable automated quality-assurance validation
|
||||
# enable_validator = false
|
||||
# Optional unique validator settings for coder's quality assurance:
|
||||
@@ -282,6 +294,10 @@ model = "deepseek-v4-flash:cloud"
|
||||
@@ -290,6 +302,10 @@ model = "deepseek-v4-flash:cloud"
|
||||
# `env` is optional and only applies to stdio servers: it sets environment
|
||||
# variables for the spawned process (e.g. API keys the server needs).
|
||||
#
|
||||
@@ -127,18 +127,19 @@ index 16d3d613c90b..aec261cfb609 100644
|
||||
# Discovered MCP tools are exposed to agents with a `<server_name>__<tool_name>`
|
||||
# prefix (e.g. a tool `read_file` from server `filesystem` appears as
|
||||
# `filesystem__read_file`). This prefix prevents name collisions when multiple
|
||||
@@ -289,8 +305,8 @@ model = "deepseek-v4-flash:cloud"
|
||||
# before the call is sent to the MCP server, so the server always receives the
|
||||
@@ -298,8 +314,9 @@ model = "deepseek-v4-flash:cloud"
|
||||
# original unprefixed tool name.
|
||||
#
|
||||
-# The legal keys of a server table are exactly `command`, `args`, `env`, `url`
|
||||
-# and `prompt`: there is NO `enabled`, `timeout` or `headers` key (a typo'd key
|
||||
+# The legal keys of a server table are exactly `command`, `args`, `env`, `url`,
|
||||
+# `headers` and `prompt`: there is NO `enabled` or `timeout` key (a typo'd key
|
||||
# is dropped in silence, not an error). Exactly one transport per server —
|
||||
# `command` wins when both `command` and `url` are set. `prompt` is optional
|
||||
# free-form text injected into the system prompt of every agent allowed to use
|
||||
@@ -306,6 +322,7 @@ args = ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
|
||||
# The legal keys of a server table are `command`, `args`, `env`, `url`,
|
||||
-# `prompt`, `idle_timeout_secs` and `request_timeout_secs`: exactly one transport
|
||||
-# per server — `command` wins when both `command` and `url` are set. `prompt` is
|
||||
+# `headers`, `prompt`, `idle_timeout_secs` and `request_timeout_secs`: exactly one
|
||||
+# transport per server — `command` wins when both `command` and `url` are set
|
||||
+# (`headers` are ignored on stdio). `prompt` is
|
||||
# optional free-form text injected into the system prompt of every agent allowed
|
||||
# to use that server (it also accepts the aliases `instructions` and `system_prompt`);
|
||||
# none of the three examples below set it.
|
||||
@@ -313,6 +330,7 @@ args = ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
|
||||
# Example 2 — remote/external HTTP/SSE server (reached over the network).
|
||||
[mcp_servers.remote]
|
||||
url = "https://example.com/mcp"
|
||||
@@ -147,10 +148,10 @@ index 16d3d613c90b..aec261cfb609 100644
|
||||
# Example 3 — the offline reference library built in this workspace, registered
|
||||
# under the server name `kiwix` (a legal name: `[A-Za-z0-9_-]+`, no `__`, and it
|
||||
diff --git a/src/agents/runner/fix_loop.rs b/src/agents/runner/fix_loop.rs
|
||||
index 1c569d293e75..7ca678289864 100644
|
||||
index 2d369bc2e8be..a1e072214e3f 100644
|
||||
--- a/src/agents/runner/fix_loop.rs
|
||||
+++ b/src/agents/runner/fix_loop.rs
|
||||
@@ -689,6 +689,27 @@ pub fn resolve_validator_backend(
|
||||
@@ -715,6 +715,27 @@ pub fn resolve_validator_backend(
|
||||
(backend, token, model, reasoning_effort)
|
||||
}
|
||||
|
||||
@@ -178,7 +179,7 @@ index 1c569d293e75..7ca678289864 100644
|
||||
/// Shared tool-dispatch core: monitor intervention check → cancellation check
|
||||
/// → `dispatch_for_async_with_engine`. Returns `(content, execution_succeeded)`
|
||||
/// where `content` starts with `"ERROR: "` on failure.
|
||||
@@ -1410,6 +1431,7 @@ pub fn register_loop_worker(
|
||||
@@ -1436,6 +1457,7 @@ pub fn register_loop_worker(
|
||||
mod tests {
|
||||
use super::{
|
||||
append_tool_result, inject_worker_notices_at_turn_start, inject_worker_notices_mid_turn,
|
||||
@@ -186,7 +187,7 @@ index 1c569d293e75..7ca678289864 100644
|
||||
};
|
||||
use crate::manager::{ContextEngine, ContextEngineFactory};
|
||||
use crate::orchestrator::notice::{TEST_NOTICE_MUTEX, has_worker_inbox, worker_inbox_len};
|
||||
@@ -2760,4 +2782,49 @@ mod tests {
|
||||
@@ -2786,4 +2808,49 @@ mod tests {
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -237,10 +238,10 @@ index 1c569d293e75..7ca678289864 100644
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/agents/runner/mod.rs b/src/agents/runner/mod.rs
|
||||
index b290990aabae..83152b883014 100644
|
||||
index fafa56960738..301323e9889a 100644
|
||||
--- a/src/agents/runner/mod.rs
|
||||
+++ b/src/agents/runner/mod.rs
|
||||
@@ -91,6 +91,19 @@ pub fn resolve_specialist_backend(
|
||||
@@ -104,6 +104,19 @@ pub fn resolve_specialist_backend(
|
||||
(backend, auth_token, model)
|
||||
}
|
||||
|
||||
@@ -260,7 +261,7 @@ index b290990aabae..83152b883014 100644
|
||||
pub(crate) async fn try_run_specialist_live(
|
||||
agent: Agent,
|
||||
ctx: &IsolatedContext,
|
||||
@@ -115,7 +128,8 @@ pub(crate) async fn try_run_specialist_live(
|
||||
@@ -122,7 +135,8 @@ pub(crate) async fn try_run_specialist_live(
|
||||
if backend_url.is_empty() {
|
||||
return None;
|
||||
}
|
||||
@@ -270,7 +271,7 @@ index b290990aabae..83152b883014 100644
|
||||
// Call class for this delegation, installed before the turn starts and
|
||||
// discharged when it returns. This is the point where the delegation's
|
||||
// `(backend_url, model)` pair is resolved, so the pool's gate in
|
||||
@@ -139,3 +153,42 @@ pub(crate) async fn try_run_specialist_live(
|
||||
@@ -146,3 +160,42 @@ pub(crate) async fn try_run_specialist_live(
|
||||
};
|
||||
Some(res)
|
||||
}
|
||||
@@ -314,32 +315,32 @@ index b290990aabae..83152b883014 100644
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/agents/validation.rs b/src/agents/validation.rs
|
||||
index 8522344ff99a..2348bbaa7aea 100644
|
||||
index d472fd1ffb22..47cc206e7167 100644
|
||||
--- a/src/agents/validation.rs
|
||||
+++ b/src/agents/validation.rs
|
||||
@@ -12,7 +12,7 @@
|
||||
use crate::agents::Agent;
|
||||
use crate::agents::runner::fix_loop::{
|
||||
FixLoopBounds, FixLoopResult, LoopParams, assemble_tools, register_loop_worker,
|
||||
- resolve_validator_backend, run_fix_loop,
|
||||
+ resolve_validator_backend, resolve_validator_headers, run_fix_loop,
|
||||
- resolve_validator_backend_with_lease, run_fix_loop,
|
||||
+ resolve_validator_backend_with_lease, resolve_validator_headers, run_fix_loop,
|
||||
};
|
||||
use crate::markers::{has_failure_verdict_cue, is_failure_verdict_word};
|
||||
use crate::tool_names::is_leave_verdict_tool_name;
|
||||
@@ -408,7 +408,8 @@ async fn run_automated_validation_inner(
|
||||
// correct: a different model server has its own slots, so it gets its own pool.
|
||||
let (backend, auth, validator_model, validator_reasoning_effort) =
|
||||
resolve_validator_backend(cfg, agent);
|
||||
let (backend, auth, validator_model, validator_reasoning_effort, _val_lease) =
|
||||
resolve_validator_backend_with_lease(cfg, agent);
|
||||
- let val_client = crate::llm::ChatClient::new_with_token(&backend, &validator_model, &auth);
|
||||
+ let val_client = crate::llm::ChatClient::new_with_token(&backend, &validator_model, &auth)
|
||||
+ .with_headers(resolve_validator_headers(cfg, agent));
|
||||
|
||||
let brief = format!(
|
||||
"Task Brief:\n{}\n\nSpecialist Deliverable:\n{}\n\n\
|
||||
@@ -625,7 +626,8 @@ async fn run_plan_validation_inner(
|
||||
@@ -619,7 +620,8 @@ async fn run_plan_validation_inner(
|
||||
// `[specialists.validator]` override points it at another endpoint/model.
|
||||
let (backend, auth, validator_model, validator_reasoning_effort) =
|
||||
resolve_validator_backend(cfg, Agent::Planner);
|
||||
let (backend, auth, validator_model, validator_reasoning_effort, _val_lease) =
|
||||
resolve_validator_backend_with_lease(cfg, Agent::Planner);
|
||||
- let val_client = crate::llm::ChatClient::new_with_token(&backend, &validator_model, &auth);
|
||||
+ let val_client = crate::llm::ChatClient::new_with_token(&backend, &validator_model, &auth)
|
||||
+ .with_headers(resolve_validator_headers(cfg, Agent::Planner));
|
||||
@@ -347,7 +348,7 @@ index 8522344ff99a..2348bbaa7aea 100644
|
||||
let brief = format!(
|
||||
"Proposed Execution Plan:\n```markdown\n{}\n```\n\n\
|
||||
diff --git a/src/config.rs b/src/config.rs
|
||||
index 4cb22c9f7bc6..5579512f3b64 100644
|
||||
index ef6cf958cc28..ec6710598010 100644
|
||||
--- a/src/config.rs
|
||||
+++ b/src/config.rs
|
||||
@@ -5,6 +5,8 @@ use serde::{Deserialize, Serialize};
|
||||
@@ -359,8 +360,8 @@ index 4cb22c9f7bc6..5579512f3b64 100644
|
||||
/// Default delegation depth bound.
|
||||
pub const DEFAULT_MAX_RECURSION_DEPTH: usize = 3;
|
||||
|
||||
@@ -217,12 +219,19 @@ pub struct SpecialistConfig {
|
||||
pub backend_url: Option<String>,
|
||||
@@ -220,6 +222,10 @@ pub struct SpecialistConfig {
|
||||
pub backend_urls: Vec<String>,
|
||||
/// Optional auth token override for this specialist.
|
||||
pub auth_token: Option<String>,
|
||||
+ /// Optional request-header overrides for this specialist's backend. Merged
|
||||
@@ -370,7 +371,8 @@ index 4cb22c9f7bc6..5579512f3b64 100644
|
||||
/// Optional model override for this specialist's validator.
|
||||
pub validator_model: Option<String>,
|
||||
/// Optional backend URL override for this specialist's validator.
|
||||
pub validator_backend_url: Option<String>,
|
||||
@@ -229,6 +235,9 @@ pub struct SpecialistConfig {
|
||||
pub validator_backend_urls: Vec<String>,
|
||||
/// Optional auth token override for this specialist's validator.
|
||||
pub validator_auth_token: Option<String>,
|
||||
+ /// Optional request-header overrides for this specialist's validator. Merged
|
||||
@@ -379,9 +381,9 @@ index 4cb22c9f7bc6..5579512f3b64 100644
|
||||
/// Optional reasoning-effort override for this specialist's validator
|
||||
/// (free-form pass-through; backends use different vocabularies).
|
||||
pub validator_reasoning_effort: Option<String>,
|
||||
@@ -326,6 +335,9 @@ impl std::str::FromStr for GitWorkflowPolicy {
|
||||
pub struct Config {
|
||||
pub backend_url: String,
|
||||
@@ -361,6 +370,9 @@ pub struct Config {
|
||||
#[serde(default)]
|
||||
pub backend_urls: Vec<String>,
|
||||
pub auth_token: String,
|
||||
+ /// Arbitrary request headers for the LLM backend. `x-opencode-session = true`
|
||||
+ /// generates one stable session id for the whole process.
|
||||
@@ -389,15 +391,15 @@ index 4cb22c9f7bc6..5579512f3b64 100644
|
||||
pub model: String,
|
||||
pub temperature: f32,
|
||||
pub top_p: f32,
|
||||
@@ -431,6 +443,7 @@ impl Default for Config {
|
||||
Config {
|
||||
@@ -467,6 +479,7 @@ impl Default for Config {
|
||||
backend_url: "http://localhost:8000/v1".to_string(),
|
||||
backend_urls: Vec::new(),
|
||||
auth_token: String::new(),
|
||||
+ headers: HeaderSpecs::new(),
|
||||
model: "qwen-3.8-27b".to_string(),
|
||||
temperature: 0.7,
|
||||
top_p: 0.9,
|
||||
@@ -823,10 +836,61 @@ pub fn load(explicit_path: Option<&str>) -> Result<Config> {
|
||||
@@ -936,10 +949,61 @@ pub fn load(explicit_path: Option<&str>) -> Result<Config> {
|
||||
std::env::var(SESSION_COMMIT_MIN_MS_ENV).ok(),
|
||||
);
|
||||
|
||||
@@ -459,15 +461,15 @@ index 4cb22c9f7bc6..5579512f3b64 100644
|
||||
/// Tri-state reading of a `MARMEL_*` boolean: `1`/`true`/`yes`/`on` ⇒ `Some(true)`,
|
||||
/// `0`/`false`/`no`/`off` ⇒ `Some(false)`, anything else (including unset and
|
||||
/// unparseable junk) ⇒ `None`, which means "leave the file/default value alone".
|
||||
@@ -925,6 +989,7 @@ fn resolve_config_path(explicit_path: Option<&str>) -> Option<PathBuf> {
|
||||
struct PartialConfig {
|
||||
pub backend_url: Option<String>,
|
||||
@@ -1040,6 +1104,7 @@ struct PartialConfig {
|
||||
#[serde(default)]
|
||||
pub backend_urls: Vec<String>,
|
||||
pub auth_token: Option<String>,
|
||||
+ pub headers: Option<HeaderSpecs>,
|
||||
pub model: Option<String>,
|
||||
pub temperature: Option<f32>,
|
||||
pub top_p: Option<f32>,
|
||||
@@ -1012,6 +1077,9 @@ fn merge(mut base: Config, partial: PartialConfig) -> Config {
|
||||
@@ -1136,6 +1201,9 @@ fn merge(mut base: Config, partial: PartialConfig) -> Config {
|
||||
{
|
||||
base.auth_token = v;
|
||||
}
|
||||
@@ -477,7 +479,7 @@ index 4cb22c9f7bc6..5579512f3b64 100644
|
||||
if let Some(v) = partial.model
|
||||
&& !v.is_empty()
|
||||
{
|
||||
@@ -1273,6 +1341,7 @@ pub(crate) fn sandbox_env_test_lock() -> std::sync::MutexGuard<'static, ()> {
|
||||
@@ -1397,6 +1465,7 @@ pub(crate) fn sandbox_env_test_lock() -> std::sync::MutexGuard<'static, ()> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -485,7 +487,7 @@ index 4cb22c9f7bc6..5579512f3b64 100644
|
||||
|
||||
#[test]
|
||||
fn test_orchestr_config_default_depth() {
|
||||
@@ -1323,6 +1392,123 @@ mod tests {
|
||||
@@ -1447,6 +1516,123 @@ mod tests {
|
||||
assert!(validator.tools.iter().any(|t| t == "gedcom__*"));
|
||||
}
|
||||
|
||||
@@ -610,7 +612,7 @@ index 4cb22c9f7bc6..5579512f3b64 100644
|
||||
fn orchestration_absent_keeps_default() {
|
||||
let toml_str = "backend_url = \"http://localhost:9000/v1\"\n";
|
||||
diff --git a/src/llm/client.rs b/src/llm/client.rs
|
||||
index a7b026525355..385c54b272e3 100644
|
||||
index 67e0c3e7bf13..a854960446fc 100644
|
||||
--- a/src/llm/client.rs
|
||||
+++ b/src/llm/client.rs
|
||||
@@ -4,6 +4,7 @@ use crate::orchestrator::pool;
|
||||
@@ -668,7 +670,7 @@ index a7b026525355..385c54b272e3 100644
|
||||
pub fn with_initial_timeout_secs(mut self, secs: u64) -> Self {
|
||||
self.initial_timeout_secs = secs;
|
||||
self
|
||||
@@ -1167,7 +1180,11 @@ impl ChatClient {
|
||||
@@ -1183,7 +1196,11 @@ impl ChatClient {
|
||||
let req_start = std::time::Instant::now();
|
||||
|
||||
let mut builder = client.post(&url).json(&req_body);
|
||||
@@ -749,18 +751,18 @@ index 7b92e156e882..bed827d91f35 100644
|
||||
+ assert_eq!(authorization.as_deref(), Some("Bearer explicit"));
|
||||
+}
|
||||
diff --git a/src/mcp/client.rs b/src/mcp/client.rs
|
||||
index 222ab5872d61..81deb01e381c 100644
|
||||
index 71d66876007e..472b2657316d 100644
|
||||
--- a/src/mcp/client.rs
|
||||
+++ b/src/mcp/client.rs
|
||||
@@ -20,6 +20,7 @@ use super::http::{HttpSseConnection, MCP_REQUEST_TIMEOUT};
|
||||
@@ -20,6 +20,7 @@ use super::http::{DEFAULT_MCP_REQUEST_TIMEOUT, HttpSseConnection};
|
||||
use super::protocol::{
|
||||
self, JsonRpcNotification, JsonRpcRequest, JsonRpcTransport, RequestIds, decode_reply,
|
||||
};
|
||||
+use crate::net::headers::HeaderSpecs;
|
||||
|
||||
/// Server configuration entry for an MCP server in marmel.toml.
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
@@ -33,6 +34,9 @@ pub struct McpServerConfig {
|
||||
/// Default idle duration before closing an inactive MCP connection (5 minutes).
|
||||
pub const DEFAULT_MCP_IDLE_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(300);
|
||||
@@ -36,6 +37,9 @@ pub struct McpServerConfig {
|
||||
pub env: HashMap<String, String>,
|
||||
/// Remote URL endpoint (for HTTP/SSE transport).
|
||||
pub url: Option<String>,
|
||||
@@ -770,20 +772,20 @@ index 222ab5872d61..81deb01e381c 100644
|
||||
/// Optional prompt or usage instructions injected into the system prompt of
|
||||
/// every agent allowed to use this MCP server.
|
||||
#[serde(alias = "instructions", alias = "system_prompt")]
|
||||
@@ -627,6 +631,11 @@ impl McpManager {
|
||||
/// warned (unchanged); `Err(reason)` = the connection failed, with the reason in the
|
||||
/// payload form the `Failed` status wants.
|
||||
async fn boot_one(&self, name: &str, cfg: &McpServerConfig) -> Result<bool, String> {
|
||||
@@ -871,6 +875,11 @@ impl McpManager {
|
||||
if cfg.command.is_none() && cfg.url.is_none() {
|
||||
return Ok(false);
|
||||
}
|
||||
+ if cfg.command.is_some() && !cfg.headers.is_empty() {
|
||||
+ tracing::warn!(
|
||||
+ "MCP server '{name}' uses stdio (`command`); `headers` are ignored — use `env`"
|
||||
+ );
|
||||
+ }
|
||||
let client = if cfg.command.is_some() {
|
||||
match StdioMcpConnection::spawn(name, cfg).await {
|
||||
Ok(conn) => Arc::new(McpClient::Stdio(Box::new(Mutex::new(conn)))),
|
||||
|
||||
let (client, instructions) = connect_client(name, cfg).await?;
|
||||
|
||||
diff --git a/src/mcp/http.rs b/src/mcp/http.rs
|
||||
index 82f0288a8137..8681cc9ca58b 100644
|
||||
index 9af874b628e5..1c3a32bb268e 100644
|
||||
--- a/src/mcp/http.rs
|
||||
+++ b/src/mcp/http.rs
|
||||
@@ -23,9 +23,12 @@
|
||||
@@ -799,7 +801,7 @@ index 82f0288a8137..8681cc9ca58b 100644
|
||||
use super::client::{McpServerConfig, McpTool};
|
||||
use super::protocol::{
|
||||
self, JsonRpcNotification, JsonRpcRequest, JsonRpcTransport, RequestIds, decode_reply,
|
||||
@@ -234,6 +237,8 @@ pub struct HttpSseConnection {
|
||||
@@ -235,6 +238,8 @@ pub struct HttpSseConnection {
|
||||
server_name: String,
|
||||
endpoint: String,
|
||||
client: reqwest::Client,
|
||||
@@ -808,16 +810,16 @@ index 82f0288a8137..8681cc9ca58b 100644
|
||||
session_id: Option<String>,
|
||||
/// The protocol layer's monotonic JSON-RPC id allocator
|
||||
/// ([`super::protocol::RequestIds`]); the transport only carries it.
|
||||
@@ -355,7 +360,7 @@ impl HttpSseConnection {
|
||||
@@ -358,7 +363,7 @@ impl HttpSseConnection {
|
||||
.as_ref()
|
||||
.ok_or_else(|| anyhow!("missing `url` for HTTP MCP server '{server_name}'"))?;
|
||||
|
||||
- Self::establish(server_name, url, MCP_REQUEST_TIMEOUT).await
|
||||
+ Self::establish(server_name, url, &cfg.headers, MCP_REQUEST_TIMEOUT).await
|
||||
- Self::establish(server_name, url, cfg.request_timeout()).await
|
||||
+ Self::establish(server_name, url, &cfg.headers, cfg.request_timeout()).await
|
||||
}
|
||||
|
||||
/// Test seam: same handshake with an explicit request deadline, so the
|
||||
@@ -367,12 +372,29 @@ impl HttpSseConnection {
|
||||
@@ -370,7 +375,19 @@ impl HttpSseConnection {
|
||||
url: &str,
|
||||
request_timeout: Duration,
|
||||
) -> Result<Self> {
|
||||
@@ -837,6 +839,9 @@ index 82f0288a8137..8681cc9ca58b 100644
|
||||
+ Self::establish(server_name, url, headers, request_timeout).await
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -380,7 +397,12 @@ impl HttpSseConnection {
|
||||
|
||||
/// Build the reqwest client through the shared builder and run the
|
||||
/// `initialize` handshake through the shared protocol layer.
|
||||
- async fn establish(server_name: &str, url: &str, request_timeout: Duration) -> Result<Self> {
|
||||
@@ -849,7 +854,7 @@ index 82f0288a8137..8681cc9ca58b 100644
|
||||
let client = build_http_client_with(http_client_options(request_timeout))
|
||||
.with_context(|| format!("failed to build HTTP client for '{server_name}'"))?;
|
||||
|
||||
@@ -380,6 +402,7 @@ impl HttpSseConnection {
|
||||
@@ -388,6 +410,7 @@ impl HttpSseConnection {
|
||||
server_name: server_name.to_string(),
|
||||
endpoint: url.to_string(),
|
||||
client,
|
||||
@@ -857,7 +862,7 @@ index 82f0288a8137..8681cc9ca58b 100644
|
||||
session_id: None,
|
||||
request_ids: RequestIds::new(),
|
||||
request_timeout,
|
||||
@@ -452,6 +475,9 @@ impl HttpSseConnection {
|
||||
@@ -466,6 +489,9 @@ impl HttpSseConnection {
|
||||
if let Some(sid) = &self.session_id {
|
||||
builder = builder.header("Mcp-Session-Id", sid);
|
||||
}
|
||||
@@ -868,10 +873,10 @@ index 82f0288a8137..8681cc9ca58b 100644
|
||||
}
|
||||
|
||||
diff --git a/src/mcp/http_tests.rs b/src/mcp/http_tests.rs
|
||||
index 1ded90785992..16d1fdb52240 100644
|
||||
index eb123c5d8732..cb3e0eede761 100644
|
||||
--- a/src/mcp/http_tests.rs
|
||||
+++ b/src/mcp/http_tests.rs
|
||||
@@ -372,6 +372,54 @@ mod tests {
|
||||
@@ -373,6 +373,54 @@ mod tests {
|
||||
assert_eq!(sent[2], JsonRpcRequest::tools_list(1).body().expect("body"));
|
||||
}
|
||||
|
||||
@@ -1200,7 +1205,7 @@ index 97746036c4eb..e5950813a8d8 100644
|
||||
stats,
|
||||
&cfg,
|
||||
diff --git a/src/ui/session_tests.rs b/src/ui/session_tests.rs
|
||||
index b6b17a760dd9..dd32b5226c3f 100644
|
||||
index 8adacae83024..16aa2f8e34a2 100644
|
||||
--- a/src/ui/session_tests.rs
|
||||
+++ b/src/ui/session_tests.rs
|
||||
@@ -4626,6 +4626,7 @@ fn boot_manager_naming(servers: &[&str]) -> std::sync::Arc<crate::mcp::McpManage
|
||||
@@ -1209,18 +1214,18 @@ index b6b17a760dd9..dd32b5226c3f 100644
|
||||
url: None,
|
||||
+ headers: Default::default(),
|
||||
prompt: None,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
@@ -4705,6 +4706,7 @@ async fn a_boot_that_refused_every_server_names_the_first_refusal_it_met() {
|
||||
@@ -4706,6 +4707,7 @@ async fn a_boot_that_refused_every_server_names_the_first_refusal_it_met() {
|
||||
args: Vec::new(),
|
||||
env: std::collections::HashMap::new(),
|
||||
url: None,
|
||||
+ headers: Default::default(),
|
||||
prompt: None,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
diff --git a/src/ui/tui/tests_new_ui.rs b/src/ui/tui/tests_new_ui.rs
|
||||
index 430a3d58f8b8..c96c0238b7c9 100644
|
||||
index 0a6c91cfc34f..ba7f19c06be2 100644
|
||||
--- a/src/ui/tui/tests_new_ui.rs
|
||||
+++ b/src/ui/tui/tests_new_ui.rs
|
||||
@@ -5234,6 +5234,7 @@ fn mcp_boot_manager(names: &[&str]) -> std::sync::Arc<crate::mcp::McpManager> {
|
||||
@@ -1229,16 +1234,16 @@ index 430a3d58f8b8..c96c0238b7c9 100644
|
||||
url: None,
|
||||
+ headers: Default::default(),
|
||||
prompt: None,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
@@ -5306,6 +5307,7 @@ fn the_configured_server_count_is_seeded_from_the_config_once() {
|
||||
@@ -5307,6 +5308,7 @@ fn the_configured_server_count_is_seeded_from_the_config_once() {
|
||||
args: Vec::new(),
|
||||
env: std::collections::HashMap::new(),
|
||||
url: None,
|
||||
+ headers: Default::default(),
|
||||
prompt: None,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
||||
@@ -11,13 +11,13 @@ rustPlatform.buildRustPackage rec {
|
||||
# says 1.0.0, so the version is meaningless and the source is tracked by
|
||||
# branch head, dated by nix-update's 0-unstable-* scheme. Bump with
|
||||
# nix-update (see passthru.updateScript).
|
||||
version = "0-unstable-2026-11-07";
|
||||
version = "0-unstable-2026-11-13";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Na1w";
|
||||
repo = "marmel";
|
||||
rev = "afcc1dc971ae4acd59b157f031d4bdbc9d52a7d0";
|
||||
hash = "sha256-OiF2Lc4s01MuXX2HfWMePBJ9M/uuhI69gInqqDPhbgQ=";
|
||||
rev = "a74426ae249f388e877dd52f13bc38b4ab272974";
|
||||
hash = "sha256-N8cGchXlfXLyldR0vwVZbk3tYyYrgl0lw3m+AwxdElo=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-Xw9OT8HXVlnZ0XqIMnnFwQ/y9xKxOtmcwomJsRxUx5E=";
|
||||
|
||||
Reference in New Issue
Block a user