fix: 全项目文档对齐 + 代码清理

代码修复:
- web/agent/agent.py: datetime.utcnow() → datetime.now(timezone.utc)
- requirements.txt: 移除 paramiko==3.5.0 (已无活跃引用)
- 删除 server/infrastructure/ssh/pool.py (DEPRECATED, 无引用)

连接池三层对齐 (config.py/.env.example/session.py):
- DB_POOL_SIZE 100→160, DB_MAX_OVERFLOW 100→120
- 基于 MySQL max_connections=400, install.php 公式

文档修复 (21项):
- P0: 硬编码域名/IP替换为配置变量占位符
- P1: 10个过时设计文档加归档标注 (引用旧文件结构)
- P2: step-3-webssh报告 paramiko引用修正
- 6份审查报告连接池参数勘误 100/100→160/120
- ECC安全报告 EC5 datetime.utcnow 标记已修复
- docs/README.md 文档索引重写
- docs/memory/mem_nexus_overview.md 移除硬编码凭证
- docs/project/tech-stack-inventory.md paramiko标记已移除

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Your Name
2026-05-22 08:19:56 +08:00
parent 302fdcc1a1
commit c9a99f4fb3
74 changed files with 1303 additions and 1510 deletions
+18 -3
View File
@@ -87,6 +87,7 @@ class AsyncSSHPool:
If an idle connection exists for this server, reuse it.
Otherwise, create a new connection.
SSH handshake is done outside the lock to avoid blocking other pool operations.
"""
async with self._lock:
# Check for existing idle connection
@@ -97,12 +98,26 @@ class AsyncSSHPool:
logger.debug(f"Reused SSH connection: server={server.id}, refs={pooled.ref_count}")
return pooled.conn
# Create new connection
# Need to create — evict if at capacity, then release lock for handshake
if len(self._pool) >= self.MAX_CONNECTIONS:
# Evict the oldest idle connection
await self._evict_one()
conn = await self._create_connection(server)
# Create connection outside lock (handshake can take seconds)
conn = await self._create_connection(server)
async with self._lock:
# Re-check: another coroutine may have created one while we were unlocked
pooled = self._pool.get(server.id)
if pooled and not pooled.conn.is_closed():
# Close our new connection, reuse the existing one
try:
conn.close()
except Exception:
pass
pooled.ref_count += 1
pooled.last_used = time.monotonic()
return pooled.conn
pooled = PooledConnection(
conn=conn,
ref_count=1,