Skip to content

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

Merged
gcsecsey merged 4 commits into
trunkfrom
stu-1729-cli-remove-feature-flag-gating-from-remote-session-wordpress
May 19, 2026
Merged

CLI: Remove feature flag gating from remote-session#3513
gcsecsey merged 4 commits into
trunkfrom
stu-1729-cli-remove-feature-flag-gating-from-remote-session-wordpress

Conversation

@gcsecsey

@gcsecsey gcsecsey commented May 15, 2026

Copy link
Copy Markdown
Member

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?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 thread specs/studio-code-remote-session-spec.md Outdated
@gcsecsey
gcsecsey requested a review from epeicher May 19, 2026 12:51
@gcsecsey
gcsecsey marked this pull request as ready for review May 19, 2026 12:51
@wpmobilebot

wpmobilebot commented May 19, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 32c83b0 vs trunk

app-size

Metric trunk 32c83b0 Diff Change
App Size (Mac) 1354.53 MB 1354.53 MB 0.00 MB ⚪ 0.0%

site-editor

Metric trunk 32c83b0 Diff Change
load 1568 ms 1581 ms +13 ms ⚪ 0.0%

site-startup

Metric trunk 32c83b0 Diff Change
siteCreation 8567 ms 8555 ms 12 ms ⚪ 0.0%
siteStartup 4923 ms 4922 ms 1 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@epeicher epeicher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @gcsecsey for releasing this! I have tested it, and I can see and execute the command as expected without the feature flag.

CLI commands
Image

I have also tested creating a site using studio code just co check the regression impact and I haven't found anything. Changes also LGTM!

@gcsecsey
gcsecsey merged commit e3cc17b into trunk May 19, 2026
10 checks passed
@gcsecsey
gcsecsey deleted the stu-1729-cli-remove-feature-flag-gating-from-remote-session-wordpress branch May 19, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants