refactor: remove legacy chat path, fix corrupted conversation recovery

- Delete CodeSession::chat() — the legacy inline tool loop that
  duplicated the orchestrator's conversation + tool dispatch logic
- Delete wait_for_tool_result() — only used by the legacy path
- Make orchestrator mandatory in run_session (no more if/else fallback)
- Unify conversation creation into create_fresh_conversation()
- Add corrupted conversation recovery to create_or_append_conversation:
  detects "function calls and responses" errors from Mistral (caused by
  disconnecting mid-tool-call) and auto-creates a fresh conversation
- Add tracing-appender for optional rotating log file (SOL_LOG_FILE env)
- Add Procfile.dev for overmind process management
This commit is contained in:
2026-03-24 19:49:07 +00:00
parent d58bbfce66
commit 6a2aafdccc
5 changed files with 109 additions and 314 deletions

View File

@@ -44,13 +44,39 @@ use tools::ToolRegistry;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Initialize tracing
tracing_subscriber::fmt()
.with_env_filter(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("sol=info")),
)
.init();
// Initialize tracing — optionally write to a rotating log file
let env_filter = tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("sol=info"));
let _log_guard = if let Ok(log_path) = std::env::var("SOL_LOG_FILE") {
let log_dir = std::path::Path::new(&log_path)
.parent()
.unwrap_or(std::path::Path::new("."));
let log_name = std::path::Path::new(&log_path)
.file_name()
.and_then(|n| n.to_str())
.unwrap_or("sol.log");
let file_appender = tracing_appender::rolling::Builder::new()
.max_log_files(3)
.rotation(tracing_appender::rolling::Rotation::NEVER)
.filename_prefix(log_name)
.build(log_dir)
.expect("Failed to create log file appender");
let (non_blocking, guard) = tracing_appender::non_blocking(file_appender);
tracing_subscriber::fmt()
.with_env_filter(env_filter)
.with_writer(non_blocking)
.with_ansi(false)
.init();
Some(guard)
} else {
tracing_subscriber::fmt()
.with_env_filter(env_filter)
.init();
None
};
// Load config
let config_path =