--reconnection-grace-time does not survive closing the browser tab
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 55/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
研究方向
首先追蹤 BrowserLifecycleService 對 pagehide/beforeunload 的處理,以及 ManagementConnection 的 graceful dispose 清理。接著檢查 RemoteExtensionHostAgentServer 的連線縮短路徑;當設定的 grace period 能在分頁關閉和第二次連線後繼續生效,同時使用預設設定的安裝保留原有行為時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Problem
--reconnection-grace-time (added in #7678) is documented as "Override the reconnection grace time in seconds. Clients who disconnect for longer than this duration will need to reload the window."
In practice the setting cannot deliver that, for two independent reasons.
1. Closing the tab bypasses the grace time entirely.
BrowserLifecycleService listens on pagehide/beforeunload and runs the workbench shutdown, which disposes the remote connection gracefully. On the server, ManagementConnection treats a graceful dispose as a finished client:
Event.once(this.protocol.onDidDispose)(() => {
this._log(`The client has disconnected gracefully, so the connection will be disposed.`);
this._cleanResources();
});
_cleanResources() runs immediately — the grace time is never consulted. So closing the tab kills the session regardless of the configured value.
2. A second connection cuts the grace time to 5 minutes.
RemoteExtensionHostAgentServer shortens every disconnected connection on each new connection:
for (const key in this._managementConnections) {
this._managementConnections[key].shortenReconnectionGraceTimeIfNecessary();
}
which schedules ProtocolConstants.ReconnectionShortGraceTime (5 min). Opening a second tab is enough to cut a deliberately long grace time back down.
Impact
The use case the flag exists for — leave a long-running task (a build, a CLI, an agent session) running and come back to it later — does not work. The session is gone as soon as the browser is closed.
Expected
When an operator raises --reconnection-grace-time above the default, a disconnected session should survive for the configured duration, including across a closed browser. Installations that never set the flag should keep Code's stock behaviour.
Environment
Reproduced on code-server 4.128.0 and confirmed present in main (4.133.0 / Code 1.133.0).
- 主要語言
- TypeScript
- 星號
- 79.4k
- 分支
- 6.9k
- 平均合併
- 2 天 13 小時
- 30 天內合併 PR
- 39
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
coder/code-server 的其他 Issue
-
security
難度 2/5 1-3 小時 新手友好度 74/100
coder/code-server#8013 · 3 則留言 ·
-
enhancement
難度 5/5 一週以上 新手友好度 35/100
coder/code-server#7976 · 2 則留言 ·
-
enhancement
難度 5/5 一週以上 新手友好度 35/100
coder/code-server#7962 · 3 則留言 ·
-
enhancement
難度 5/5 一週以上 新手友好度 42/100
coder/code-server#7948 · 1 則留言 · 2 個 reaction ·
-
bug code-server needs-investigation
難度 4/5 3-5 天 新手友好度 48/100
coder/code-server#7938 · 3 則留言 · 2 個 reaction ·
查看 coder/code-server 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
-
area:tools bug good first issue help wanted priority:P2
難度 2/5 1-3 小時 新手友好度 90/100
TaewoooPark/Motifcode#14 ·
-
bug
難度 2/5 1-3 小時 新手友好度 84/100
newrelic-experimental/preflight#793 · 1 則留言 ·
-
bug 🐞
難度 2/5 1-3 小時 新手友好度 68/100
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
BasedHardware/omi#15320 ·