fix: 代码审查和安全扫描反馈修复

- work-order-manager.js: 归档前确保目录存在(mkdirSync recursive)
- staging-ops-agent.js: LLM模型名可配置(ZY_LLM_MODEL环境变量)
- staging-auto-deploy.yml: 工单读取增加try-catch错误处理
- zhuyuan-sovereign.conf: SSL配置块增加域名占位符替换说明

Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/bb893563-5fa6-41ba-86e4-b6f87d2c2c32

Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-31 06:48:30 +00:00 committed by GitHub
parent 461a270459
commit 6891619c81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 6 deletions

View File

@ -363,6 +363,7 @@ jobs:
# 读取工单重试次数
ORDER_ID="${{ needs.deploy-staging.outputs.order_id }}"
RETRY_INFO=$(node -e "
try {
const data = JSON.parse(require('fs').readFileSync('data/work-orders/active.json','utf8'));
const order = data.orders.find(o => o.id === '$ORDER_ID');
if (order) {
@ -370,6 +371,10 @@ jobs:
} else {
console.log('SKIP');
}
} catch (e) {
console.error('工单文件读取失败:', e.message);
console.log('SKIP');
}
")
echo "alert_action=$RETRY_INFO" >> $GITHUB_OUTPUT

View File

@ -219,7 +219,7 @@ ${logContent.slice(0, 3000)}
const requestModule = isHttps ? https : http;
const body = JSON.stringify({
model: 'deepseek-chat', // 优先使用高性价比模型
model: process.env.ZY_LLM_MODEL || 'deepseek-chat', // 默认使用高性价比模型, 可通过环境变量覆盖
messages: [
{ role: 'system', content: '你是铸渊(ZhuYuan),光湖(HoloLake)系统的AI守护者。精通服务器运维、Node.js、Nginx、PM2。' },
{ role: 'user', content: prompt }

View File

@ -222,6 +222,9 @@ function archiveOrder(args) {
message: '任务归档完成'
});
// 确保归档目录存在
fs.mkdirSync(ARCHIVE_DIR, { recursive: true });
// 移到归档目录
const month = new Date().toISOString().slice(0, 7);
const archiveFile = path.join(ARCHIVE_DIR, `${month}.json`);

View File

@ -203,6 +203,8 @@ server {
# 当 /opt/zhuyuan/config/ssl/ 下存在证书文件时启用
# 证书来源: GitHub Secrets → ZY_SSL_FULLCHAIN / ZY_SSL_PRIVKEY
# 部署方式: staging-auto-deploy.yml 自动写入证书文件
# 域名占位符: ZY_DOMAIN_PREVIEW_PLACEHOLDER 由 deploy workflow 的 sed 命令替换
# (同 §1/§2 的注入方式,详见 staging-auto-deploy.yml 和 deploy-to-zhuyuan-server.yml)
# ─── §3.1 预览域名 HTTPS (guanghu.online) ───
# 注意: 此block仅在证书存在时由deploy脚本include不会导致Nginx启动失败