mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-07-03 16:31:28 +02:00
fix: Always use attempt=0 payload for analyzer URL computation
The attempt loop (0-3) for matching incoming echo paths left computed_payload at attempt=3 when no match was found, producing wrong analyzer hashes. Combined with 1-hour incoming_paths cleanup in bridge (vs 7-day .echoes.jsonl retention), this caused older messages to lose both path info and correct analyzer links. Two fixes: - Compute base_payload at attempt=0 upfront for analyzer URL - Extend incoming_paths memory cleanup from 1h to 7 days Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+8
-5
@@ -379,8 +379,14 @@ def get_messages():
|
||||
for msg in messages:
|
||||
if not msg.get('is_own') and msg.get('sender_timestamp') and msg.get('channel_idx') in channel_secrets:
|
||||
secret = channel_secrets[msg['channel_idx']]
|
||||
# Always compute attempt=0 payload for analyzer URL
|
||||
base_payload = compute_pkt_payload(
|
||||
secret, msg['sender_timestamp'],
|
||||
msg.get('txt_type', 0), msg.get('raw_text', ''), attempt=0
|
||||
)
|
||||
msg['analyzer_url'] = compute_analyzer_url(base_payload)
|
||||
# Try all 4 attempt values for path matching
|
||||
matched = False
|
||||
computed_payload = None
|
||||
for attempt in range(4):
|
||||
try:
|
||||
computed_payload = compute_pkt_payload(
|
||||
@@ -394,16 +400,13 @@ def get_messages():
|
||||
msg['paths'] = entry.get('paths', [])
|
||||
matched = True
|
||||
break
|
||||
# Always set analyzer_url from computed payload (attempt 0)
|
||||
if computed_payload:
|
||||
msg['analyzer_url'] = compute_analyzer_url(computed_payload)
|
||||
if not matched and incoming_by_payload:
|
||||
raw = msg.get('raw_text', '')
|
||||
logger.debug(
|
||||
f"Echo mismatch: ts={msg.get('sender_timestamp')} "
|
||||
f"ch={msg.get('channel_idx')} "
|
||||
f"text_bytes={len(raw.encode('utf-8'))} "
|
||||
f"computed_payload={computed_payload[:16] if computed_payload else 'None'}... "
|
||||
f"base_payload={base_payload[:16]}... "
|
||||
f"text_preview={raw[:40]!r}"
|
||||
)
|
||||
except Exception as e:
|
||||
|
||||
@@ -599,8 +599,8 @@ class MeshCLISession:
|
||||
})
|
||||
logger.debug(f"Echo: stored incoming path {path} (path_len={echo_data.get('path_len')}, total paths: {len(self.incoming_paths[pkt_payload]['paths'])})")
|
||||
|
||||
# Cleanup old incoming paths (> 1 hour)
|
||||
cutoff = current_time - 3600
|
||||
# Cleanup old incoming paths (> 7 days, matching .echoes.jsonl retention)
|
||||
cutoff = current_time - (7 * 24 * 3600)
|
||||
self.incoming_paths = {k: v for k, v in self.incoming_paths.items()
|
||||
if v['first_ts'] > cutoff}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user