Skip to content

Commit 1b613c2

Browse files
hyperpolymathclaude
andcommitted
fix(rest+llm): /api/v1/consult e2e wiring — env-var port + cartridge name
Closes the deferred /api/v1/consult e2e exercise from 2026-04-25 evening. Two changes: 1. src/rust/llm.rs — `echidna-llm` → `echidna-llm-mcp` (cartridge name) LlmAdvisor was POSTing to `/cartridge/echidna-llm/invoke` but the actual BoJ cartridge name is `echidna-llm-mcp` (verified against the live BoJ instance at localhost:7700 — `GET /cartridges` returns the registered name). Pre-fix the consult call returned 404 unknown-cartridge from BoJ; post-fix it reaches the cartridge and returns whatever the cartridge handler decides (currently 500 because BoJ is in skeleton mode — not echidna's responsibility). 2. src/interfaces/rest/main.rs — `ECHIDNA_REST_ADDR` env-var override The hardcoded `127.0.0.1:8000` collides with other workspace processes (Python SimpleHTTPServer was on 8000 during testing). Reading `ECHIDNA_REST_ADDR` lets the server bind a free port for ad-hoc e2e exercises without touching the default. E2E verified path: curl POST /api/v1/consult on 127.0.0.1:8765 → handler validates non-empty question (400 on empty) → LlmAdvisor.check_health() succeeds against live BoJ → LlmAdvisor.consult() POSTs to BoJ /cartridge/echidna-llm-mcp/invoke → BoJ skeleton-mode invoke returns 500 → handler maps to 502 Bad Gateway with passthrough error message Echidna side fully wired. BoJ-side cartridge is a placeholder by its own self-declared status (`/health` reports `mode: skeleton, note: invocation is a placeholder`); making BoJ return real LLM responses is a separate task tracked in boj-server. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4241abf commit 1b613c2

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/interfaces/rest/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ async fn main() {
125125
.layer(CorsLayer::permissive())
126126
.with_state(state);
127127

128-
let addr = "127.0.0.1:8000";
128+
let addr = std::env::var("ECHIDNA_REST_ADDR").unwrap_or_else(|_| "127.0.0.1:8000".to_string());
129129
tracing::info!("REST API listening on http://{}", addr);
130130
tracing::info!("Swagger UI available at http://{}/swagger-ui", addr);
131131

132-
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
132+
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
133133
axum::serve(listener, app).await.unwrap();
134134
}
135135

src/rust/llm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ impl LlmAdvisor {
442442
build_user_prompt(&goal_str, &hypotheses, &self.history, self.config.top_k);
443443

444444
// Call BoJ cartridge invoke endpoint
445-
let url = format!("{}/cartridge/echidna-llm/invoke", self.config.boj_url);
445+
let url = format!("{}/cartridge/echidna-llm-mcp/invoke", self.config.boj_url);
446446

447447
let request_body = serde_json::json!({
448448
"operation": "suggest_tactics",
@@ -538,7 +538,7 @@ impl LlmAdvisor {
538538
bail!("LLM advisor not available — call check_health() first");
539539
}
540540

541-
let url = format!("{}/cartridge/echidna-llm/invoke", self.config.boj_url);
541+
let url = format!("{}/cartridge/echidna-llm-mcp/invoke", self.config.boj_url);
542542

543543
let request_body = serde_json::json!({
544544
"operation": "consult",

0 commit comments

Comments
 (0)