Skip to content

Add PersistentShell fallback to avoid getting stuck at PersistentShell#1170

Merged
GT-610 merged 2 commits into
mainfrom
fix-persistent-shell-fallback
May 12, 2026
Merged

Add PersistentShell fallback to avoid getting stuck at PersistentShell#1170
GT-610 merged 2 commits into
mainfrom
fix-persistent-shell-fallback

Conversation

@GT-610
Copy link
Copy Markdown
Collaborator

@GT-610 GT-610 commented May 12, 2026

Resolve #1142.

Summary by CodeRabbit

  • Bug Fixes
    • More reliable server status checks: uses a persistent connection by default and automatically falls back to a direct SSH path on timeouts.
    • Improved timeout handling and recovery to prevent stale connections and ensure retries complete.
    • Better Windows handling for status retrieval and clearer warnings when no SSH client is available.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a93d99ae-a286-4f63-9e59-4638dea406d9

📥 Commits

Reviewing files that changed from the base of the PR and between 2ac9ba4 and 4678daa.

📒 Files selected for processing (1)
  • lib/data/provider/server/single.dart
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/data/provider/server/single.dart

📝 Walkthrough

Walkthrough

This change refactors server status command execution in ServerNotifier to use persistent shell with fallback. A new private flag controls whether persistent-shell execution is attempted; it defaults to true and resets when the SSH client instance changes. Two helper methods (_runStatusCommand and _runStatusCommandWithExec) implement the strategy: persistent shell is attempted first but on timeout the flag is disabled, the shell is disposed, and the command is retried via exec. _getData now delegates status execution to _runStatusCommand. Windows status commands are forced through the exec path.

Possibly related PRs

Suggested reviewers

  • lollipopkit
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: implementing a PersistentShell fallback mechanism to prevent the connection flow from getting stuck on PersistentShell timeouts.
Linked Issues check ✅ Passed The code changes implement a fallback mechanism from PersistentShell to direct SSH exec when timeouts occur, directly addressing the issue #1142 requirement to restore server-page connectivity without requiring server_box_monitor.
Out of Scope Changes check ✅ Passed All changes are scoped to implementing the PersistentShell fallback mechanism in ServerNotifier; no extraneous modifications detected.
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
  • Commit unit tests in branch fix-persistent-shell-fallback

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
lib/data/provider/server/single.dart (1)

529-532: 💤 Low value

Misleading log message when client is null.

The message "No status result from ${spi.name}" implies a failed status fetch, but at this point no attempt was made—the client is simply unavailable.

Suggested improvement
    if (client == null) {
-     Loggers.app.warning('No status result from ${spi.name}');
+     Loggers.app.warning('SSH client not available for ${spi.name}');
      return '';
    }
🤖 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 `@lib/data/provider/server/single.dart` around lines 529 - 532, The warning
message is misleading because no status fetch was attempted when client == null;
update the Loggers.app.warning call (the null-check handling for variable client
in this function) to clearly state that the client is unavailable (e.g., "No
client available for ${spi.name}" or "Client for ${spi.name} is null, skipping
status fetch") while preserving the existing return '' behavior; change only the
log text invoked via Loggers.app.warning and keep the client null-check and
return as-is.
🤖 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 `@lib/data/provider/server/single.dart`:
- Around line 529-532: The warning message is misleading because no status fetch
was attempted when client == null; update the Loggers.app.warning call (the
null-check handling for variable client in this function) to clearly state that
the client is unavailable (e.g., "No client available for ${spi.name}" or
"Client for ${spi.name} is null, skipping status fetch") while preserving the
existing return '' behavior; change only the log text invoked via
Loggers.app.warning and keep the client null-check and return as-is.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 06432391-0208-4c74-b5a4-8ac5c5395afa

📥 Commits

Reviewing files that changed from the base of the PR and between 6d4873d and 2ac9ba4.

📒 Files selected for processing (1)
  • lib/data/provider/server/single.dart

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 12, 2026
@GT-610 GT-610 merged commit adfa25d into main May 12, 2026
3 checks passed
@GT-610 GT-610 deleted the fix-persistent-shell-fallback branch May 12, 2026 01:47
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.

现在是否必须安装server_box_monitor才能链接服务器

1 participant