-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat: ✨ Remove TTY requirement for the cli in headless mode #8691
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
base: main
Are you sure you want to change the base?
Conversation
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.
7 issues found across 11 files
Prompt for AI agents (all 7 issues)
Understand the root cause of the following 7 issues and fix them.
<file name=".continue/prompts/sub-agent-foreground.md">
<violation number="1" location=".continue/prompts/sub-agent-foreground.md:9">
Please correct the typo in this user-facing instruction so it reads "foreground" instead of "forground".</violation>
</file>
<file name=".continue/prompts/sub-agent-background.md">
<violation number="1" location=".continue/prompts/sub-agent-background.md:11">
Wrap the interpolated prompt in shell-safe quoting before passing it to `cn -p` so multi-word prompts stay intact and user input cannot break into additional shell commands.</violation>
</file>
<file name="extensions/cli/src/commands/chat.ts">
<violation number="1" location="extensions/cli/src/commands/chat.ts:449">
Throwing whenever `prompt` is falsy breaks headless runs that rely on `--prompt` or `--agent`: we combine those sources immediately afterwards, so these valid flows now fail. Please only reject when none of the prompt sources are provided.</violation>
</file>
<file name="extensions/cli/src/util/cli.ts">
<violation number="1" location="extensions/cli/src/util/cli.ts:56">
Treating --agent as supplying a prompt makes headless runs with piped stdin (e.g. `echo "review" | cn -p --agent …`) drop the input because `readStdinSync` now bails early.</violation>
</file>
<file name="extensions/cli/src/util/stdin.ts">
<violation number="1" location="extensions/cli/src/util/stdin.ts:24">
`hasSuppliedPrompt()` only checks the argument immediately following `-p/--print`, so commands like `cn -p --config my.yaml "Prompt"` still fall through to blocking stdin reads even though a prompt is supplied; the new guard reintroduces the hang you’re trying to remove.</violation>
</file>
<file name="extensions/cli/spec/tty-less-support.md">
<violation number="1" location="extensions/cli/spec/tty-less-support.md:101">
This bullet claims headless logger output is line-buffered, but configureHeadlessMode() only adjusts stdout/stderr encoding and never changes buffering, so the documentation is inaccurate.</violation>
<violation number="2" location="extensions/cli/spec/tty-less-support.md:102">
Nothing in the logger configuration currently disables progress indicators, so this documentation line overstates what the implementation does.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
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.
No issues found across 2 files
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
…o feat-ttyless-cli
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.
1 issue found across 2 files (reviewed changes from recent commits).
1 issue found across 2 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="extensions/cli/src/commands/chat.ts">
<violation number="1" location="extensions/cli/src/commands/chat.ts:449">
Allowing `--agent` to bypass the headless prompt guard means agents without a prompt still trigger the interactive `question()` call and hang in TTY-less headless runs. Please keep rejecting headless executions until some actual prompt text is available.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
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.
2 issues found across 6 files (reviewed changes from recent commits).
2 issues found across 6 files
Prompt for AI agents (all 2 issues)
Understand the root cause of the following 2 issues and fix them.
<file name="extensions/cli/src/util/cli.ts">
<violation number="1" location="extensions/cli/src/util/cli.ts:60">
`--agent` takes a slug argument, but since it is missing from `flagsWithValues`, its slug is misidentified as the prompt and `hasSuppliedPrompt()` still returns true—stdin is skipped even though no prompt was supplied. Please add `--agent` to the value-skipping set so the flag’s argument isn’t mistaken for a prompt.</violation>
</file>
<file name="extensions/cli/src/util/cli.test.ts">
<violation number="1" location="extensions/cli/src/util/cli.test.ts:103">
The logic for determining if a prompt is supplied via `--agent` is inconsistent across files. The new test in `cli.test.ts` asserts that `hasSuppliedPrompt()` is true for `--agent`, but the implementation and comments in `cli.ts` imply it should be false, leading to hangs in headless mode.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
…m:chezsmithy/continue into feat-ttyless-cli
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.
No issues found across 2 files
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.
No issues found across 3 files
|
This should be ready for review. The failures in the binary and jetbrains tests are unexpected. Appears maybe the package-lock in the binary directory needs to be updated? |
Description
I'd noticed that due to TTY specific requirements it wasn't possible to launch the continue CLI locally from the vscode or intelliJ terminal tools. This change allows that to work when the cli is launched in headless mode. This unlocks headless sub agents to be used locally.
I've included a couple of sample prompts in this PR as well which can now unlock running background and foreground subagents.
Nice use cases include launching prettier, or code cleanup tasks in the background while you keep coding. Or perhaps kicking off the generation of tests in a separate agent context off of the main context in the extension.
AI Code Review
@continue-reviewChecklist
Screen recording or screenshot
[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]
Tests
Added new headless tests.
Summary by cubic
Removes the TTY requirement when running the CLI in headless mode (-p), so it works in VSCode/IntelliJ terminals, Docker, and CI without hanging. This enables local headless sub-agents and clean non-interactive runs.
Written for commit 45cace7. Summary will update automatically on new commits.