fix(cli): resolve dev-mode spawn crash and improve early exit handling#244
Open
falconlux wants to merge 1 commit intotiann:mainfrom
Open
fix(cli): resolve dev-mode spawn crash and improve early exit handling#244falconlux wants to merge 1 commit intotiann:mainfrom
falconlux wants to merge 1 commit intotiann:mainfrom
Conversation
Two fixes for session spawn in development mode: 1. Fix @/ path alias resolution when runner spawns child processes: In dev mode, Bun resolves tsconfig path aliases relative to cwd. When spawning agent sessions, cwd was set to the user's project directory (not cli/), causing @/ imports to fail. Now spawnHappyCLI overrides cwd to cli/ and passes the real directory via HAPI_SPAWN_CWD env variable, which all agent runners read via getSpawnedWorkingDirectory(). 2. Fix webhook timeout not resolving on early child exit: When a spawned agent process crashed immediately, the spawn awaiter waited the full 15s timeout before returning an error. Now onChildExited resolves the awaiter immediately, reducing failed resume attempts from ~30s to instant. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
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
@/path alias resolution failure when runner spawns child processes in dev mode (Bun resolves tsconfig relative to cwd, which was the user's project dir instead ofcli/)Changes
spawnHappyCLI.ts: In dev mode, override cwd tocli/for tsconfig resolution, pass real directory viaHAPI_SPAWN_CWDenv; addgetSpawnedWorkingDirectory()helperrun.ts: AddpidToSpawnRejectmap soonChildExitedresolves spawn awaiter immediately on crashgetSpawnedWorkingDirectory()instead ofprocess.cwd()Test plan
🤖 Generated with Claude Code
via Happy