Skip to content

Conversation

@yoonsio
Copy link
Contributor

@yoonsio yoonsio commented Oct 15, 2025

Refactor shared lib to use fs.FS instead of workingDir to support both real and virtual file systems.
Unlike previous behavior, all symlink files are excluded.

ref HA-304

Copy link
Member

@rektdeckard rektdeckard left a comment

Choose a reason for hiding this comment

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

Nice, thanks for the change!

Comment on lines -184 to -217
// Follow symlinks and include the actual file contents
if info.Mode()&os.ModeSymlink != 0 {
realPath, err := filepath.EvalSymlinks(path)
if err != nil {
return fmt.Errorf("failed to evaluate symlink %s: %w", path, err)
}
info, err = os.Stat(realPath)
if err != nil {
return fmt.Errorf("failed to stat %s: %w", realPath, err)
}
// Open the real file instead of the symlink
file, err := os.Open(realPath)
if err != nil {
return fmt.Errorf("failed to open file %s: %w", realPath, err)
}
defer file.Close()

header, err := tar.FileInfoHeader(info, "")
if err != nil {
return fmt.Errorf("failed to create tar header for file %s: %w", path, err)
}
header.Name = relPath
if err := tarWriter.WriteHeader(header); err != nil {
return fmt.Errorf("failed to write tar header for file %s: %w", path, err)
}

// Copy file contents directly without progress bar
_, err = io.Copy(tarWriter, file)
if err != nil {
return fmt.Errorf("failed to copy file content for %s: %w", path, err)
}
return nil
}

Copy link
Member

@rektdeckard rektdeckard Oct 17, 2025

Choose a reason for hiding this comment

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

I think there was at least one user who needed symlinking to support a monorepo with multiple agent projects and shared code...but I guess until we have a better solution for that use-case it is okay to remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah hopefully in those cases, the original files are part of the source so this won't be an issue.

Copy link
Member

Choose a reason for hiding this comment

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

They had shared code and each agent at the same level, so they would have to make some changes. They were doing this:

/shared
/agent-a
  agent.py
  pyptoject.toml
/agent-b
  agent.py
  pyptoject.toml

But still think its okay to break. Let's do a minor version bump when we release this.

@yoonsio yoonsio merged commit 87eb842 into main Oct 17, 2025
9 checks passed
@yoonsio yoonsio deleted the sy/shared-fs branch October 17, 2025 16:53
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.

4 participants