fix(transmission_tracker): match a sent message only to its own packet

match_packet_hash gave a pending transmission the hash of the first packet heard within its 30-second window, whatever the packet was. On a busy mesh that was usually someone else's message or advert, so its repeats were counted as ours (the web viewer's repeat counts, DARC MoWaS's ACK check, graph_trace_helper's "our trace" test) and our real repeats were not.

A transmission now records what identifies its packet (the channel index for a channel message, the recipient's key for a DM, the tag for a trace) and match_packet_hash claims it only for a packet carrying the same: a GRP_TXT that decrypts on that channel to the same text, a TXT_MSG addressed to the recipient's hash and, when the radio's key is known, from ours, or a TRACE with the same tag. The RX handler passes that evidence through _transmission_evidence, reusing the authenticated channel decode. Without evidence, match_packet_hash only looks up hashes already matched, so record_repeat and graph_trace_helper no longer claim pending transmissions.

Repeat-count writes go to a single worker thread instead of running sqlite on the event loop, and _update_command_in_database no longer inserts into sys.path on every repeat.

bot_prefix still reads meshcore.device and stays None; fixing it turns on graph_trace_helper's trace updates, which have never run, so it is a separate change.
This commit is contained in:
agessaman committed 2026-10-02 16:51:15 -07:00
1 parent 1009766a0c
commit 323ebedeae
7 files changed
+243 -39

No files matched your search

+4 -2
View File
@@ -1244,7 +1244,8 @@ class CommandManager:
content=content,
target=contact_name,
message_type='dm',
command_id=command_id
command_id=command_id,
recipient_key=contact.get('public_key') if isinstance(contact, dict) else None,
)
except Exception as e:
self.logger.debug(f"Error recording transmission for repeat tracking: {e}")
@@ -1491,7 +1492,8 @@ class CommandManager:
content=content,
target=channel,
message_type='channel',
command_id=command_id
command_id=command_id,
channel_idx=channel_num,
)
except Exception as e:
self.logger.debug(f"Error recording transmission for repeat tracking: {e}")