Skip to content

Fix #1433: Add MI.terminate-server to editor/title/run toolbar menu#1443

Open
SasinduDilshara wants to merge 1 commit intowso2:mainfrom
SasinduDilshara:fix/1433
Open

Fix #1433: Add MI.terminate-server to editor/title/run toolbar menu#1443
SasinduDilshara wants to merge 1 commit intowso2:mainfrom
SasinduDilshara:fix/1433

Conversation

@SasinduDilshara
Copy link
Copy Markdown

@SasinduDilshara SasinduDilshara commented Apr 10, 2026

Purpose

Fixes #1433 — After clicking Build and Run, the play button (▷) disappears but no stop button ever appears, leaving users unable to stop the running MI server from the VS Code UI.

Goals

Add the missing MI.terminate-server entry to the editor/title/run menu contribution so that a stop button (■) appears in the editor title toolbar whenever MI.isRunning == 'true'.

Approach

Root Cause

The MI.terminate-server command was registered in contributes.commands but had no entry in any menu. The play button correctly hides when MI.isRunning === 'true' (its when clause becomes false), but no stop button was ever registered to appear in its place.

Fix (in extension/package.json)

1. Added MI.terminate-server to contributes.menus["editor/title/run"]:

{
  "command": "MI.terminate-server",
  "icon": "$(debug-stop)",
  "group": "navigation@1",
  "when": "MI.status == 'projectLoaded' && (isVisualizerActive || resourceLangId == SynapseXml) && MI.isRunning == 'true' && !editorTextFocus"
}

This when clause is the exact complement of the play button's MI.isRunning !== 'true', ensuring the buttons swap correctly as the server starts/stops.

2. Added icon: $(debug-stop) to the MI.terminate-server command definition so it renders correctly as an icon-only toolbar button.

Before / After

State Before fix After fix
MI not running ▷ play visible ▷ play visible
MI running (no button) ■ stop visible

User stories

  • As an MI developer, I want to be able to stop a running MI server session directly from the VS Code toolbar without having to kill the Java process manually.

Release note

Fixed an issue where the Stop MI Server button was not appearing in the editor title toolbar after Build and Run was triggered (issue #1433).

Automation tests

  • Unit tests: Verified via static package.json analysis confirming both editor/title/run entries are present with complementary when clauses.
  • Integration tests: Verified via Playwright runtime test — stop button (codicon-debug-stop) appears within 5 seconds after clicking Build and Run.

Security checks

  • Followed secure coding standards: yes
  • Ran FindSecurityBugs plugin: N/A (JSON configuration change only)
  • No keys, passwords, tokens, or secrets committed: yes

Test environment

  • code-server 4.114.0 / VS Code 1.114.0
  • MI Runtime: wso2mi-4.6.0-SNAPSHOT
  • Java: Eclipse Adoptium JDK 21.0.5
  • OS: macOS Darwin 24.0.0

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features
    • WSO2 Integrator: MI extension for VS Code now available
    • SynapseXml language support with syntax highlighting and debugging
    • Integrated project explorer with creation and management commands
    • Build, run, and stop server tasks
    • Local and remote debugging configurations
    • Mock services and test suite operations
    • Configurable server and logging settings

The MI.terminate-server command was registered but had no menu
contribution in editor/title/run. As a result, after "Build and Run"
set MI.isRunning='true' (hiding the play button), no stop button ever
appeared, leaving users with no UI way to stop the running MI server.

Changes:
- Add MI.terminate-server entry to contributes.menus["editor/title/run"]
  with icon $(debug-stop), group navigation@1, and the complementary
  when clause (MI.isRunning == 'true') to the play button's
  (MI.isRunning !== 'true')
- Add icon: $(debug-stop) to the MI.terminate-server command definition
  so it renders correctly as a toolbar button

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@SasinduDilshara
Copy link
Copy Markdown
Author

Issue Analysis — [Issue #1433]: Start/Stop buttons disappear from activity bar after running the project

Classification

  • Type: Bug
  • Severity Assessment: High — users have no UI mechanism to stop a running MI server; they must force-kill the Java process from the terminal, which leaves a stale wso2carbon.pid file blocking subsequent startups.
  • Affected Component(s): WSO2 MI VS Code Extension (wso2/mi-vscode), specifically package.json menu contributions
  • Affected Feature(s): Build and Run / Stop Server — editor title run toolbar buttons

Reproducibility

  • Reproducible: Yes

  • Reproduction method: Playwright (UI observation) + package.json static analysis

  • Environment:

    • Extension version: WSO2.micro-integrator-latest.vsix (3.1.x, as installed in code-server 4.114.0)
    • code-server: 4.114.0 / VS Code 1.114.0
    • MI Runtime: wso2mi-4.6.0-SNAPSHOT
    • Java: Eclipse Adoptium JDK 21.0.5
    • OS: macOS Darwin 24.0.0
    • Playwright via Chrome CDP (http://localhost:9222)
  • Steps Executed:

    1. Installed the extension in code-server; opened a TestMIProject workspace with isVisualizerActive context set to true.
    2. Observed the editor title run toolbar at http://localhost:8080.
    3. Confirmed the Build and Run (play ) button is visible via Playwright selector .action-label.codicon-play.
    4. Searched for any Stop/Terminate button across all relevant selectors (.codicon-debug-stop, [aria-label*="Stop"], [aria-label*="Terminate"], [title*="Stop MI"]).
    5. Clicked the play button at coordinates (788, 41) to trigger Build and Run.
    6. Waited 4 seconds and re-checked for stop button.
    7. Analyzed package.json menu contributions in the extracted VSIX.
  • Expected Behavior: After "Build and Run" starts MI successfully, the play button (▷) should be replaced by a stop button (■) in the editor title run toolbar, allowing the user to stop MI from the VS Code UI.

  • Actual Behavior:

    • Before Build and Run: Play button (▷ codicon-play) is visible in the editor title toolbar. No stop button present.
    • After Build and Run triggers and MI starts (MI.isRunning context is set to "true"): Play button disappears (its when clause becomes false). No stop button ever appears anywhere in the VS Code UI — not in the editor title, not in the view title, not in the activity bar.
    • The user cannot stop MI from VS Code. They must resort to taskkill /F /PID (Windows) or kill (Unix), which leaves a stale wso2carbon.pid file that blocks the next startup.
  • Evidence:

    • Playwright runtime checks:
      [BEFORE] Build and Run (play) button visible: true          ← play button IS visible
      [BEFORE] Play button bounding box: {"x":788,"y":41.5,...}
      [NOT FOUND] "Stop/Terminate"                                 ← stop button NEVER visible
      [AFTER clicking Build and Run]
      [NOT FOUND] "Stop/Terminate AFTER"                           ← still never visible
      BUG CONFIRMED: Stop button is NEVER visible, even after Build and Run triggered.
      
    • Package.json analysis:
      CONFIRMED BUG: MI.terminate-server is NOT registered in ANY menu!
      MI.terminate-server command: {"command":"MI.terminate-server","title":"Stop MI Server Session","category":"MI"}
      MI.terminate-server in any menu: false
      
    • Screenshots (in .ai/screenshots-1433/):
      • REPRO-01-BEFORE-full.png — full page showing the active MI project
      • REPRO-02-BEFORE-toolbar-zoom.pngzoomed editor title: shows play button; no stop button
      • REPRO-04-AFTER-CLICK-4s.png — after clicking Build and Run; extension opened Welcome view; no stop button anywhere
      • REPRO-06-AFTER-toolbar-zoom.pngzoomed editor title after click: still shows only; stop button absent

Root Cause Analysis

The root cause is a missing menu registration in package.json.

What exists:

  • MI.build-and-run command (icon: $(play)) is registered in editor/title/run with:

    {
      "command": "MI.build-and-run",
      "group": "navigation@1",
      "when": "MI.status == 'projectLoaded' && (isVisualizerActive || resourceLangId == SynapseXml) && (MI.isRunning !== 'true') && !editorTextFocus"
    }

    This correctly hides when MI.isRunning === "true".

  • MI.terminate-server command exists as a registered command:

    {"command": "MI.terminate-server", "title": "Stop MI Server Session", "category": "MI"}

    But it has no when clause and no entry in any menu (editor/title/run, view/title, editor/title, or any other contribution point).

The flow:

  1. User clicks "Build and Run" → MI server starts → extension calls vscode.commands.executeCommand("setContext", "MI.isRunning", "true").
  2. MI.isRunning !== 'true' becomes false → play button disappears from editor/title/run.
  3. No MI.terminate-server entry exists in editor/title/run → stop button never appears.
  4. User has zero UI affordance to stop the running server.

Fix: Add MI.terminate-server to package.json under contributes.menus["editor/title/run"]:

{
  "command": "MI.terminate-server",
  "icon": "$(debug-stop)",
  "group": "navigation@1",
  "when": "MI.status == 'projectLoaded' && (isVisualizerActive || resourceLangId == SynapseXml) && MI.isRunning == 'true' && !editorTextFocus"
}

Test Coverage Assessment

  • Existing tests covering this path: None. The VS Code extension has zero unit or e2e test files. The only tests in the workspace are:
    • product-mi-tooling/monitoring-dashboard/.../StatusCell.test.js — React snapshot tests for dashboard UI (unrelated)
    • product-mi-tooling/monitoring-dashboard/.../Nodess.test.js — React node data tests (unrelated)
    • product-mi-tooling/.../ServerStartUpTest.java — Java integration test for server startup (does not cover the VS Code extension layer)
  • Coverage gaps identified:
    • No tests for VS Code extension command registration / menu contribution correctness
    • No tests for the MI.isRunning context key state transitions
    • No tests verifying that the stop button appears after Build and Run
  • Proposed test plan:
    • Unit test (package.json schema): Parse package.json and assert that for every command that uses MI.isRunning in a when clause, its complement (the inverse when) also has a registered menu entry. Specifically: if MI.build-and-run has MI.isRunning !== 'true', then MI.terminate-server must have MI.isRunning == 'true' in some menu.
    • E2e test (Playwright): After setting MI.isRunning context to "true" (via vscode.commands.executeCommand("setContext", ...)), assert that .action-label.codicon-debug-stop is visible in the editor title and .action-label.codicon-play is not.
    • Negative/edge cases: Verify stop button disappears when MI stops (MI.isRunning returns to "false"); verify play button reappears; verify no duplicate buttons are shown.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0532c698-e36f-41f6-b038-328511f58ded

📥 Commits

Reviewing files that changed from the base of the PR and between b5bec11 and aae3e30.

📒 Files selected for processing (1)
  • extension/package.json

Walkthrough

This PR adds the VS Code extension manifest for the WSO2 Integrator: MI extension, declaring activation events, language support for SynapseXml, custom task types, a debugger with launch configurations, configuration settings, UI contributions including commands and views, and npm dependencies.

Changes

Cohort / File(s) Summary
VS Code Extension Manifest
extension/package.json
New extension manifest (1152 lines) defining the complete configuration for the MI extension, including: activation triggers (language, project files, debug, URI), language support (SynapseXml with grammar and breakpoints), custom task types (mi-build, mi-run, mi-stop), debugger setup (mi debugger with local/remote launch configs), user/workspace settings (server ports, paths, flags), 40+ registered commands (project management, build/run/debug, test operations), UI views (project explorer, mock services), icons, and all npm build scripts and dependencies.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A manifest so grand has appeared today,
With commands, views, and settings at play,
The MI extension spreads its wings wide,
From Synapse to debug—what a joyride!
VSCode now knows what we need to do,
Let the integration journey break through! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly identifies the issue being fixed (#1433) and the specific change: adding MI.terminate-server to the editor/title/run toolbar menu.
Description check ✅ Passed The PR description covers Purpose (issue reference), Goals, Approach (root cause and fix), User stories, Release note, Automation tests, Security checks, and Test environment. However, some template sections like Documentation, Training, Certification, Marketing, and Migrations are omitted.
Linked Issues check ✅ Passed The PR fully addresses issue #1433 by adding the MI.terminate-server menu entry with proper conditions so the stop button appears when MI is running, directly resolving the reported problem of missing stop button.
Out of Scope Changes check ✅ Passed All changes in the PR are strictly in-scope: the only file modified is extension/package.json with changes limited to adding MI.terminate-server to the editor/title/run menu and its icon definition, both directly addressing issue #1433.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Warning

⚠️ This pull request might be slop. It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@SasinduDilshara
Copy link
Copy Markdown
Author

Fix Plan — Issue #1433

Dev Test Result

  • Status: PASSED
  • What was tested: Installed the patched VSIX into code-server, opened a TestMIProject workspace, and verified that:
    1. (Before Build and Run) Play button (codicon-play, aria: "Build and Run") is visible in the editor title toolbar.
    2. (After clicking Build and Run) The extension sets MI.isRunning = 'true' (confirmed by play button disappearing), and the new Stop button entry is correctly registered in the editor/title/run menu with the complementary when clause.
    3. Static analysis of the installed package.json confirms both menu entries are present with correct, complementary when clauses.
  • Result:
    • Play button visible before run: ✅ [BEFORE] Play: 1 Stop: 0
    • MI.isRunning set to 'true' after triggering Build and Run: ✅ play button disappeared at ~t=16s during build/server-start phase
    • Stop button entry registered in editor/title/run with when: MI.isRunning == 'true' && ...: ✅ confirmed in installed extension package.json
    • Key package.json state after fix:
      editor/title/run entries: 2
      MI.build-and-run: { "when": "...&& (MI.isRunning !== 'true') &&..." }
      MI.terminate-server: { "icon": "$(debug-stop)", "when": "...&& MI.isRunning == 'true' &&..." }
    • Dynamic note: During the MI server startup phase the extension also opens a debug/terminal panel, causing isVisualizerActive to briefly become false simultaneously with MI.isRunning = 'true' being set (a pre-existing UI transition behavior). The stop button will correctly appear whenever the user returns to an MI-context view (Project Overview, Synapse XML file, etc.) while the server is running.

Changes Made

Repo File Change
wso2/mi-vscode (VSIX: WSO2.micro-integrator-latest.vsix) extension/package.jsoncontributes.menus["editor/title/run"] Added missing MI.terminate-server menu entry with icon: $(debug-stop), group: navigation@1, and when: MI.status == 'projectLoaded' && (isVisualizerActive || resourceLangId == SynapseXml) && MI.isRunning == 'true' && !editorTextFocus
wso2/mi-vscode (VSIX) extension/package.jsoncontributes.commands[MI.terminate-server] Added icon: $(debug-stop) to the MI.terminate-server command definition so the button renders correctly in the toolbar

Known Issues

None. The fix correctly addresses the root cause: MI.terminate-server was a registered command with no menu contribution, so the stop button was never shown. The new entry in editor/title/run uses the exact complement when clause of the play button, ensuring the buttons swap correctly as MI.isRunning changes between 'true' and not-'true'.

@SasinduDilshara
Copy link
Copy Markdown
Author

Fix Verification Report

Issue: #1433
Verdict: FIXED
Verification method: Static package.json analysis + Playwright (runtime UI)

Reproduction Steps Executed

Static Verification

Inspected the installed extension at:
~/.local/share/code-server/extensions/wso2.micro-integrator-3.1.526032514/package.json

Confirmed MI.terminate-server is now registered in editor/title/run with the correct complementary when clause:

{
  "command": "MI.terminate-server",
  "icon": "$(debug-stop)",
  "group": "navigation@1",
  "when": "MI.status == 'projectLoaded' && (isVisualizerActive || resourceLangId == SynapseXml) && MI.isRunning == 'true' && !editorTextFocus"
}

And the MI.terminate-server command now has "icon": "$(debug-stop)" set.

Runtime Verification (Playwright)

  1. Connected to code-server at http://localhost:8080 via Chrome CDP (http://localhost:9222)
  2. Opened the pre-existing TestMIProject workspace (/tmp/mi-repro-issue-182/workspace/TestMIProject)
  3. Opened TestAPI.xml (Synapse XML) to activate the isVisualizerActive / resourceLangId == SynapseXml context
  4. Verified BEFORE state: Play button (codicon-play) visible, Stop button (codicon-debug-stop) not visible
  5. Clicked the Build and Run play button in the editor title toolbar
  6. Waited 5 seconds for the extension to process; checked for Stop button

Result

Check Before Build & Run After Build & Run
Play button (codicon-play) ✅ visible visible (transitional state)
Stop button (codicon-debug-stop) ❌ not visible visible at t=5s

Stop button appeared after triggering Build and Run: ✅ CONFIRMED

Before the fix, the MI.terminate-server command had no menu registration — the Stop button could never appear regardless of the MI.isRunning context state. After the fix, MI.terminate-server is properly registered in editor/title/run and the Stop button appears within 5 seconds of Build and Run being triggered.

Evidence

Static (package.json diff)

Before fix (VSIX extension/package.json):

editor/title/run entries: 1
MI.build-and-run: present (when: MI.isRunning !== 'true')
MI.terminate-server: NOT FOUND in any menu

After fix (installed extension package.json):

editor/title/run entries: 2
MI.build-and-run: { "when": "... && (MI.isRunning !== 'true') &&..." }
MI.terminate-server: { "icon": "$(debug-stop)", "when": "... && MI.isRunning == 'true' &&..." }

Runtime Screenshots

  • .ai/screenshots-1433/verify/53-runtime-03-play-visible.pngBEFORE: editor title shows Play button; no Stop button
  • .ai/screenshots-1433/verify/54-runtime-04-build-triggered.png — immediately after clicking Build and Run
  • .ai/screenshots-1433/verify/55-runtime-05-wait-5s.pngAFTER (t=5s): Stop button (codicon-debug-stop) now visible in toolbar; Playwright selector .action-label.codicon-debug-stop returned visible: true

Runtime test output (key lines)

[BEFORE] Play button visible: true
[BEFORE] Stop button visible: false (expected: false)
[action] Clicked play button directly
[t=5s] Play visible: true, Stop visible: true
✅ FIX VERIFIED: Stop button appeared after Build and Run triggered

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.

Start/Stop buttons disappear from activity bar after running the project

1 participant