Title: --reconnection-grace-time does not survive closing the browser tab · Issue #7955 · coder/code-server · GitHub
Open Graph Title: --reconnection-grace-time does not survive closing the browser tab · Issue #7955 · coder/code-server
X Title: --reconnection-grace-time does not survive closing the browser tab · Issue #7955 · coder/code-server
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 de...
Open Graph 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 wi...
X 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 t...
Opengraph URL: https://github.com/coder/code-server/issues/7955
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"--reconnection-grace-time does not survive closing the browser tab","articleBody":"## Problem\n\n`--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.\"*\n\nIn practice the setting cannot deliver that, for two independent reasons.\n\n**1. Closing the tab bypasses the grace time entirely.**\n\n`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:\n\n```\nEvent.once(this.protocol.onDidDispose)(() => {\n this._log(`The client has disconnected gracefully, so the connection will be disposed.`);\n this._cleanResources();\n});\n```\n\n`_cleanResources()` runs immediately — the grace time is never consulted. So closing the tab kills the session regardless of the configured value.\n\n**2. A second connection cuts the grace time to 5 minutes.**\n\n`RemoteExtensionHostAgentServer` shortens every disconnected connection on each new connection:\n\n```\nfor (const key in this._managementConnections) {\n this._managementConnections[key].shortenReconnectionGraceTimeIfNecessary();\n}\n```\n\nwhich schedules `ProtocolConstants.ReconnectionShortGraceTime` (5 min). Opening a second tab is enough to cut a deliberately long grace time back down.\n\n## Impact\n\nThe 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.\n\n## Expected\n\nWhen 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.\n\n## Environment\n\nReproduced on code-server 4.128.0 and confirmed present in `main` (4.133.0 / Code 1.133.0).","author":{"url":"https://github.com/hugodeco","@type":"Person","name":"hugodeco"},"datePublished":"2026-08-19T19:04:13Z","url":"https://github.com/coder/code-server/issues/7955"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:71232c33-e110-1bf4-bd62-11dc8b401092 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B80:E4EF6:1558C7:1CAB1A:6B042EE6 |
| html-safe-nonce | ff5a2b7953a609ddc2ae3b5e6935aa2472a03e73384b15b5d7513ad652b8c494 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjgwOkU0RUY2OjE1NThDNzoxQ0FCMUE6NkIwNDJFRTYiLCJ2aXNpdG9yX2lkIjoiNzQzODQyMDg1MDYxOTE5OTIwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e3fecb3897228687a636549591d9320dbef16acc86952ffc25df07f8a47f4360 |
| hovercard-subject-tag | issue:5196188454 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/code-server/7955/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7910f3f3e14aaa3e6d0fe533b2324bffe0d568315f84ad59f59ed9c120a65fa2/coder/code-server/issues/7955 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7910f3f3e14aaa3e6d0fe533b2324bffe0d568315f84ad59f59ed9c120a65fa2/coder/code-server/issues/7955 |
| og:image:alt | 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 wi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hugodeco |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/code-server git https://github.com/coder/code-server.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 172953845 |
| octolytics-dimension-repository_nwo | coder/code-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 172953845 |
| octolytics-dimension-repository_network_root_nwo | coder/code-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width