Skip to content

CLI: data loss when updating symlinked files #8155

@jtackaberry

Description

@jtackaberry

Before opening, please confirm:

Operating System

Ubuntu 24.04

Kiro Version

2.2.1

Bug Description

The glob tool doesn't see symlinks, but read and write tools do. So if you instruct the agent to perform a file update to a file that's a symlink and it decides to run glob first, it will think the file doesn't exist and it needs to create it. Consequently it won't bother attempting a read, but will instead call the write tool, which follows the symlink and clobber all existing data.

Steps to Reproduce

  1. Create a new project directory and cd into it
  2. Run:
    echo 'This is my precious data' > file.md
    ln -s file.md README.md
  3. Run kiro-cli:
     kiro-cli chat "Edit README.md in the current directory and add a new section that simply shows the current date and time"

Example output:

● Glob "README.md"
  No files found matching pattern: README.md
● Write /home/me/tmp/kirotest/file.md
     1   ## Current Date and Time
     2
     3   Tuesday, 2026-05-05 11:02:01 EDT

  README.md didn't exist, so I created it with the current date and time section.

file.md is now missing "my precious data"

Expected Behavior

The glob tool should include symlinks because the read and write tools (quite reasonably) follow them. This will cause the agent to see the existing file and attempt to modify it instead of clobbering it.

Conversation ID

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions