Skip to content

Commit ede350f

Browse files
authored
fix(dash): detect rocm serve's default port in chat auto-detect (#88)
The TUI chat's local-engine TCP-probe fallback only checked Lemonade's :13305 and vLLM's :8000, so it never found vLLM instances started via `rocm serve <model> --engine vllm` in non-managed mode, which listen on rocm-serve's own default port :11435. Add :11435 as a third probe candidate and update the UI copy that hardcoded the old two-port list. EAI-7220 Signed-off-by: fredespi <fredrik.espinoza@gmail.com>
1 parent 21640b6 commit ede350f

4 files changed

Lines changed: 33 additions & 5 deletions

File tree

crates/rocm-dash-tui/src/app/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -995,8 +995,9 @@ impl AppState {
995995
self.chat_detect_offer = Some(cfg);
996996
} else {
997997
self.chat_detect_offer = None;
998-
self.chat_detect_msg =
999-
Some("no local engine found (Lemonade :13305 / vLLM :8000)".into());
998+
self.chat_detect_msg = Some(
999+
"no local engine found (Lemonade :13305 / vLLM :8000 / rocm serve :11435)".into(),
1000+
);
10001001
}
10011002
}
10021003

crates/rocm-dash-tui/src/llm.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,17 @@ pub fn probe_endpoint(base_url: &str, timeout: Duration) -> bool {
139139
false
140140
}
141141

142-
/// Probe the known local serving endpoints in priority order (Lemonade, then vLLM) and return the first reachable one.
142+
/// Probe the known local serving endpoints in priority order (Lemonade, then
143+
/// vLLM, then `rocm serve`'s non-managed default) and return the first
144+
/// reachable one.
143145
///
144146
/// Used by the TUI's in-app "detect a local engine" action so the user need not run the CLI skill first.
145147
/// TCP-only (no HTTP); never blocks longer than [`PROBE_TIMEOUT`] per candidate.
146148
pub fn detect_local_endpoint() -> Option<&'static str> {
147149
[
148150
crate::skills::LEMONADE_ENDPOINT,
149151
crate::skills::VLLM_ENDPOINT,
152+
crate::skills::ROCM_SERVE_ENDPOINT,
150153
]
151154
.into_iter()
152155
.find(|ep| probe_endpoint(ep, PROBE_TIMEOUT))
@@ -324,4 +327,21 @@ mod tests {
324327
));
325328
assert!(!probe_endpoint("not a url", Duration::from_millis(100)));
326329
}
330+
331+
#[test]
332+
fn detect_local_endpoint_probes_rocm_serve_default_port() {
333+
// A listener on rocm serve's (non-managed) default port must be picked
334+
// up by the fallback probe, not just Lemonade/vLLM's ports.
335+
let Ok(listener) =
336+
std::net::TcpListener::bind(("127.0.0.1", crate::skills::ROCM_SERVE_PORT))
337+
else {
338+
// Port already bound in this environment; skip rather than flake.
339+
return;
340+
};
341+
assert_eq!(
342+
detect_local_endpoint(),
343+
Some(crate::skills::ROCM_SERVE_ENDPOINT)
344+
);
345+
drop(listener);
346+
}
327347
}

crates/rocm-dash-tui/src/skills.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ pub const LEMONADE_ENDPOINT: &str = "http://localhost:13305/v1";
2121
/// vLLM's conventional OpenAI-compatible endpoint + port.
2222
pub const VLLM_PORT: u16 = 8000;
2323
pub const VLLM_ENDPOINT: &str = "http://localhost:8000/v1";
24+
/// `rocm serve`'s (non-managed) default vLLM port.
25+
///
26+
/// Mirrors `rocm_core::DEFAULT_LOCAL_PORT`; duplicated as a literal because
27+
/// this crate deliberately carries no `rocm-core` dependency (see
28+
/// `AppState::model_recipes`).
29+
pub const ROCM_SERVE_PORT: u16 = 11_435;
30+
pub const ROCM_SERVE_ENDPOINT: &str = "http://localhost:11435/v1";
2431

2532
/// One typed step in a skill manifest. Tagged by `type` in TOML.
2633
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]

crates/rocm-dash-tui/src/ui/tabs/chat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn draw_consent(f: &mut Frame, area: Rect, state: &AppState, theme: &Theme) {
6060
(
6161
" Chat — detecting… ",
6262
vec![Line::from(Span::styled(
63-
"Probing for a local engine (Lemonade :13305 / vLLM :8000)…",
63+
"Probing for a local engine (Lemonade :13305 / vLLM :8000 / rocm serve :11435)…",
6464
Style::default().fg(theme.fg),
6565
))],
6666
)
@@ -209,7 +209,7 @@ fn consent_gate_lines<'a>(
209209
Style::default().fg(theme.muted),
210210
)),
211211
Line::from(Span::styled(
212-
" • or run a local endpoint at 127.0.0.1:8000",
212+
" • or run a local endpoint (vLLM :8000, rocm serve :11435)",
213213
Style::default().fg(theme.muted),
214214
)),
215215
],

0 commit comments

Comments
 (0)