feat: expose --reconnection-grace-time CLI flag#7678
feat: expose --reconnection-grace-time CLI flag#7678tianyicui wants to merge 2 commits intocoder:mainfrom
Conversation
code-asher
left a comment
There was a problem hiding this comment.
Thank you! I wish we had some generic mechanism for passing through any VS Code flag, but for now this seems good to me.
src/node/cli.ts
Outdated
| args["github-auth"] = process.env.GITHUB_TOKEN | ||
| } | ||
|
|
||
| if (process.env.CS_RECONNECTION_GRACE_TIME) { |
There was a problem hiding this comment.
We want to migrate from CS_ to CODE_SERVER_ so we should update this to CODE_SERVER_RECONNECTION_GRACE_TIME.
There was a problem hiding this comment.
Fixed. The new env var now uses CODE_SERVER_RECONNECTION_GRACE_TIME, and the parser test covers that name.
lustsazeus-lab
left a comment
There was a problem hiding this comment.
Code Review: Expose --reconnection-grace-time CLI Flag
Overall
Well-structured PR that adds a useful feature for users who need longer reconnection grace periods.
Strengths
- Clear motivation and problem statement
- Comprehensive implementation (CLI flag, env var, config.yaml)
- Good test coverage with dedicated tests
- Proper TypeScript types
Suggestions
1. Documentation
- Consider adding to
docs/README.mdordocs/guide.mdexplaining the use case - Default value (3 hours) should be documented
2. Validation
- No validation for negative values or extremely large values
- Consider adding max limit to prevent abuse
3. Error Handling
- What happens if the underlying VS Code Server version doesn't support this flag?
- Consider adding version check
4. Minor: Test Naming
- Test names could be more specific about what's being tested
Conclusion
Solid implementation, ready to merge. The suggestions above are improvements but not blockers.
Recommendation: Approve
Reviewed by: lustsazeus-lab
Pass through VS Code Server's --reconnection-grace-time argument, allowing users to configure how long the server waits for a disconnected client to reconnect before cleaning up the session. This is useful for users whose client machines sleep overnight, causing the default 3-hour grace period to expire and forcing a "Reload Window" on wake. The flag can also be set via $CS_RECONNECTION_GRACE_TIME env var or in config.yaml. Fixes coder#7665 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
638ac5f to
bd55a32
Compare
|
Followed up on the review items:
I did not add local validation or a version gate here. |
Summary
--reconnection-grace-timeCLI argument through code-server, allowing users to configure how long the server waits for a disconnected client to reconnect before cleaning up the session$CS_RECONNECTION_GRACE_TIMEenvironment variable andconfig.yamlsettingserverEnvironmentService.ts; code-server just wasn't passing it throughMotivation
When a client machine sleeps (e.g., overnight), the WebSocket connection drops. VS Code Server's default 3-hour reconnection grace time expires, the server discards the reconnection token, and the user is forced to "Reload Window" on wake. Users who want longer grace periods currently have no way to configure this.
Fixes #7665
Changes
src/node/cli.ts: Addedreconnection-grace-timetoUserProvidedCodeArgsinterface,optionsobject, andsetDefaults()(env var support via$CS_RECONNECTION_GRACE_TIME)test/unit/node/cli.test.ts: Added test for the new flag in the "parse all options" test and a dedicated env var testUsage
Test plan
--reconnection-grace-timeis parsed correctly from CLI$CS_RECONNECTION_GRACE_TIMEenv var is picked up insetDefaults()🤖 Generated with Claude Code