Skip to content

CLI: Remove feature flag gating from remote-session#3513

Draft
gcsecsey wants to merge 1 commit into
trunkfrom
stu-1729-cli-remove-feature-flag-gating-from-remote-session-wordpress
Draft

CLI: Remove feature flag gating from remote-session#3513
gcsecsey wants to merge 1 commit into
trunkfrom
stu-1729-cli-remove-feature-flag-gating-from-remote-session-wordpress

Conversation

@gcsecsey
Copy link
Copy Markdown
Member

@gcsecsey gcsecsey commented May 15, 2026

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_SESSION env 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.

  • Deleted apps/cli/lib/feature-flags.ts and its tests. The flag and its only export, isRemoteSessionEnabled(), are gone.
  • studio code remote-session (in apps/cli/index.ts) is registered unconditionally instead of behind a dynamic import + flag check.
  • The hidden --message-from-stdin option on studio code is 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.
  • The /remote-session slash command no longer carries an enabled gate. The unused enabled field on SlashCommandDef and the filter inside getActiveSlashCommands() were removed since they had no other consumers.
  • startDaemonStatusPolling() no longer takes an isEnabled option. The 5s getDaemonStatus() poll that mirrors daemon liveness into the REPL bottom-bar runs unconditionally.
  • Cleaned up stale comments referencing the flag in apps/cli/ai/tools/index.ts, apps/cli/ai/tools/share-screenshot.ts, and the spec under specs/studio-code-remote-session-spec.md (added a 2026-05-15 status note documenting the removal).
  • Pairs with the backend gating removal: both gates need to come down for the feature to be public.

Testing Instructions

  • Run npm run cli:build && node apps/cli/dist/cli/main.mjs code --help. Confirm the remote-session subcommand is listed without setting any env var.
  • Run node apps/cli/dist/cli/main.mjs code remote-session --help and verify start, stop, status, attach are all advertised.
  • Start an interactive studio code session, type /, and confirm /remote-session appears in the autocomplete with start / stop argument completions, again without any env var set.
  • Run /remote-session start from the REPL and verify the bottom-bar indicator flips to running. Stop the daemon from a second terminal with studio code remote-session stop and confirm the REPL's indicator updates within ~5s (the unconditional poll).
  • Confirm tests pass: npm test -- apps/cli.
State trunk this branch
studio code --help showing remote-session subcommand CleanShot 2026-05-18 at 12 37 19@2x CleanShot 2026-05-18 at 12 35 33@2x
/ autocomplete showing /remote-session CleanShot 2026-05-18 at 12 37 48@2x CleanShot 2026-05-18 at 12 35 51@2x
Bottom-bar indicator after /remote-session start N/A CleanShot 2026-05-18 at 12 36 00@2x

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_SESSION feature flag implementation and its tests.
  • Register studio code remote-session and the hidden --message-from-stdin option 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 --json validation 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants