--reconnection-grace-time does not survive closing the browser tab
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
Research direction
Trace BrowserLifecycleService's pagehide/beforeunload handling and ManagementConnection's graceful-dispose cleanup first. Then inspect RemoteExtensionHostAgentServer's connection-shortening path; done means a configured grace period survives tab closure and a second connection, while installations using the default retain stock behavior.
Written by the indexing model from the issue text.
Description
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).
- Dominant language
- TypeScript
- Stars
- 79.4k
- Forks
- 6.9k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 39
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coder/code-server
-
security
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
coder/code-server#8013 · 4 comments ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
coder/code-server#7976 · 2 comments ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
coder/code-server#7962 · 3 comments ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 42/100
coder/code-server#7948 · 1 comment · 2 reactions ·
-
bug code-server needs-investigation
Difficulty 4/5 3-5 days Newbie friendliness 48/100
coder/code-server#7938 · 3 comments · 2 reactions ·
All issues in coder/code-server
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
danielmiessler/LifeOS#2218 ·