Skip to content

fix: add @lid format support and allowFrom wildcard handling#1

Closed
mneves75 wants to merge 2 commits intoopenclaw:mainfrom
mneves75:fix/lid-format-and-allowfrom-wildcard
Closed

fix: add @lid format support and allowFrom wildcard handling#1
mneves75 wants to merge 2 commits intoopenclaw:mainfrom
mneves75:fix/lid-format-and-allowfrom-wildcard

Conversation

@mneves75
Copy link
Contributor

Summary

This PR fixes two critical bugs that prevent the web relay from processing inbound messages on newer WhatsApp versions:

  1. LID format not recognized: WhatsApp now uses Linked ID (@lid) format for message senders instead of the traditional @s.whatsapp.net format. The current jidToE164() function silently drops these messages.

  2. Wildcard "*" in allowFrom doesn't work: The allowFrom: ["*"] configuration is documented to allow all senders, but the code performs an exact string match, so "*" never matches any phone number.


Bug 1: LID Format Not Supported

Problem

WhatsApp has transitioned to using Linked IDs (LID) for identifying users in newer API versions. Messages now arrive with JIDs in the format:

142326760485098@lid

Instead of the traditional format:

The current jidToE164() function in src/utils.ts only matches the @s.whatsapp.net format, causing all inbound messages from @lid JIDs to be silently dropped.

Solution

Updated jidToE164() to check for @lid format and use the existing reverse mapping files that warelay already creates in ~/.warelay/credentials/lid-mapping-*_reverse.json.


Bug 2: allowFrom Wildcard Not Working

Problem

The allowFrom configuration is documented to support "*" as a wildcard to allow messages from all senders. However, the implementation performs an exact string match:

if (!allowFrom.includes(from)) {  // Exact match only!

When allowFrom: ["*"] is configured, the check fails because "+556183297558" is not literally in ["*"].

Solution

Added a check for the wildcard before performing the exact match:

if (!allowFrom.includes("*") && !allowFrom.includes(from)) {

Testing

  1. LID Format Resolution: Messages from @lid JIDs are now correctly resolved to E.164 phone numbers
  2. allowFrom Wildcard: allowFrom: ["*"] now correctly allows all senders
  3. Backward Compatibility: Traditional @s.whatsapp.net JIDs and explicit phone number lists continue to work

Files Changed

File Change
src/utils.ts Add @lid format support to jidToE164()
src/auto-reply/reply.ts Add wildcard check in allowFrom validation

Breaking Changes

None. These changes are backward compatible.


Environment

  • warelay version: 1.1.0
  • Node.js version: v24.11.0
  • WhatsApp: Latest iOS/Android versions using LID format

conhecendoia and others added 2 commits November 26, 2025 12:43
- Add support for WhatsApp Linked ID (@lid) format in jidToE164()
- Use existing lid-mapping-*_reverse.json files for LID resolution
- Fix allowFrom wildcard '*' to actually allow all senders
- Maintain backward compatibility with @s.whatsapp.net format

Fixes issues where:
- Messages from newer WhatsApp versions are silently dropped
- allowFrom: ['*'] configuration doesn't work as documented
@steipete
Copy link
Contributor

Oh awesome, thank you for your help!

@steipete
Copy link
Contributor

I'll cherry-pick this and add tests + some more fixes.

@steipete steipete closed this Nov 26, 2025
@mneves75
Copy link
Contributor Author

You are welcome

@mneves75 mneves75 deleted the fix/lid-format-and-allowfrom-wildcard branch November 27, 2025 20:22
steipete pushed a commit that referenced this pull request Jan 10, 2026
* fix(signal): handle reactions inside dataMessage.reaction

Signal reactions can arrive in two formats:
1. envelope.reactionMessage (already handled)
2. envelope.dataMessage.reaction (now handled)

The signal-cli SSE events use the second format, which was being
misinterpreted as a message with attachments, leading to 'broken
media / attachments' errors.

Changes:
- Add reaction property to SignalDataMessage type
- Check both envelope.reactionMessage and dataMessage.reaction
- Improve body content detection to properly identify reaction-only messages
- Add test for dataMessage.reaction format

* fix(signal): reaction notifications work when account is phone number

When reactionNotifications mode is 'own', notifications would never fire
because resolveSignalReactionTarget() returned a UUID but
shouldEmitSignalReactionNotification() compared it against the account
phone number, which never matched.

The fix:
- Add optional 'phone' field to SignalReactionTarget type
- Extract phone number first in resolveSignalReactionTarget(), include
  it even when UUID is present
- In shouldEmitSignalReactionNotification() 'own' mode, check phone
  match first before falling back to UUID comparison

This ensures reactions to your own messages are properly detected when
the Signal account is configured as a phone number and the reaction
event contains both targetAuthor (phone) and targetAuthorUuid.

* fix(signal): include phone in reaction target for own-mode matching

When targetAuthorUuid is present, also store targetAuthor phone number
in the reaction target. This allows own-mode reaction notifications to
match when comparing account phone against UUID-based targets.
@morganknutson morganknutson mentioned this pull request Jan 27, 2026
Havoc420didi pushed a commit to Havoc420didi/moltbot that referenced this pull request Jan 28, 2026
@CompassHXM
Copy link

Addressed all 3 review comments:

  1. ✅ Removed Git Workflow section (internal guideline)
  2. ✅ Removed config backup mention (unclear mechanism)
  3. ✅ Removed source directory path, using <source-directory> placeholder

Please check the updated diff!

simonemacario added a commit to simonemacario/clawdbot that referenced this pull request Feb 17, 2026
…ilures

The `delivered` boolean is already computed in isolated cron sessions but
was stripped from the return path and never persisted to CronJob.state.
This means `lastStatus: "ok"` gives no indication of whether the output
actually reached the target channel — the openclaw#1 debugging pain point for
cron delivery failures.

Thread `delivered` through executeJobCore → applyJobResult → CronEvent →
run-log so that:
- job.state.lastDelivered reflects the last run's delivery outcome
- the finished event includes delivered for downstream consumers
- the JSONL run log records the flag for audit

Fixes openclaw#19154
Related: openclaw#14743, openclaw#16927, openclaw#17905

Co-Authored-By: Claude Opus 4.6 <[email protected]>
simonemacario added a commit to simonemacario/clawdbot that referenced this pull request Feb 17, 2026
…ilures

The `delivered` boolean is already computed in isolated cron sessions but
was stripped from the return path and never persisted to CronJob.state.
This means `lastStatus: "ok"` gives no indication of whether the output
actually reached the target channel — the openclaw#1 debugging pain point for
cron delivery failures.

Thread `delivered` through executeJobCore → applyJobResult → CronEvent →
run-log so that:
- job.state.lastDelivered reflects the last run's delivery outcome
- the finished event includes delivered for downstream consumers
- the JSONL run log records the flag for audit

Fixes openclaw#19154
Related: openclaw#14743, openclaw#16927, openclaw#17905

Co-Authored-By: Claude Opus 4.6 <[email protected]>
simonemacario added a commit to simonemacario/clawdbot that referenced this pull request Feb 17, 2026
…ilures

The `delivered` boolean is already computed in isolated cron sessions but
was stripped from the return path and never persisted to CronJob.state.
This means `lastStatus: "ok"` gives no indication of whether the output
actually reached the target channel — the openclaw#1 debugging pain point for
cron delivery failures.

Thread `delivered` through executeJobCore → applyJobResult → CronEvent →
run-log so that:
- job.state.lastDelivered reflects the last run's delivery outcome
- the finished event includes delivered for downstream consumers
- the JSONL run log records the flag for audit

Fixes openclaw#19154
Related: openclaw#14743, openclaw#16927, openclaw#17905

Co-Authored-By: Claude Opus 4.6 <[email protected]>
simonemacario added a commit to simonemacario/clawdbot that referenced this pull request Feb 18, 2026
…ilures

The `delivered` boolean is already computed in isolated cron sessions but
was stripped from the return path and never persisted to CronJob.state.
This means `lastStatus: "ok"` gives no indication of whether the output
actually reached the target channel — the openclaw#1 debugging pain point for
cron delivery failures.

Thread `delivered` through executeJobCore → applyJobResult → CronEvent →
run-log so that:
- job.state.lastDelivered reflects the last run's delivery outcome
- the finished event includes delivered for downstream consumers
- the JSONL run log records the flag for audit

Fixes openclaw#19154
Related: openclaw#14743, openclaw#16927, openclaw#17905

Co-Authored-By: Claude Opus 4.6 <[email protected]>
simonemacario added a commit to simonemacario/clawdbot that referenced this pull request Feb 18, 2026
…ilures

The `delivered` boolean is already computed in isolated cron sessions but
was stripped from the return path and never persisted to CronJob.state.
This means `lastStatus: "ok"` gives no indication of whether the output
actually reached the target channel — the openclaw#1 debugging pain point for
cron delivery failures.

Thread `delivered` through executeJobCore → applyJobResult → CronEvent →
run-log so that:
- job.state.lastDelivered reflects the last run's delivery outcome
- the finished event includes delivered for downstream consumers
- the JSONL run log records the flag for audit

Fixes openclaw#19154
Related: openclaw#14743, openclaw#16927, openclaw#17905

Co-Authored-By: Claude Opus 4.6 <[email protected]>
nykadamec added a commit to nykadamec/openclaw that referenced this pull request Feb 18, 2026
- Add memory monitoring with getMemoryStats() function
- Implement memory thresholds (warn at 80%, prune at 90%)
- Add auto-prune for sessions older than 7 days
- Add Canvas cleanup for stale data (>24h)
- Add startMemoryMonitor/stopMemoryMonitor lifecycle functions
- Add memory monitoring tests

Feature openclaw#1: Memory Leaks Fix
togotago pushed a commit to togotago/openclaw that referenced this pull request Feb 18, 2026
Fixes two related issues causing session indexing to stop after gateway restart:

1. Move needsFullReindex check before reason gate in shouldSyncSessions()
   - Previously, reason='session-start' or 'watch' would block reindex
   - Now needsFullReindex bypasses reason checks, allowing sessions in full reindex

2. Persist sessionsDirty flag to database metadata
   - Add sessionsDirty field to MemoryIndexMeta type
   - Save sessionsDirty during sync (runSafeReindex)
   - Restore sessionsDirty from meta on manager construction
   - Rebuild sessionsDirtyFiles Set by scanning sessions directory on startup
   - Compare against indexed files in DB to populate dirty set

Without these fixes, session indexing would silently stop after any restart
because the in-memory sessionsDirtyFiles Set was lost and sessions were
excluded from reindex due to the reason gate.

Resolves issue openclaw#1
togotago pushed a commit to togotago/openclaw that referenced this pull request Feb 18, 2026
Fixes two related issues causing session indexing to stop after gateway restart:

1. Move needsFullReindex check before reason gate in shouldSyncSessions()
   - Previously, reason='session-start' or 'watch' would block reindex
   - Now needsFullReindex bypasses reason checks, allowing sessions in full reindex

2. Persist sessionsDirty flag to database metadata
   - Add sessionsDirty field to MemoryIndexMeta type
   - Save sessionsDirty during sync (runSafeReindex)
   - Restore sessionsDirty from meta on manager construction
   - Rebuild sessionsDirtyFiles Set by scanning sessions directory on startup
   - Compare against indexed files in DB to populate dirty set

Without these fixes, session indexing would silently stop after any restart
because the in-memory sessionsDirtyFiles Set was lost and sessions were
excluded from reindex due to the reason gate.

Resolves issue openclaw#1
togotago pushed a commit to togotago/openclaw that referenced this pull request Feb 18, 2026
Fixes two related issues causing session indexing to stop after gateway restart:

1. Move needsFullReindex check before reason gate in shouldSyncSessions()
   - Previously, reason='session-start' or 'watch' would block reindex
   - Now needsFullReindex bypasses reason checks, allowing sessions in full reindex

2. Persist sessionsDirty flag to database metadata
   - Add sessionsDirty field to MemoryIndexMeta type
   - Save sessionsDirty during sync (runSafeReindex)
   - Restore sessionsDirty from meta on manager construction
   - Rebuild sessionsDirtyFiles Set by scanning sessions directory on startup
   - Compare against indexed files in DB to populate dirty set

Without these fixes, session indexing would silently stop after any restart
because the in-memory sessionsDirtyFiles Set was lost and sessions were
excluded from reindex due to the reason gate.

Resolves issue openclaw#1
togotago pushed a commit to togotago/openclaw that referenced this pull request Feb 18, 2026
Fixes two related issues causing session indexing to stop after gateway restart:

1. Move needsFullReindex check before reason gate in shouldSyncSessions()
   - Previously, reason='session-start' or 'watch' would block reindex
   - Now needsFullReindex bypasses reason checks, allowing sessions in full reindex

2. Persist sessionsDirty flag to database metadata
   - Add sessionsDirty field to MemoryIndexMeta type
   - Save sessionsDirty during sync (runSafeReindex)
   - Restore sessionsDirty from meta on manager construction
   - Rebuild sessionsDirtyFiles Set by scanning sessions directory on startup
   - Compare against indexed files in DB to populate dirty set

Without these fixes, session indexing would silently stop after any restart
because the in-memory sessionsDirtyFiles Set was lost and sessions were
excluded from reindex due to the reason gate.

Resolves issue openclaw#1
footgun-seksbot pushed a commit to BotstersDev/botster-brain that referenced this pull request Feb 18, 2026
acs111 pushed a commit to acs111/openclaw that referenced this pull request Feb 19, 2026
- getPage(): coalesce concurrent launches into one promise to prevent
  multiple browser processes spawning under load (openclaw#1)
- isAuthUrl(): replace substring match with hostname check to eliminate
  false positives on URLs containing '/signin' (openclaw#2)
- SPA stale content: switch goto waitUntil to 'load' and wait for note
  container before querying checkboxes so navigation between notes does
  not return items from the previous note (openclaw#3)
- extractUncheckedItems(): accept timeoutMs param and use it for both
  waitForSelector calls instead of a hardcoded 8s value (openclaw#4)
- openLoginBrowser(): store login context in this.loginContext so
  getPage() blocks while a login browser is open; session cleanup is
  owned by the returned done promise (openclaw#5)
- /keep status: check fs.existsSync(profileDir) and report actual
  session state instead of a static hint (openclaw#6)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Raymondrrb added a commit to Raymondrrb/openclaw that referenced this pull request Feb 20, 2026
…slab-workspace

feat: unify Rayviews + fix all test failures
Copy link

@bircheve bircheve left a comment

Choose a reason for hiding this comment

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

LGTM — 1,224 commits from v2026.2.19, clean fast-forward, all tests pass.

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.

7 participants

Comments