Compare commits

..
Author SHA1 Message Date
陈大猫 36fbc8b85b fix(plugins): cancel stuck SSH exec dials before the plugin RPC deadline
Plugin vault.execHostCommand could hit "Plugin request deadline exceeded"
when a pooled SSH reconnect used the interactive 20s/120s handshake
timeouts, and retries hitchhiked on the leftover pendingDial.

- Stop and drop a pending plugin dial when its last waiter cancels
- Pass tighter startPortForward connect/auth budgets (8s/8s) under an
  18s prepare+dial envelope, and map failures to "SSH connection timed out"
- Evict half-open or channel-open/RPC-deadline-failed pooled connections
2026-12-02 01:49:26 +08:00
2 changed files with 6 additions and 42 deletions

No files matched your search

+6 -11
View File
@@ -174,7 +174,7 @@ function isDefaultCmdPromptLine(line) {
}
function stripLeadingDecorativeToken(line) {
// Optional short decorative tokens, stripped only for recognition (#4354).
// Optional short decorative token, stripped only for recognition (#4354).
return line.replace(/^\s*[^\s\w\p{L}\p{N}@:#$\\\/>\[\]().]{1,4}\s+/u, "");
}
@@ -183,11 +183,9 @@ function isDefaultPosixPromptLine(line) {
// Optional virtualenv / conda / BT-panel style env name prefix: "(name) "
// before the shell prompt. Recognition only; callers still return the full
// prompt line so suffix matching sees the visible prefix (#3947).
let prompt = normalized.replace(/^\([^()\n\r]+\)\s+/, "");
// Check each candidate before stripping again: a glyph such as the
// robbyrussell arrow may be part of the prompt itself (#4354).
while (true) {
if (
const withoutEnvPrefix = normalized.replace(/^\([^()\n\r]+\)\s+/, "");
return [withoutEnvPrefix, stripLeadingDecorativeToken(withoutEnvPrefix)].some(
(prompt) => (
POSIX_PROMPT_PATTERN.test(prompt) ||
BRACKET_TIME_POSIX_PROMPT_PATTERN.test(prompt) ||
BRACKET_PATH_POSIX_PROMPT_PATTERN.test(prompt) ||
@@ -198,11 +196,8 @@ function isDefaultPosixPromptLine(line) {
POWERLEVEL10K_PROMPT_PATTERN.test(prompt) ||
POWERLINE_PROMPT_PATTERN.test(prompt) ||
OH_MY_ZSH_ROBBYRUSSELL_PROMPT_PATTERN.test(prompt)
) return true;
const stripped = stripLeadingDecorativeToken(prompt);
if (stripped === prompt) return false;
prompt = stripped;
}
),
);
}
function extractTrailingIdlePrompt(output) {
-31
View File
@@ -518,41 +518,10 @@ test("isDefaultPosixPromptLine matches short decorative prefixes and keeps the f
}
});
test("stacked decorative prefixes preserve the full extracted and tracked prompt", () => {
for (const prompt of [
...["\u2718", "\u2714", "\u2717", "\u2713"].flatMap(status => [
`${status} \u26A1 root@testhost:~# `,
`${status} \u26A1 root@testhost:~#`,
`${status} \u26A1 root@testhost \uE0B0 ~ \uE0B0 `,
`(venv) ${status} \u26A1 user@host:~# `,
`${status} \u279C netcatty`,
`${status} \u279C netcatty `,
`${status} \u279C ~ git:(main) \u2717`,
`(venv) ${status} \u279C netcatty git:(main) \u2713 `,
]),
"\u2718 \u2714 \u26A1 root@testhost:~# ",
"\u2718 \u2714 \u279C netcatty ",
]) {
assert.equal(isDefaultPosixPromptLine(prompt), true, prompt);
assert.equal(extractTrailingIdlePrompt(`welcome\r\n${prompt}`), prompt, prompt);
const session = {};
trackSessionIdlePrompt(session, `welcome\r\n${prompt}`);
assert.equal(session.lastIdlePrompt, prompt, prompt);
assert.equal(getFreshIdlePrompt(session), prompt, prompt);
}
});
test("decorative prefix recognition rejects pending input and non-decorative prefixes", () => {
for (const line of [
"\u26A1 root@testhost:~# echo hi",
" \u26A1 root@testhost \uE0B0 ~ \uE0B0 ls",
"\u2718 \u26A1 root@testhost:~# echo hi",
"\u2718 \u26A1 root@testhost \uE0B0 ~ \uE0B0 ls",
...["\u2718", "\u2714", "\u2717", "\u2713"].flatMap(status => [
`${status} \u279C netcatty ls`,
`(venv) ${status} \u279C netcatty git:(main) \u2713 ls`,
]),
"\u2718 \u2714 \u279C netcatty ls",
"OK root@testhost:~# ",
"yes root@testhost:~# ",
"git:(main) root@testhost:~# ",