You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously, POSIX-prefixed Windows drive paths (e.g. /C:/foo/main.py) could resolve as
drive-relative paths and write files under the process working
directory. Missing-marker fallbacks also led agents to resend
payloads unnecessarily.
Update Write handling to:
- Normalize malformed Windows drive paths while preserving remote
POSIX path semantics
- Report corrected paths and provide platform-specific examples
- Direct agents to move preserved fallback files instead of
resubmitting content
- Cover path normalization and fallback guidance with focused tests
use bitfun_agent_tools::strip_invalid_windows_drive_path_prefix;
18
19
use serde_json::{json,Value};
19
20
use std::path::Path;
20
21
use tokio::fs;
@@ -237,16 +238,21 @@ impl FileWriteTool {
237
238
logical_path:&str,
238
239
outcome:WriteLocalFileOutcome,
239
240
missing_path_fallback:bool,
241
+
path_format_warning:Option<&str>,
240
242
ignored_parameter_names:&[String],
241
243
) -> ToolResult{
242
244
letmut assistant_message = if missing_path_fallback {
243
245
format!(
244
-
"The Write payload did not start with the required '+++ {{file_path}}' marker. The entire payload was saved to {}. Use your shell tool to rename this file to the intended path instead of calling Write to resubmit the same content.",
246
+
"The entire payload was saved to {}. Use your shell tool to move this file to the intended path. Do not call Write to resubmit the same content because doing so wastes tokens and time. This happened because the Write payload did not start with the required '+++ {{file_path}}' marker. Future Write calls must follow the required payload format.",
"The provided Windows path '{}' had an invalid leading '/'. It was normalized to '{}'. Use a drive-letter path without the leading '/' in future Write calls.",
289
+
resolved.requested_path, resolved.logical_path
290
+
))
291
+
}
292
+
277
293
fninput_schema() -> Value{
278
294
json!({
279
295
"type":"object",
@@ -306,10 +322,10 @@ Usage:
306
322
- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.
This call includes an unnecessary `file_path` parameter. Write only uses `payload`; specify the target path in the first `+++ {file_path}` line and do not pass additional parameters.
331
351
</bad-example>
@@ -522,6 +542,7 @@ impl Tool for FileWriteTool {
522
542
};
523
543
524
544
let resolved = context.resolve_tool_path(&file_path)?;
545
+
let path_format_warning = Self::path_format_correction_warning(&resolved);
0 commit comments