Skip to content

fix(import): fail fast for missing agent files#2629

Merged
cpacker merged 1 commit into
mainfrom
fix/import-missing-file-fast
May 30, 2026
Merged

fix(import): fail fast for missing agent files#2629
cpacker merged 1 commit into
mainfrom
fix/import-missing-file-fast

Conversation

@cpacker
Copy link
Copy Markdown
Collaborator

@cpacker cpacker commented May 30, 2026

Summary

  • Validate local AgentFile paths before opening the upload stream for --import.
  • Return a deterministic AgentFile not found: ... error for missing files instead of constructing a createReadStream for a nonexistent path.

Why

Main has been flaking in the Linux x64 integration job on Startup Flow - Invalid Inputs > --import with nonexistent file shows error. The job log showed this was not a normal assertion failure: the spawned bun run dev --no-memfs --import /nonexistent/path/agent.af -p test process hit a Bun 1.3.0 SIGILL/segfault after constructing the missing-file stream, then the test timed out and Bun reported a dangling child process.

The import path previously created a createReadStream(resolvedPath) and passed it into the API import call without checking that the file existed. For missing files, Node/Bun streams report ENOENT asynchronously; in CI this sometimes exercised a Bun crash path. Failing before createReadStream avoids that flake and gives users a clearer error.

Test plan

  • bun test src/integration-tests/startup-flow.integration.test.ts -t "--import with nonexistent file shows error"
  • bun run dev --no-memfs --import /nonexistent/path/agent.af -p test exits 1 with Error: AgentFile not found: /nonexistent/path/agent.af
  • bun run check

👾 Generated with Letta Code

Validate local AgentFile paths before opening an upload stream so missing imports return a deterministic error instead of exercising Bun stream crash behavior.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>
@cpacker cpacker merged commit 24804d6 into main May 30, 2026
17 checks passed
@cpacker cpacker deleted the fix/import-missing-file-fast branch May 30, 2026 04:28
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.

1 participant