fix(pty): keep the controlled prompt so persistent bash settles fast

tool-bash-persistent overwrote the backend's PS1, so terminal-bash prompt
readiness never matched and every send degraded to the 3.5s silence tier
(idleSilenceMs + handoffGraceMs) under production defaults.

The controlled PROMPT_COMMAND now re-asserts PS1 before every prompt, so an
in-shell override never survives to the next prompt. The tool initializes
with stty -echo alone and detects the no-end-marker fallback through the
seam's stdin_read wait reason instead of matching its own prompt text.

Tool calls drop from 7180/3560/3566 ms to 355/88/91 ms (spawn+init+echo,
echo, pwd; darwin, production defaults). The loader composition suite now
pins the fast path by pushing idleSilenceMs beyond the send bound, and a
real-PTY case proves PS1 self-healing.

Fixes #2585
This commit is contained in:
Yichen Jiang
2026-08-15 11:06:57 +08:00
parent 5bb600f9fb
commit a8dc6f9776
18 changed files with 145 additions and 40 deletions

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/config-catalog.md
config-catalog.md: 82f6d26c79d32c6952f3bc11c96fa1c2ddceecdc
config-catalog.zh.md: 958d3115447db37de248bbf30b0744308ff8dbb8
config-catalog.md: 4f22ed3da7de81f94d6fc5ee55a305d117c126e7
config-catalog.zh.md: 7054ec8b52a8c46bc1ace97112f086119a61cfec

View File

@@ -2370,7 +2370,7 @@ export interface Config {
}
```
Source: [`packages/shell/tool-bash-persistent/src/index.ts:405`](../packages/shell/tool-bash-persistent/src/index.ts)
Source: [`packages/shell/tool-bash-persistent/src/index.ts:400`](../packages/shell/tool-bash-persistent/src/index.ts)
<a id="deepseek-aidsh-tool-fs"></a>

View File

@@ -2372,7 +2372,7 @@ export interface Config {
}
```
来源:[`packages/shell/tool-bash-persistent/src/index.ts:405`](../packages/shell/tool-bash-persistent/src/index.ts)
来源:[`packages/shell/tool-bash-persistent/src/index.ts:400`](../packages/shell/tool-bash-persistent/src/index.ts)
<a id="deepseek-aidsh-tool-fs"></a>