about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2026-05-20 02:53:55 +0100
committerArun Isaac2026-05-20 02:56:07 +0100
commit795bdef587fc365d2a566105c30469999210919e (patch)
treed540e9f5dcb63246a9f107dddcfaee267980c1f0
parent00d2dd1a43fd464480090b21e1ed493813633725 (diff)
downloadkaagum-795bdef587fc365d2a566105c30469999210919e.tar.gz
kaagum-795bdef587fc365d2a566105c30469999210919e.tar.lz
kaagum-795bdef587fc365d2a566105c30469999210919e.zip
Change to cwd only when it exists in the tool call container.
-rw-r--r--kaagum/tools.scm6
1 files changed, 5 insertions, 1 deletions
diff --git a/kaagum/tools.scm b/kaagum/tools.scm
index 97f0796..65060ea 100644
--- a/kaagum/tools.scm
+++ b/kaagum/tools.scm
@@ -267,7 +267,11 @@ available tools to their respective @code{<tool>} objects."
                            args))
                      (tool-container-namespaces tool)
                    (lambda ()
-                     (chdir (tool-call-session-cwd tool-call))
+                     ;; If the tool does not mount the current directory in the
+                     ;; container, it may not exist. So, chdir only when the
+                     ;; current directory exists in the container.
+                     (when (file-exists? (tool-call-session-cwd tool-call))
+                       (chdir (tool-call-session-cwd tool-call)))
                      (apply (tool-proc tool)
                             args)))))
            ;; Build result.