Merge sky into main 20260322#109
Merged
Merged
Conversation
- Pre-allocate dataBuffer with 4096 capacity to reduce allocations - Increase tmpBuffer from 1KB to 4KB for better read performance - Copy remainingBuffer to new slice after message processing to prevent the underlying array from being held in memory - Applied to both center and agent handleConnection
- Add 10s timeout to tls.Dial via tls.DialWithDialer to prevent indefinite hangs when agent is unreachable - Reduce WebSocket WriteBufferSize from 10MB to 64KB for both SSH and Agent terminal handlers to lower per-connection memory
- ExecuteCommand/ExecuteAction/ExecuteCommandGroup: buffered responseCh with non-blocking send to prevent sender goroutine from blocking permanently after timeout - UploadFile/DownloadFile: same pattern for file response channels
- processSessionMessage: use per-case lock instead of function-level lock to avoid holding lock during channel send operations - Replace direct SessionMessageChan send with enqueueSessionMessage() which safely handles closed sessions via select+done pattern - AgentWebSocketSession: add done channel, closeOnce, Close() method to prevent double-close panics and resource leaks - Buffer SessionMessageChan to 16 to reduce blocking - sendComboOutput: listen on aws.done to exit when session closes
- LogStream: add done channel and cleanRoutine() to periodically clean stale writers/readers that lost their connection - LogStream.Close(): signal done channel to stop clean routine - log.go: re-enable clearTaskStuff() to properly clean LogStream tasks, readers, writers, and watchers when SSE connections end - Fix error handling: don't return error when GetAgentConn fails during task cleanup (task may already be disconnected) - Remove dead commented-out code
- Add connDone channel to signal connection loss to all session goroutines, preventing leaked goroutines on disconnect - Add sessionForwarders map to track per-session done channels, with replaceSessionForwarder/clearSessionForwarder helpers - cleanupAllReaders: close all active LogStream readers on disconnect - cleanupAllSessionForwarders: signal all forwarders on disconnect - waitForSessionOutput: exit on connDone or forwarderDone, release non-persistent sessions (bash) when connection drops - terminal/session.go: add closeOnce/waitOnce for safe idempotent close and wait; Attach() returns error; add waitCmd() helper - terminal/manager.go: DetachSession releases and removes non-persistent sessions; AttachSession returns attach errors
在 set -euo pipefail 下,tr /dev/urandom | head 会因 SIGPIPE 返回退出码 141, 导致首次安装时脚本在密码生成步骤静默终止,后续所有安装步骤均未执行。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
当 GitHub API 被限流或返回异常响应时,grep 匹配不到 tag_name 返回退出码 1, pipefail + set -e 导致脚本静默退出,无法显示 "获取最新版本失败" 的错误提示。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
之前 set -euo pipefail 导致任何未处理的错误都会静默退出, 用户完全看不到发生了什么。现在在 EXIT trap 中检测退出码, 异常退出时显示错误提示和日志路径。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
通过 ERR trap 捕获失败命令的详细信息,在 EXIT trap 中展示给用户, 方便定位问题。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Important Notice
All pull requests must target the
developbranch. PRs opened againstmainwill be closed.Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
Type of Change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.
Checklist
Please tick all the boxes that apply to your PR:
Additional Information
Add any other information about the PR here, such as:
Code Review Checklist
The following items will be checked by the reviewer:
Thank you for your contribution! 🎉