on main help sign in
fix(ui): use absolute path consistently in insertFileCompletion

The file tracker lookup used absPath but os.Stat and os.ReadFile used the original relative path, which could resolve to different files in edge cases. Now all file operations use absPath for consistency, and the Attachment FilePath is set to absPath.

commitda0ab43cb4dca0b15e92a091419945a1c62d8394 authoriko <mail@iko.soy> dateWed 8 Jul 2026, 21:30 (3 months ago) parentc61252b
1 file changed+3−3
internal/ui/model/ui.go+3−3
internal/ui/model/ui.go+3−3
@@ -3427,7 +3427,7 @@ func (m *UI) insertFileCompletion(path string) tea.Cmd {
34273427 // Skip attachment if file was already read and hasn't been modified.
34283428 lastRead := m.com.Workspace.FileTrackerLastReadTime(m.ctx, m.session.ID, absPath)
34293429 if !lastRead.IsZero() {
3430− if info, err := os.Stat(path); err == nil && !info.ModTime().After(lastRead) {
3430+ if info, err := os.Stat(absPath); err == nil && !info.ModTime().After(lastRead) {
34313431 return nil
34323432 }
34333433 }
@@ -3438,14 +3438,14 @@ func (m *UI) insertFileCompletion(path string) tea.Cmd {
34383438 m.sessionFileReads = append(m.sessionFileReads, absPath)
34393439
34403440 // Add file as attachment.
3441− content, err := os.ReadFile(path)
3441+ content, err := os.ReadFile(absPath)
34423442 if err != nil {
34433443 // If it fails, let the LLM handle it later.
34443444 return nil
34453445 }
34463446
34473447 return message.Attachment{
3448− FilePath: path,
3448+ FilePath: absPath,
34493449 FileName: filepath.Base(path),
34503450 MimeType: mimeOf(content),
34513451 Content: content,