Repository navigation
fix(cli): heal deleted cwd at launch and avoid stream init in TTY guard #3401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lidge-jun
merged 3 commits into
lidge-jun:dev
from
agentHits:fix/heal-deleted-cwd-and-isatty-guard
Sep 4, 2026
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
7045a00
fix(cli): heal deleted cwd at launch and avoid stream init in TTY guard
agentHits ed62a1b
test(update): add regression coverage for interactiveGuardOk and fix …
agentHits 8fb7ae5
chore(cli): align star-prompt isatty guard and clarify cwd heal comment
agentHits File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 16125
🤖 get_repo_knowledge executed:
get_repo_knowledge lidge-jun/opencodex /tmp/coderabbit-repo-knowledge/lidge-jun-opencodex-7afea732/conventions /tmp/coderabbit-repo-knowledge/lidge-jun-opencodex-7afea732/learningsLength of output: 15657
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 7289
🌐 Web query:
Node.js tty.isatty(fileDescriptor) documentation checks whether the file descriptor is a TTY💡 Result:
The Node.js tty.isatty(fd) method is used to determine if a specific numeric file descriptor is associated with a TTY (terminal) [1][2]. It returns true if the given fd is associated with a TTY, and false if it is not [1][3]. This false return value also occurs if the provided fd is not a non-negative integer [1][4]. While tty.isatty(fd) is available, the official Node.js documentation notes that it is generally not necessary to use the tty module directly [1][5]. The preferred method for checking if Node.js is running within a TTY context is to check if the process.stdout.isTTY property is true [1][2].
Citations:
🌐 Web query:
Bun node:tty isatty(fileDescriptor) compatibility documentation numeric file descriptor💡 Result:
In Bun, the node:tty module's tty.isatty(fd) function is fully implemented and provides API compatibility with Node.js [1][2][3]. The function accepts a numeric file descriptor (fd) as its argument [4][1]. It returns true if the specified file descriptor is associated with a TTY (terminal) device, and false if it is not [4][1]. The function also returns false if the provided fd is not a non-negative integer [4][1]. This functionality allows you to check for TTY status in CLI applications, mirroring the behavior expected in Node.js environments [1][2]. As of Bun v0.3.0, the implementation ensures that tty.isatty correctly identifies TTY-associated file descriptors [5]. References: [4] https://bun.com/reference/node/tty/isatty [1] https://bun.com/reference/node/tty [2] https://bun.sh/reference/node/tty [3] https://bun.com/docs/runtime/nodejs-compat [5] oven-sh/bun#1302
Citations:
Update the TTY test seam for descriptor-based detection.
src/cli/star-prompt.ts:171callsnode:tty.isatty(0)andisatty(1), which inspect numeric file descriptors. The overrides intests/star-deferral.test.ts:74-75only changeprocess.stdin.isTTYandprocess.stdout.isTTY, so they do not affect this guard. Without a PTY,maybeShowStarPrompt()returns before the deferral log,.star-deferredwrite, or prompt assertions. Inject anisattypredicate throughsetStarPromptDepsForTests()and returntruein this test, or run the test under a real PTY. Runbun test tests/star-deferral.test.ts.🤖 Prompt for AI Agents