Skip to content

fix(ui): default the per-client setup foldout to expanded so Unregister is visible#1152

Merged
Scriptwonder merged 5 commits into
CoplayDev:betafrom
Scriptwonder:fix/restore-per-client-setup-visibility
May 24, 2026
Merged

fix(ui): default the per-client setup foldout to expanded so Unregister is visible#1152
Scriptwonder merged 5 commits into
CoplayDev:betafrom
Scriptwonder:fix/restore-per-client-setup-visibility

Conversation

@Scriptwonder

@Scriptwonder Scriptwonder commented May 24, 2026

Copy link
Copy Markdown
Collaborator

Community reports:

"Not a very good idea that the Unregister button was removed in 9.7.0. It did a wrong registration with stdio transport, and now it is difficult to re-register. :/ something is stuck on stdio, which is unstable, and I can't switch to local."

"stdio may be simpler for us beginners but somehow it is unstable in my case. Constantly disconnects from Claude Desktop."

The Unregister button wasn't actually removed — the 9.7.0 UI reshuffle put the single-client Configure button (which toggles to "Unregister" for CLI-based clients like Claude Code) inside a "Per-client setup" foldout that defaulted to collapsed. With "Configure All Detected Clients" sitting prominently green above it, the foldout reads more like a section divider than the entry point to manual per-client management. Users who need to wipe a bad stdio registration and re-add with HTTP couldn't find it.

Flip the default to expanded in both the UXML markup and the EditorPrefs fallback. State still persists per-user via EditorPrefKeys.ClientDetailsFoldoutOpen, so anyone who explicitly collapses it keeps that preference — only the never-touched default changes, which is exactly the cohort the community report is from.

Summary by CodeRabbit

  • Improvements

    • Per-client configuration details now open by default for easier access.
    • Bulk "Configure All" clears stale per-client status so displayed statuses refresh from disk immediately.
  • New Features

    • Configure action now toggles between "Configure" and "Unregister" based on current client status.
    • "Unregister" removes client entries from JSON configs and resets client status.

Review Change Stack

Community report: "the Unregister button was removed in 9.7.0 — it did a
wrong registration with stdio transport and now it's difficult to
re-register; something is stuck on stdio and I can't switch to local."

The button wasn't actually removed — the 9.7.0 UI shuffle put the
single-client Configure (which toggles to Unregister for CLI-based
clients like Claude Code) inside a "Per-client setup" foldout that
defaulted to collapsed. With Configure All sitting prominently above it,
the foldout looked like terminal styling rather than the entry point to
manual per-client management, so users who needed to wipe a bad stdio
registration and re-add with HTTP couldn't find the button.

Flip the default to expanded in both UXML and the EditorPrefs fallback.
The state still persists per-user, so anyone who explicitly collapses it
keeps that preference — only the never-touched default changes.
Copilot AI review requested due to automatic review settings May 24, 2026 03:01
@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5a10e442-4a00-4188-91be-5a73922cb57f

📥 Commits

Reviewing files that changed from the base of the PR and between b909d43 and ad510eb.

📒 Files selected for processing (1)
  • MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs

📝 Walkthrough

Walkthrough

Per-client details foldout now defaults expanded. Interface and base configurator add Unregister; JsonFileMcpConfigurator shows Configure/Unregister label and removes unityMCP from JSON when unregistering. Configure button toggles per-client unregister/configure, and bulk configure clears cached statuses.

Changes

Client Details Foldout & JSON Configurator

Layer / File(s) Summary
Foldout default state UI and initialization
MCPForUnity/Editor/Windows/Components/ClientConfig/McpClientConfigSection.uxml, MCPForUnity/Editor/Windows/Components/ClientConfig/McpClientConfigSection.cs
The foldout element now defaults to value="true", and the C# initialization reads EditorPrefs.GetBool(..., true) so per-client details are expanded by default when no preference exists.
IMcpClientConfigurator and base Unregister hook
MCPForUnity/Editor/Clients/IMcpClientConfigurator.cs, MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs
IMcpClientConfigurator adds Unregister() with XML docs; base class adds a virtual no-op Unregister() and clarifies Configure() idempotency in comments.
JSON configurator: Configure / Unregister implementation
MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs
JsonFileMcpConfigurator returns "Unregister" when client is Configured; Unregister() removes unityMCP from VS Code-style or standard JSON layouts, writes only if changed, and resets client status/transport; failures throw InvalidOperationException.
Configure actions and cache invalidation
MCPForUnity/Editor/Windows/Components/ClientConfig/McpClientConfigSection.cs, MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs
OnConfigureClicked toggles per-client action: Configured -> Unregister(), else -> configure; OnConfigureAllClientsClicked clears lastStatusChecks after bulk configure to avoid stale cached statuses; Claude CLI configurator unregistration is exposed via public override.
Sequence diagram (high-level) ```mermaid
sequenceDiagram
participant UI as McpClientConfigSection
participant Config as Configurator
participant File as ClientConfigFile
participant Service as MCPServiceLocator.Client
participant Cache as lastStatusChecks
UI->>Config: OnConfigureClicked -> Configure() or Unregister()
Config->>File: Read/Modify JSON
UI->>Service: OnConfigureAllClientsClicked -> ConfigureAllClients
Service->>Cache: Clear lastStatusChecks

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs:
- [CoplayDev/unity-mcp#412](https://github.com/CoplayDev/unity-mcp/pull/412): Also touched cached per-client status refresh and lastStatusChecks handling.

> "I nudged a foldout, pruned config's vine,  
> Unregister button now sings in line,  
> JSON leaves fall, the file stays neat,  
> Expanded by default — a tidy retreat,  
> Hopping off happy with a tiny carrot treat!" 🐇✨

</details>

<!-- walkthrough_end -->
<!-- pre_merge_checks_walkthrough_start -->

<details>
<summary>🚥 Pre-merge checks | ✅ 3 | ❌ 2</summary>

### ❌ Failed checks (2 warnings)

|     Check name     | Status     | Explanation                                                                                                                                                                                          | Resolution                                                                                                                                                                                                                       |
| :----------------: | :--------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|  Description check | ⚠️ Warning | The description provides context, motivation, and implementation details, but does not follow the provided template structure with required sections like Type of Change, Changes Made, and Testing. | Restructure the description to match the template: add Type of Change (Bug fix), itemize Changes Made (foldout default, Unregister logic), and note any testing performed. Retain the community context as supporting rationale. |
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 31.58% which is insufficient. The required threshold is 80.00%.                                                                                                                | Write docstrings for the functions missing them to satisfy the coverage threshold.                                                                                                                                               |

<details>
<summary>✅ Passed checks (3 passed)</summary>

|         Check name         | Status   | Explanation                                                                                                                                           |
| :------------------------: | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- |
|         Title check        | ✅ Passed | The title clearly summarizes the main change: making the per-client setup foldout expanded by default to improve visibility of the Unregister option. |
|     Linked Issues check    | ✅ Passed | Check skipped because no linked issues were found for this pull request.                                                                              |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request.                                                                              |

</details>

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

</details>

<!-- pre_merge_checks_walkthrough_end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches</summary>

<details>
<summary>🧪 Generate unit tests (beta)</summary>

- [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} -->   Create PR with unit tests

</details>

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=CoplayDev/unity-mcp&utm_content=1152)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>


<sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub>

<!-- tips_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKPR1AGxJcAZvAAeABTY8ACUXEo+aNgeuJC4sCQ8lGAMHvDs9iS42NyQPvgetPh48fiQJP7cmEr0iOUAqhgUJERINHyoEkjwAl6QkAYAco4ClFwAjBMArABMkIAoBJCwuLjciBwA9JttCdgCGkzMmwDC+NweaLIAIiQSm9gY6rJgzAzcm9wxHptTcwMGBqIcaQADKDAo8G4uAA7vgMEo+EtQSUKAxvPkApsWogCC0wNwUmkMhhcGBgTluGBuohevB0rh5IAkwhgzlInEgY1waABoO5OQ2/EJWCWJxa1Do6A5swADLMAGxgGXTMCzAAs0BlAGYODKJhwpgAtIy3RAQqHieGQQJRMTIeEeWThAxQM6sR7PSAtbj4Ci4ZDwBHwBgS+jYYEUZBMGL0DD4OJ+BHxRKQJotNq4yicvAELBoHwdSAATg0AHYNDKANz2FhJSqEyFkdH0QNMCgtMT2XC0eDldPtKiWjDIGqQHs+PwMGKMr0kMD9zOQjBEfh8RAw9QMBDLsqQAAS0GgVg0LpgKbOGD8RGwLU2ada7SzTFJFEK+V99kDRH6xPYyBhaDIBcaDNigw7wEo6CQAARFYRLpJkFK5NB75FCUcQJNQY4kFE06SgQCgeJc6x0NWCRJLwLCBpk0EX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haKtFpJ7RBlQIB4mwArg/A/gZok3gBj2ckxdUR0UbHixGQ0s7cQETeTaAMAdOSYRUUkEwBXRXRO4BsKhjeadoBhkNVOtzzDzId+RcQHOPuXXw6sVwRWNOE2wJGH8sYSgCEc4B2Q0ioBcIj+qEIZFjiYIqI1OAsjqEkjuh19CkdsPxGjDrBxI6YaSMcGKCVwAA5QKQFnGH86RH/RkesKqCbDWR2Ik8akSYCACDKqAFphoEH4ABSHosGApRe5hw2ACcMGHrRdoDRIQAQjXEfJTRXoq1GUBWBlA/j3RoIz0cim2HYj/BTeCck4KUHVs4stglrkgDa67JEgiMb2vj2XKx4GCLcZMOSimioTYRE40kZCJnHLjoIq49ERuKPFbjaBp43iHuKwFjC5xh4rETBFZItDc47QuqBMKvERC9WKwu8XOOZFbDI43QoofYBiwfRiyogaIGLEKTNCLIMk/8HtHfCPBNGH4BIKgC+AsQWgEKWykxPUEsSpxUI5cPJM4kis1xGI3idiKMmtCTJjEKSMDD9z8Y3BBIkSYfzEmkiZopQNJOCHOA4wTsVIjIRxJvGNDQRqkp8TBE0mIBtJb+aTvpKSCGTAwUkkiR0OfxmSCgFkgiQ/Cex2SSADk3EE5LnEuTsRbE6ERxK4lpwfJ4kziVEh8AJTCQeYxAEFIeyIBQpqgh/oz16GARcAtgckSGJ9HYiJgPgAQFqDQAu8KGaoaYFG1mBoB8wYfZWv3zQCdNTpDAbkoQyjanT0m8tf5rtyLCm0G+JAdUHn1boCBSwJDb1rNNxC2A5h3QuWrQC8prViUw/Qjh6ybpoBZaRYHvuk1WpoBVqWoAQC9zloy12+I7NANk2lrTBlqtATuotUH4UcfAnvVaoCzQD8Z3B4/FfjtDX6UBN+dQ5Xkvyr6FV/aU1aoOVB34ShOZfoPfvTzmlWAiptARiLgAGEDYz+VVdQGcBFTjUZQlM6vi/DZlFTOZNARfkmH0BAA=== -->

<!-- internal state end -->

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 adjusts the Unity Editor “Client Configuration” UI so the “Per-client setup” foldout defaults to expanded, making the per-client Configure/Unregister action immediately visible (addressing confusion introduced by the 9.7.0 UI reshuffle while still respecting persisted user preference via EditorPrefs).

Changes:

  • Default “Per-client setup” foldout to expanded in the UXML (value="true").
  • Change the EditorPrefs fallback default for EditorPrefKeys.ClientDetailsFoldoutOpen from false to true so first-time users see the expanded state.
  • Update inline comment to document the rationale and user impact.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
MCPForUnity/Editor/Windows/Components/ClientConfig/McpClientConfigSection.uxml Sets the foldout’s markup default to expanded so the per-client controls are visible by default.
MCPForUnity/Editor/Windows/Components/ClientConfig/McpClientConfigSection.cs Changes the persisted-state fallback default to expanded and documents why; still preserves per-user preference when explicitly toggled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

… toggle)

The 9.7.0 community complaint about "Unregister was removed" was actually
two stacked issues: the foldout default hid the existing toggle (fixed
in the previous commit), and the toggle never existed for JSON-based
clients in the first place. Only ClaudeCliMcpConfigurator overrode
GetConfigureActionLabel and routed Configure() through register/unregister
based on status; every JsonFileMcpConfigurator-derived client (Antigravity,
Antigravity IDE, Claude Desktop, Cursor, Windsurf, Kiro, Trae, VS Code,
the various Copilot configs, etc.) always showed "Configure" and
re-wrote the file on every click — there was no way to actually clean a
bad entry out of the JSON without manually editing the file.

Move the toggle logic into JsonFileMcpConfigurator so every JSON client
inherits it:

- GetConfigureActionLabel() flips to "Unregister" when status == Configured.
- Configure() routes to a new UnregisterFromConfig() helper in that case,
  which parses the file and removes the unityMCP entry from mcpServers
  (standard layout) or servers / mcp.servers (VS Code layout). The file
  itself is preserved so the user's other MCP servers stay intact, and
  the cleanup re-uses the same JsonConvert / Newtonsoft path the existing
  CheckStatus / ConfigJsonBuilder code already uses.
- Status flips to NotConfigured after a successful Unregister; the next
  CheckStatus reads the file, sees mcpServers no longer contains
  unityMCP, and reports MissingConfig — so the startup auto-rewrite does
  not silently undo the user's Unregister.

Codex (TOML) clients still don't get the toggle in this commit — the
TOML helpers don't have a remove path and adding one would risk breaking
the file shape. Codex is a small enough surface that hand-editing is
acceptable; a proper Codex remove can be a follow-up.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs (1)

410-413: ⚡ Quick win

Preserve the original exception as InnerException when rethrowing.

Line 412 currently drops stack/context from the original failure. Chain the exception to keep actionable diagnostics.

Proposed fix
-            catch (Exception ex)
-            {
-                throw new InvalidOperationException($"Failed to unregister: {ex.Message}");
-            }
+            catch (Exception ex)
+            {
+                throw new InvalidOperationException($"Failed to unregister: {ex.Message}", ex);
+            }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs` around lines 410 -
413, In the catch block inside McpClientConfiguratorBase (the catch(Exception
ex) that currently throws new InvalidOperationException($"Failed to unregister:
{ex.Message}")), preserve the original exception by passing ex as the
InnerException when rethrowing; replace the current throw with creating an
InvalidOperationException that includes a clear message (e.g. "Failed to
unregister.") and the caught exception as the innerException so the original
stack/context is retained.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs`:
- Around line 410-413: In the catch block inside McpClientConfiguratorBase (the
catch(Exception ex) that currently throws new InvalidOperationException($"Failed
to unregister: {ex.Message}")), preserve the original exception by passing ex as
the InnerException when rethrowing; replace the current throw with creating an
InvalidOperationException that includes a clear message (e.g. "Failed to
unregister.") and the caught exception as the innerException so the original
stack/context is retained.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 43bd6000-4a62-4247-85a5-1263a2991262

📥 Commits

Reviewing files that changed from the base of the PR and between f932764 and 0d04edf.

📒 Files selected for processing (1)
  • MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs

…r via UI

User-reported regression from the previous commit on this PR:
"Configure All Detected Clients does not actually configure all IDEs;
after I click Configure each individual IDE still shows missing
configs, and if one is configured Configure All resets it."

Root cause was the toggle I'd put inside JsonFileMcpConfigurator.Configure():
when ConfigureAllDetectedClients walked the registry and called
configurator.Configure() on each one, any client whose status was
already Configured took the Unregister branch — so the bulk action
wiped every already-configured JSON client instead of refreshing it.
(The same trap existed for ClaudeCli even before this PR, but Claude
Code's CLI registration path is rarely hit through the bulk button so
nobody had reported it.)

Fix: move the Configure↔Unregister toggle out of the configurator and
into the UI handler. The configurator API now has two clearly-split
operations:

- IMcpClientConfigurator.Configure(): always idempotent-write. Safe to
  call repeatedly. This is what ConfigureAllDetectedClients calls and
  what makes the "refresh transport / server version drift" use case
  work without resetting anything.

- IMcpClientConfigurator.Unregister(): removes UnityMCP from this
  client's config. McpClientConfiguratorBase ships a no-op default;
  JsonFileMcpConfigurator overrides with the JObject-parse + remove
  path that used to be the private UnregisterFromConfig helper.
  Codex's TOML still has no remove path so it inherits the no-op,
  matching the previous commit's stance.

UI per-client click (OnConfigureClicked) now reads client.Status and
routes: Configured → client.Unregister(); else →
MCPServiceLocator.Client.ConfigureClient(client). The button label
toggle from GetConfigureActionLabel is preserved — it's purely
informational and stays consistent with the routed action.

Secondary fix in OnConfigureAllClientsClicked: clear the
lastStatusChecks cache after the bulk run so dropdown-switching to
any non-currently-selected client immediately reads its post-bulk
status from disk instead of waiting out the 45-second throttle. This
was the "after clicking Configure All each individual IDE still shows
missing configs" symptom even when the writes had actually succeeded.

ClaudeCli's existing internal toggle is preserved (its async path in
ConfigureClaudeCliAsync handles the Configuring…/Unregistering… UX
itself, and OnConfigureClicked still early-routes to that helper).

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs`:
- Around line 49-51: McpClientConfiguratorBase defines a public virtual
Unregister(), but ClaudeCliMcpConfigurator currently defines a private
Unregister() which hides rather than overrides it; change
ClaudeCliMcpConfigurator.Unregister to match the base signature (public override
void Unregister()) so calls dispatched via the base type/interface invoke
Claude’s implementation, and remove the private/hiding method to avoid
duplication.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 049958b2-f648-42d3-8bc3-1df94f4510b7

📥 Commits

Reviewing files that changed from the base of the PR and between 0d04edf and b909d43.

📒 Files selected for processing (3)
  • MCPForUnity/Editor/Clients/IMcpClientConfigurator.cs
  • MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs
  • MCPForUnity/Editor/Windows/Components/ClientConfig/McpClientConfigSection.cs

Comment thread MCPForUnity/Editor/Clients/McpClientConfiguratorBase.cs
Two review items from CodeRabbit on PR CoplayDev#1152:

1) ClaudeCliMcpConfigurator.Unregister was declared `private` while
   the base class defines `public virtual void Unregister()`. Per C#
   rules that hides the base rather than overriding it — so a
   polymorphic IMcpClientConfigurator.Unregister() call on a ClaudeCli
   instance would land on the base's no-op default and the existing
   `claude mcp remove --scope ...` logic would be unreachable through
   the interface. Promote it to `public override` so the interface
   contract resolves correctly; the body is unchanged.

2) JsonFileMcpConfigurator.Unregister rethrew with only the message
   string, dropping the original stack/context. Pass `ex` through as
   InnerException so diagnostics are preserved.
@Scriptwonder Scriptwonder merged commit 493b11d into CoplayDev:beta May 24, 2026
3 checks passed
@Scriptwonder Scriptwonder deleted the fix/restore-per-client-setup-visibility branch May 24, 2026 04:44
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