fix: address code review - simplify msg IDs, unique session IDs, import cleanup

Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/b23d87ff-c4b8-4df2-a4e3-3439734b3f0f
This commit is contained in:
copilot-swe-agent[bot] 2026-03-24 17:07:49 +00:00
parent 4dc1f7b2e8
commit e8fa0ec0c2
3 changed files with 5 additions and 5 deletions

View File

@ -74,7 +74,7 @@ jobs:
INPUT_PERSONAS: ${{ github.event.inputs.personas }}
run: |
DATE=$(date +%Y-%m-%d)
SESSION_ID="MULTI-WAKE-$(date +%Y%m%d)-001"
SESSION_ID="MULTI-WAKE-$(date +%Y%m%d-%H%M%S)"
mkdir -p grid-db/multi-wake-sessions
SESSION_FILE="grid-db/multi-wake-sessions/${SESSION_ID}.json"
@ -241,7 +241,7 @@ jobs:
if not questions:
continue
for q in questions:
h = int(hashlib.md5(q.encode()).hexdigest(), 16) % 10000
h = int(hashlib.md5((p['persona_id'] + q + datetime.now().isoformat()).encode()).hexdigest(), 16) % 10000
msg = {
'id': f"MSG-{datetime.now().strftime('%Y%m%d')}-{h:04d}",
'channel': 'general',

View File

@ -236,7 +236,7 @@ jobs:
export LOG_FILE
python3 << 'PYEOF'
import json, os
import json, os, hashlib
from datetime import datetime
log_file = os.environ["LOG_FILE"]
persona_id = os.environ["PERSONA_ID"]
@ -257,7 +257,7 @@ jobs:
with open(general, "a") as f:
for m in msgs:
msg = {
"id": f"MSG-{datetime.now().strftime('%Y%m%d')}-{int(__import__('hashlib').md5(m.get('message','').encode()).hexdigest(), 16) % 10000:04d}",
"id": f"MSG-{datetime.now().strftime('%Y%m%d')}-{int(hashlib.md5((persona_id + m.get('message','') + datetime.now().isoformat()).encode()).hexdigest(), 16) % 10000:04d}",
"channel": "general",
"from": persona_id,
"from_name": persona_name,

View File

@ -35,7 +35,7 @@ fs.mkdirSync(path.dirname(channelFile), { recursive: true });
const now = new Date();
const dateStr = now.toISOString().slice(0, 10).replace(/-/g, '');
const hash = crypto.createHash('md5').update(content + now.toISOString()).digest('hex');
const msgId = `MSG-${dateStr}-${parseInt(hash.slice(0, 8), 16) % 10000}`.replace(/-(\d)$/, '-000$1').replace(/-(\d{2})$/, '-00$1').replace(/-(\d{3})$/, '-0$1');
const msgId = `MSG-${dateStr}-${String(parseInt(hash.slice(0, 8), 16) % 10000).padStart(4, '0')}`;
const message = {
id: msgId,