From 3bc31878a8eaaa4ca719ebae96862dddec303a19 Mon Sep 17 00:00:00 2001 From: Rohit Ghumare Date: Wed, 13 May 2026 14:14:59 +0100 Subject: [PATCH] Polish coding profile chat diagnostics --- src/app.rs | 13 +++++++++++-- src/cli.rs | 5 +++-- src/payload.rs | 6 ++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/app.rs b/src/app.rs index e2bb40e..2474ff5 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1274,7 +1274,6 @@ fn report_harness_or_core( if let Some(failure) = probe_failure_from_value(harness_label, "harness::status", &value) { - writeln!(out, "{harness_label}: unavailable: {}", failure.error)?; failure } else { writeln!(out, "{harness_label}: ok")?; @@ -1283,7 +1282,6 @@ fn report_harness_or_core( } Err(err) => { let error = err.to_string(); - writeln!(out, "{harness_label}: unavailable: {error}")?; ProbeFailure { label: harness_label.to_string(), error, @@ -1299,9 +1297,15 @@ fn report_harness_or_core( Ok(value) => { let missing = missing_core_runtime_functions(&value); if missing.is_empty() { + writeln!(out, "{harness_label}: unavailable; using core stack")?; writeln!(out, "core stack: ok")?; Ok(None) } else { + writeln!( + out, + "{harness_label}: unavailable: {}", + harness_failure.error + )?; let missing = missing.join(", "); writeln!(out, "core stack: error: missing {missing}")?; Ok(Some(ProbeFailure { @@ -1315,6 +1319,11 @@ fn report_harness_or_core( } Err(err) => { let error = err.to_string(); + writeln!( + out, + "{harness_label}: unavailable: {}", + harness_failure.error + )?; writeln!(out, "core stack: error: {error}")?; Ok(Some(ProbeFailure { label: "core stack".to_string(), diff --git a/src/cli.rs b/src/cli.rs index 70f566f..dec2eae 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -136,7 +136,7 @@ pub struct ChatArgs { #[arg(long, default_value_t = 750)] pub poll_interval_ms: u64, - #[arg(long, default_value_t = 600_000)] + #[arg(long, default_value_t = 1_800_000)] pub stream_timeout_ms: u64, #[arg(long)] @@ -157,7 +157,7 @@ impl Default for ChatArgs { idle_timeout_secs: 300, max_turns: 20, poll_interval_ms: 750, - stream_timeout_ms: 600_000, + stream_timeout_ms: 1_800_000, wait: false, } } @@ -628,6 +628,7 @@ mod tests { Command::Chat(args) => { assert_eq!(args.session_id.as_deref(), Some("s1")); assert_eq!(args.prompt.as_deref(), Some("hi")); + assert_eq!(args.stream_timeout_ms, 1_800_000); } _ => panic!("expected chat command"), } diff --git a/src/payload.rs b/src/payload.rs index 0887c93..3d00195 100644 --- a/src/payload.rs +++ b/src/payload.rs @@ -136,9 +136,7 @@ pub fn build_user_message(prompt: &str) -> Value { } pub fn build_worker_aware_user_message(prompt: &str) -> Value { - build_user_message(&format!( - "{III_CODE_CLIENT_CONTEXT}\n\nUser request:\n{prompt}" - )) + build_user_message(&format!("{prompt}\n\n{III_CODE_CLIENT_CONTEXT}")) } pub fn build_auth_payload(provider: &str, key: &str) -> Value { @@ -441,10 +439,10 @@ mod tests { let message = build_worker_aware_user_message("fix the repo"); let text = message["content"][0]["text"].as_str().unwrap(); + assert!(text.starts_with("fix the repo")); assert!(text.contains("Installed iii workers")); assert!(text.contains("engine::functions::list")); assert!(text.contains("skill::fetch")); - assert!(text.contains("fix the repo")); } #[test]