fix(import): fail fast for missing agent files#2629
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--import.AgentFile not found: ...error for missing files instead of constructing acreateReadStreamfor 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 spawnedbun run dev --no-memfs --import /nonexistent/path/agent.af -p testprocess 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 reportENOENTasynchronously; in CI this sometimes exercised a Bun crash path. Failing beforecreateReadStreamavoids 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 testexits 1 withError: AgentFile not found: /nonexistent/path/agent.afbun run check👾 Generated with Letta Code