Skip to content

Studio: fix external-server disconnects and show the server port - #16595

Merged
Lyxot merged 10 commits into
unslothai:mainfrom
oobabooga:studio-desktop-attached-server-disconnect
Nov 4, 2026
Merged

Lyxot merged 10 commits into
unslothai:mainfrom
oobabooga:studio-desktop-attached-server-disconnect

Conversation

@oobabooga

@oobabooga oobabooga commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Reported in #16561.

When the desktop app connects to an existing external server, the tray's Stop Server action incorrectly shows "Server stopped" without stopping the server or its health poll. Starting again or reopening the app reconnects to the same server, leaving updates blocked.

The tray listener captures the first render's isExternalServer=false, so it never takes the disconnect path. This change reads the attached server's port through a ref and cancels the health poll when disconnecting.

The tray now offers Disconnect from Server for external servers. The update banner and Settings row show the port and explain where to stop the server. The disconnected screen makes clear that disconnecting did not stop the server, and preserves the port across webview reloads. All 24 locale overlays include the updated messages.

Updates remain blocked while an external server runs. The reporter's server launch source is still unknown; this fixes the disconnect behavior and guidance without changing server ownership.

Verification

  • Regression tests cover disconnecting through the tray, stopping an owned server, and restoring the disconnected port after reload.
  • Rust tray tests, type checks, and strict locale checks pass. ESLint and Biome report no new findings in changed files.
  • Full frontend suite: 14,744 passed and 9 failed, attributed to local Node, dependency-layout, and time-zone issues. The time-zone failure also occurs on main.
  • Both stopped-screen variants were rendered through Vite SSR. No native desktop app was tested.

Screenshots

Before and after with mocked Tauri IPC. The native tray menu is not shown.

Update banner while attached:

Update banner while attached, before and after

After using the tray action while attached:

Screen after the tray action while attached, before and after

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T07:08:07.168953Z 671c7f8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-03T20:47:57.925229Z
We couldn’t complete this review. Comment @codex review to try again.
05cc126 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 05cc126856

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Lyxot Lyxot self-assigned this Nov 4, 2026
NilayYadav and others added 4 commits November 4, 2026 14:45
… server

Stop now shuts down an attached same-install server, so the tray no longer needs a Disconnect label, the stopped screen no longer needs to explain a disconnect, and the stop intent no longer carries a port. The update message keeps the port but no longer says the app cannot stop the server. The tray-stop test runs the real runStopServer for both a stop that succeeds and one the server refuses.
@Lyxot

Lyxot commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Pushed a combined fix for #16561 to this branch, keeping both contributions:

  • Cherry-picked @NilayYadav's two commits from Studio: let the desktop app stop a server it attached to #16581 (authorship kept): the tray's Stop now actually shuts down an attached same-install server through the authenticated exact-port /api/shutdown and waits for the port to close; if the server refuses, the app stays attached and a toast says why. This is what unblocks the update, since the app can now get out of attached mode.
  • Kept this PR's stale-closure diagnosis and the port in the update banner and Settings.
  • Dropped the disconnect-only path, which a real stop makes unreachable: the "Disconnect from Server" tray label, the "Disconnected from the server" stopped screen and its strings, and the port in the stop marker. Removed the now-incorrect "The app cannot stop or update it" sentence from all locales.
  • Replaced the tray-stop test with one that runs the real runStopServer for a stop that succeeds and one the server refuses.
  • Merged main for Tray status test: end the listener slice at its own close #16600, which the tray status test needs once the tray handler catches stop failures.

Validation: desktop stop-intent, forced-repair, managed-environment-wait and tray-status tests (34 pass), test typecheck, strict i18n parity, and Rust tray and attached-stop tests. The native app was not run against a live terminal server.

@Lyxot

Lyxot commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c81b020b1e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread studio/src-tauri/src/process.rs Resolved
…failed

The backend answers /api/shutdown at once, then lets an active training run save (120 s default budget) before it closes the port, so a 5 s wait reported an accepted shutdown as a failure.
@Lyxot

Lyxot commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 671c7f8838

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Lyxot

Lyxot commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Review loop finished on 671c7f8838b.

Changed during this round:

  • 671c7f8838b: Codex found that an accepted shutdown of an attached server was reported as failed after 5 s while a training run was still saving. The backend answers /api/shutdown at once and closes the port only after the save (120 s default budget). The attached stop now waits up to 130 s once the shutdown is accepted; a refused shutdown still fails at once. The adopted-backend stop on main has the same 5 s wait and is left for a follow-up to keep this PR scoped.

@Lyxot Lyxot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Stop now shuts down an attached same-install server and the port shows in the banner and Settings. Codex is clean on 671c7f8 and the staging CI run passed.

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.

3 participants