CLI: Remove feature flag gating from remote-session#3513
Draft
gcsecsey wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes the CLI remote-session feature publicly available by removing the STUDIO_ENABLE_REMOTE_SESSION feature-flag gate and registering the related command surfaces unconditionally.
Changes:
- Remove the
STUDIO_ENABLE_REMOTE_SESSIONfeature flag implementation and its tests. - Register
studio code remote-sessionand the hidden--message-from-stdinoption unconditionally. - Remove slash-command gating and make daemon status polling always run to keep the REPL indicator in sync.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| specs/studio-code-remote-session-spec.md | Updates spec notes to reflect removal of the feature flag and unconditional daemon polling. |
| apps/cli/lib/feature-flags.ts | Deletes the feature flag helper (isRemoteSessionEnabled). |
| apps/cli/lib/tests/feature-flags.test.ts | Deletes tests for the removed feature flag helper. |
| apps/cli/index.ts | Registers the remote-session command unconditionally. |
| apps/cli/commands/ai/index.ts | Always registers and honors --message-from-stdin; starts daemon status polling unconditionally. |
| apps/cli/ai/daemon-status-poll.ts | Removes enablement gating so polling always runs. |
| apps/cli/ai/tests/daemon-status-poll.test.ts | Updates polling tests to reflect unconditional behavior. |
| apps/cli/ai/slash-commands.ts | Removes the enabled gate and related filtering for slash commands. |
| apps/cli/ai/tests/slash-commands.test.ts | Updates slash command tests to remove feature-flag expectations. |
| apps/cli/ai/tools/index.ts | Cleans up comments that referenced the removed feature flag. |
| apps/cli/ai/tools/share-screenshot.ts | Cleans up comments that referenced the removed feature flag. |
Comments suppressed due to low confidence (1)
apps/cli/commands/ai/index.ts:708
- The
--jsonvalidation error message is now inaccurate: callers can satisfy the requirement either by passing an initial message argument or by using--message-from-stdin. Update the message to mention both options so users aren’t misled when using stdin mode.
return chain.check( ( argv ) => {
if ( argv.json && ! argv.message && ! argv.messageFromStdin ) {
throw new Error( __( '--json requires an initial message argument' ) );
}
return true;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
161
to
+165
| Implementation notes: | ||
|
|
||
| - The command is gated by `STUDIO_ENABLE_REMOTE_SESSION` via the `enabled` getter on `SlashCommandDef`, so it is hidden from autocomplete and unreachable from the dispatcher when the flag is off. | ||
| - `SlashCommandDef.getArgumentCompletions(prefix)` returns `attach | detach` so typing `/remote-session ` shows them in the autocomplete dropdown. | ||
| - The REPL dispatcher matches on the first whitespace token (`/${name} <args>` rather than exact-match) so the handler receives the full prompt and parses the subcommand itself. | ||
| - The bottom-bar **daemon indicator** (`PromptEditor.daemonStatusMessage`) is updated immediately by the `attach`/`detach` handlers AND every 5s by a light `getDaemonStatus()` poll started by the REPL when the feature flag is on. The poll catches external start/stop (e.g. another terminal running `studio code remote-session stop`) and unexpected daemon death. | ||
| - The bottom-bar **daemon indicator** (`PromptEditor.daemonStatusMessage`) is updated immediately by the `attach`/`detach` handlers AND every 5s by a light `getDaemonStatus()` poll started by the REPL. The poll catches external start/stop (e.g. another terminal running `studio code remote-session stop`) and unexpected daemon death. |
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.
Related issues
How AI was used in this PR
Claude Code drafted the edits and ran typecheck, lint, the affected vitest suites, and the CLI build. I reviewed the diff before pushing.
Proposed Changes
The remote-session feature in the CLI was gated behind the
STUDIO_ENABLE_REMOTE_SESSIONenv var introduced in STU-1654 (default OFF). To make the initial version publicly available, this PR removes the gate so the feature ships on by default for everyone on a recent CLI build.apps/cli/lib/feature-flags.tsand its tests. The flag and its only export,isRemoteSessionEnabled(), are gone.studio code remote-session(inapps/cli/index.ts) is registered unconditionally instead of behind a dynamic import + flag check.--message-from-stdinoption onstudio codeis now always registered and honored. Previously the option was only added and only respected when the flag was on, which made the daemon's headless turn entry point unreachable for non-opted-in users./remote-sessionslash command no longer carries anenabledgate. The unusedenabledfield onSlashCommandDefand the filter insidegetActiveSlashCommands()were removed since they had no other consumers.startDaemonStatusPolling()no longer takes anisEnabledoption. The 5sgetDaemonStatus()poll that mirrors daemon liveness into the REPL bottom-bar runs unconditionally.apps/cli/ai/tools/index.ts,apps/cli/ai/tools/share-screenshot.ts, and the spec underspecs/studio-code-remote-session-spec.md(added a 2026-05-15 status note documenting the removal).Testing Instructions
npm run cli:build && node apps/cli/dist/cli/main.mjs code --help. Confirm theremote-sessionsubcommand is listed without setting any env var.node apps/cli/dist/cli/main.mjs code remote-session --helpand verifystart,stop,status,attachare all advertised.studio codesession, type/, and confirm/remote-sessionappears in the autocomplete withstart/stopargument completions, again without any env var set./remote-session startfrom the REPL and verify the bottom-bar indicator flips to running. Stop the daemon from a second terminal withstudio code remote-session stopand confirm the REPL's indicator updates within ~5s (the unconditional poll).npm test -- apps/cli.studio code --helpshowingremote-sessionsubcommand/autocomplete showing/remote-session/remote-session startPre-merge Checklist