Skip to content

fix: send pending file notification eagerly on propagation fallback#514

Merged
torlando-tech merged 2 commits intomainfrom
fix/pending-file-notification-eager
Feb 21, 2026
Merged

fix: send pending file notification eagerly on propagation fallback#514
torlando-tech merged 2 commits intomainfrom
fix/pending-file-notification-eager

Conversation

@torlando-tech
Copy link
Copy Markdown
Owner

Summary

  • When a large file exceeds the recipient's size limit and falls back to propagation, the recipient should see a "pending file" notification card in the chat. This was broken by three cascading bugs that prevented the notification from ever appearing.
  • Sends the notification eagerly when falling back to propagation, rather than waiting for propagation to succeed (which may never happen)
  • Adds Field 16 (APP_EXTENSIONS_FIELD) to the meaningful_fields set so the recipient doesn't filter the notification as an "empty probe message"

Bugs fixed

  1. Ordering bug: _pending_file_notifications tracking was placed after the immediate-success return, so synchronous propagation success skipped notification entirely
  2. Timing bug: notification waited for propagation to succeed, but if propagation failed (max_relay_retries_exceeded), the notification was never sent
  3. Filter bug: Field 16 was not in meaningful_fields, so _on_lxmf_delivery discarded the notification as a probe message

Test plan

  • Send large file (55MB APK) from one phone to another with recipient's size limit set low (1MB)
  • Verify direct delivery is rejected and falls back to propagation
  • Verify "pending file notification" card appears on recipient within seconds
  • Verify sender logs show 📬 Sending pending file notification eagerly
  • Verify recipient logs show 📨 _on_lxmf_delivery CALLED! followed by ✅ Added message to pending_inbound queue

🤖 Generated with Claude Code

When a large file attachment exceeds the recipient's size limit and
falls back to propagation, notify the recipient immediately rather
than waiting for propagation to succeed. The previous deferred
approach had three bugs that prevented the notification from ever
appearing:

1. Tracking entry was placed after the immediate-success return,
   so synchronous propagation success skipped notification entirely
2. If propagation failed (max_relay_retries_exceeded), the
   notification was never sent since it waited for success
3. Field 16 (APP_EXTENSIONS_FIELD) was not in the meaningful_fields
   set, so the recipient's _on_lxmf_delivery filtered the
   notification as an "empty probe message"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 21, 2026

Greptile Summary

Fixes a critical bug chain that prevented recipients from receiving pending file notifications when large files fall back to propagation delivery.

Key Changes:

  • Sends pending file notifications eagerly in _on_message_failed when switching to propagation, rather than waiting for propagation success
  • Adds APP_EXTENSIONS_FIELD (Field 16) to meaningful_fields set in _on_lxmf_delivery so notifications aren't filtered as empty probe messages
  • Removes deferred notification tracking code from _on_message_delivered and _on_message_sent (no longer needed with eager approach)

Bugs Fixed:

  1. Ordering bug: Notification tracking was placed after early return, so synchronous propagation success skipped notification
  2. Timing bug: Notifications waited for propagation success, but if propagation failed (max_relay_retries_exceeded), notification was never sent
  3. Filter bug: Field 16 wasn't in meaningful_fields, so recipients discarded notifications as probe messages

Minor Issues:

  • _pending_file_notifications dictionary (line 552) is now unused dead code
  • Line 4866 uses magic number 5 instead of FIELD_FILE_ATTACHMENTS constant

Confidence Score: 4/5

  • Safe to merge with minor style improvements recommended
  • The changes correctly fix a critical bug chain with clear logic improvements. The eager notification approach is well-reasoned (avoids waiting for propagation that may never complete). Only minor style issues: unused dictionary and magic number instead of constant. No functional bugs detected.
  • No files require special attention

Important Files Changed

Filename Overview
python/reticulum_wrapper.py Fixes three cascading bugs preventing pending file notifications: moves notification to eager send on propagation fallback, adds Field 16 to meaningful_fields, removes unused tracking dictionary code

Last reviewed commit: 255c148

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

# propagation to succeed because: (a) propagation may fail entirely, leaving
# the recipient uninformed, and (b) the direct link to the recipient likely
# still works (the original failure was a size-limit rejection, not a path failure).
if hasattr(lxmf_message, 'fields') and lxmf_message.fields and 5 in lxmf_message.fields:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use FIELD_FILE_ATTACHMENTS constant instead of magic number 5

Suggested change
if hasattr(lxmf_message, 'fields') and lxmf_message.fields and 5 in lxmf_message.fields:
if hasattr(lxmf_message, 'fields') and lxmf_message.fields and FIELD_FILE_ATTACHMENTS in lxmf_message.fields:
Prompt To Fix With AI
This is a comment left during a code review.
Path: python/reticulum_wrapper.py
Line: 4866

Comment:
use `FIELD_FILE_ATTACHMENTS` constant instead of magic number `5`

```suggestion
                if hasattr(lxmf_message, 'fields') and lxmf_message.fields and FIELD_FILE_ATTACHMENTS in lxmf_message.fields:
```

How can I resolve this? If you propose a fix, please make it concise.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 21, 2026

Additional Comments (1)

python/reticulum_wrapper.py
this dictionary is now unused and can be removed

Prompt To Fix With AI
This is a comment left during a code review.
Path: python/reticulum_wrapper.py
Line: 552

Comment:
this dictionary is now unused and can be removed

How can I resolve this? If you propose a fix, please make it concise.

@sentry
Copy link
Copy Markdown
Contributor

sentry bot commented Feb 21, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
python/reticulum_wrapper.py 33.33% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@torlando-tech torlando-tech merged commit 299d352 into main Feb 21, 2026
12 of 13 checks passed
@torlando-tech torlando-tech deleted the fix/pending-file-notification-eager branch February 21, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant