fix(docker): resolve container networking and DB compatibility issues (#560)

- Auto-detect Docker container environment and use service name
  'hermes-agent' as default host instead of 127.0.0.1
- Replace hardcoded column names with SELECT * in session DB queries
  to compat with older Hermes agent state.db schemas
- Remove unused UPSTREAM env var from docker-compose.yml
- Include err.message in syncFromHermes failure logs
- Add group chat rule to prevent self-mentioning

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
ekko
2026-05-09 11:37:26 +08:00
committed by GitHub
parent 448f780568
commit c3738cf1c3
5 changed files with 11 additions and 58 deletions
@@ -1594,7 +1594,7 @@ export class ChatRunSocket {
this.enqueueEphemeralDelete(hermesSessionId, profile)
return true
} catch (err: any) {
logger.warn(err, '[chat-run-socket] syncFromHermes failed for session %s (hermesId: %s, profile: %s)', localSessionId, hermesSessionId, profile || 'default')
logger.warn(err, '[chat-run-socket] syncFromHermes failed for session %s (hermesId: %s, profile: %s): %s', localSessionId, hermesSessionId, profile || 'default', err?.message)
return false
}
}
@@ -53,6 +53,7 @@ ${memberSection}
规则:
- 有人用 @${params.agentName} 提及你时才需要回复,重点回应提及你的人。
- 禁止@自己。
- 回答简洁、对群聊有帮助。
- 不要假装是人类,需要时明确表明自己是 AI。
- 对话历史中包含多个人的消息,每条消息前标有发送者名字。
@@ -163,7 +163,9 @@ export class GatewayManager {
*/
private readProfilePort(name: string): { port: number; host: string } {
const configPath = join(this.profileDir(name), 'config.yaml')
if (!existsSync(configPath)) return { port: 8642, host: '127.0.0.1' }
const defaultHost = initSystem === 'container' ? 'hermes-agent' : '127.0.0.1'
if (!existsSync(configPath)) return { port: 8642, host: defaultHost }
try {
const content = readFileSync(configPath, 'utf-8')
@@ -172,11 +174,11 @@ export class GatewayManager {
const extra = cfg?.platforms?.api_server?.extra
const rawPort = extra?.port || 8642
const port = typeof rawPort === 'number' ? rawPort : parseInt(rawPort, 10) || 8642
const host = extra?.host || '127.0.0.1'
const host = extra?.host || defaultHost
// 端口超出合法范围时回退到默认值
return { port: port > 0 && port <= 65535 ? port : 8642, host }
} catch {
return { port: 8642, host: '127.0.0.1' }
return { port: 8642, host: defaultHost }
}
}