Skip to content

open responses and mem model compatibility + fixes#83

Merged
madclaws merged 6 commits intomainfrom
fix/mem-model-compatibility
Feb 4, 2026
Merged

open responses and mem model compatibility + fixes#83
madclaws merged 6 commits intomainfrom
fix/mem-model-compatibility

Conversation

@madclaws
Copy link
Copy Markdown
Member

@madclaws madclaws commented Feb 4, 2026

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

This pull request bumps the package version from 0.4.0-rc.1 to 0.4.0 across the installation script and Rust workspace. Dependencies are updated (numpy 2.4.1→2.4.2, tqdm 4.67.1→4.67.3) with corresponding lock files refreshed. A pluggable ConfigProvider trait is introduced to abstract path resolution (config, data, lib directories) with a DefaultProvider implementation replacing hard-coded function calls. The MLX runtime is refactored to use the new provider for path resolution and to switch between memory-enabled and non-memory API endpoints dynamically. CLI metadata is updated with improved descriptions and help documentation. A test file with a mock provider is added (with tests currently commented out), and the Cargo.toml gains tempfile as a dev dependency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ❌ 3
❌ Failed checks (1 warning, 2 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.26% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'open responses and mem model compatibility + fixes' is vague and doesn't clearly describe the main changes; it uses vague phrasing like 'fixes' without specifics. Use a more specific title that clearly describes the primary change, such as 'Refactor config provider and update version to 0.4.0' or 'Introduce pluggable config provider abstraction.'
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess whether the description relates to the changeset. Add a pull request description explaining the main objectives, rationale, and scope of changes, including highlights of the config provider refactoring and version bump.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/mem-model-compatibility

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@madclaws madclaws merged commit 138f1df into main Feb 4, 2026
2 of 3 checks passed
@madclaws madclaws deleted the fix/mem-model-compatibility branch February 4, 2026 12:09
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@tiles/src/runtime/mlx.rs`:
- Around line 491-496: The HTTP POST currently uses
client.post(api_url).json(&body).send().await.unwrap(), which will panic on
failures; change this to propagate errors into the function's Result by
replacing the unwrap with error mapping/propagation (e.g., await the send and
use ? or map_err to convert reqwest errors into the function's String error
type), and likewise handle non-success HTTP statuses before parsing the response
into ChatResponse; update the variables referenced (api_url, run_args.memory,
and res) so send errors and bad-status responses return Err(String) instead of
panicking.
- Around line 206-214: The show_help() function currently calls
get_memory_path().unwrap(), which can panic; change it to handle the Result:
call get_memory_path() and if Ok(path) print it, otherwise call
get_default_memory_path() and use that when available, or print "<not
configured>" as the fallback; update the print block in show_help() to use this
non-panicking value so the REPL no longer crashes when memory path is missing.
🧹 Nitpick comments (2)
tiles/src/utils/config.rs (1)

19-28: Replace deprecated std::env::home_dir for home resolution.

std::env::home_dir is deprecated; consider a maintained helper (e.g., dirs::home_dir / home crate) or a platform-aware env var fallback to avoid warnings and future breakage.
As per coding guidelines, **/*.{rs,toml}: Review the Rust code for conformity with best practices in Rust, Systems programming. Highlight any deviations.

Also applies to: 33-43, 51-53

tiles/tests/config.rs (1)

22-65: Commented-out integration tests will never run.

Either enable these tests (and expose provider-based helpers for integration tests) or remove the commented blocks to avoid dead code.
As per coding guidelines, **/*.{rs,toml}: Review the Rust code for conformity with best practices in Rust, Systems programming. Highlight any deviations.

Comment thread tiles/src/runtime/mlx.rs
Comment on lines 206 to 214
fn show_help(model_name: &str) {
println!("\n=== Tiles REPL Help ===\n");
println!("\n=== Tiles REPL ===\n");

println!("Model:");
println!(" {}", model_name);

println!("Directory:");
println!(" {}\n", get_memory_path().unwrap());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's explore the repository structure
git ls-files | head -20

Repository: tilesprivacy/tiles

Length of output: 351


🏁 Script executed:

# Check if the file exists
ls -la tiles/src/runtime/mlx.rs

Repository: tilesprivacy/tiles

Length of output: 136


🏁 Script executed:

# Read the specific lines mentioned in the review
sed -n '206,214p' tiles/src/runtime/mlx.rs

Repository: tilesprivacy/tiles

Length of output: 275


🏁 Script executed:

# Let's see more context around those lines
sed -n '200,220p' tiles/src/runtime/mlx.rs

Repository: tilesprivacy/tiles

Length of output: 551


🏁 Script executed:

# Find the get_memory_path function definition
rg "fn get_memory_path" -A 5

Repository: tilesprivacy/tiles

Length of output: 544


🏁 Script executed:

# Also search for get_default_memory_path to see if it exists
rg "get_default_memory_path"

Repository: tilesprivacy/tiles

Length of output: 522


🏁 Script executed:

# Search for all calls to get_memory_path to understand usage patterns
rg "get_memory_path\(\)" -B 2 -A 2

Repository: tilesprivacy/tiles

Length of output: 1085


🏁 Script executed:

# Get the full implementation of get_memory_path
sed -n '/^pub fn get_memory_path/,/^}/p' tiles/src/utils/config.rs | head -30

Repository: tilesprivacy/tiles

Length of output: 593


🏁 Script executed:

# Get the full implementation of get_default_memory_path
sed -n '/^pub fn get_default_memory_path/,/^}/p' tiles/src/utils/config.rs | head -30

Repository: tilesprivacy/tiles

Length of output: 248


🏁 Script executed:

# Check get_or_set_memory_path to see how it handles errors
sed -n '/^fn get_or_set_memory_path/,/^}/p' tiles/src/runtime/mlx.rs | head -40

Repository: tilesprivacy/tiles

Length of output: 1814


🏁 Script executed:

# Check what Result type is being used (custom Result or std::Result)
rg "^type Result" tiles/src/utils/config.rs

Repository: tilesprivacy/tiles

Length of output: 44


🏁 Script executed:

# Look at the beginning of config.rs to see what Result is
head -30 tiles/src/utils/config.rs

Repository: tilesprivacy/tiles

Length of output: 1018


Handle error gracefully in show_help() instead of panicking.

get_memory_path() returns Result<String> and can fail when memory path isn't configured, causing unwrap() to panic the REPL. Replace with error handling using get_default_memory_path() as a fallback, or display "" instead.

🛠️ Proposed fix
-    println!("  {}\n", get_memory_path().unwrap());
+    let mem_path = match get_memory_path() {
+        Ok(p) => p,
+        Err(_) => get_default_memory_path()
+            .map(|p| p.display().to_string())
+            .unwrap_or_else(|_| "<not configured>".to_string()),
+    };
+    println!("  {}\n", mem_path);
🤖 Prompt for AI Agents
In `@tiles/src/runtime/mlx.rs` around lines 206 - 214, The show_help() function
currently calls get_memory_path().unwrap(), which can panic; change it to handle
the Result: call get_memory_path() and if Ok(path) print it, otherwise call
get_default_memory_path() and use that when available, or print "<not
configured>" as the fallback; update the print block in show_help() to use this
non-panicking value so the REPL no longer crashes when memory path is missing.

Comment thread tiles/src/runtime/mlx.rs
Comment on lines +491 to +496
let api_url = if run_args.memory {
"http://127.0.0.1:6969/v1/chat/completions"
} else {
"http://127.0.0.1:6969/v1/responses"
};
let res = client.post(api_url).json(&body).send().await.unwrap();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cd tiles && find . -name "mlx.rs" -type f

Repository: tilesprivacy/tiles

Length of output: 82


🏁 Script executed:

wc -l tiles/src/runtime/mlx.rs

Repository: tilesprivacy/tiles

Length of output: 90


🏁 Script executed:

sed -n '480,510p' tiles/src/runtime/mlx.rs

Repository: tilesprivacy/tiles

Length of output: 1077


🏁 Script executed:

sed -n '470,490p' tiles/src/runtime/mlx.rs

Repository: tilesprivacy/tiles

Length of output: 559


🏁 Script executed:

sed -n '500,530p' tiles/src/runtime/mlx.rs

Repository: tilesprivacy/tiles

Length of output: 1196


🏁 Script executed:

sed -n '491,496p' tiles/src/runtime/mlx.rs

Repository: tilesprivacy/tiles

Length of output: 287


Propagate HTTP request errors instead of panicking with unwrap().

The client.post(api_url).send().await.unwrap() call will panic on network failures. Since the function returns Result<ChatResponse, String>, errors should be propagated to allow the REPL to recover.

🛠️ Suggested fix
-    let res = client.post(api_url).json(&body).send().await.unwrap();
+    let res = client
+        .post(api_url)
+        .json(&body)
+        .send()
+        .await
+        .map_err(|e| e.to_string())?;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let api_url = if run_args.memory {
"http://127.0.0.1:6969/v1/chat/completions"
} else {
"http://127.0.0.1:6969/v1/responses"
};
let res = client.post(api_url).json(&body).send().await.unwrap();
let api_url = if run_args.memory {
"http://127.0.0.1:6969/v1/chat/completions"
} else {
"http://127.0.0.1:6969/v1/responses"
};
let res = client
.post(api_url)
.json(&body)
.send()
.await
.map_err(|e| e.to_string())?;
🤖 Prompt for AI Agents
In `@tiles/src/runtime/mlx.rs` around lines 491 - 496, The HTTP POST currently
uses client.post(api_url).json(&body).send().await.unwrap(), which will panic on
failures; change this to propagate errors into the function's Result by
replacing the unwrap with error mapping/propagation (e.g., await the send and
use ? or map_err to convert reqwest errors into the function's String error
type), and likewise handle non-success HTTP statuses before parsing the response
into ChatResponse; update the variables referenced (api_url, run_args.memory,
and res) so send errors and bad-status responses return Err(String) instead of
panicking.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 1.69492% with 58 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
tiles/src/utils/config.rs 0.00% 28 Missing ⚠️
tiles/src/runtime/mlx.rs 0.00% 21 Missing ⚠️
tiles/tests/config.rs 10.00% 9 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant