Commit Graph

205 Commits

Author SHA1 Message Date
Gustavo Madeira Santana
9d05db7be7 WhatsApp: move heartbeat recipient test into plugin 2026-03-30 00:46:50 -04:00
Gustavo Madeira Santana
aaf47ca54b WhatsApp: align deliver-reply test mocks with imports 2026-03-29 23:36:38 -04:00
Vincent Koc
d28349c48e fix(test): align channel mocks with runtime exports 2026-03-30 12:08:27 +09:00
Peter Steinberger
c2cbdea28c refactor: add approval auth capabilities to more channels 2026-03-30 09:04:08 +09:00
Peter Steinberger
8861cdbb6f refactor(plugin-sdk): untangle extension test seams 2026-03-29 23:43:53 +01:00
Marcus Castro
34648235a3 WhatsApp: use shared resolveReactionMessageId for context-aware reactions (#57226)
Wire the shared resolveReactionMessageId helper into the WhatsApp
channel adapter, matching the pattern already used by Telegram, Signal,
and Discord. The model can now react to the current inbound message
without explicitly providing a messageId.

Safety guards:
- Only falls back to context when the source is WhatsApp
- Suppresses fallback when targeting a different chat (normalized comparison)
- Throws ToolInputError (400) instead of plain Error (500) when messageId
  is missing, preserving gateway error mapping
2026-03-29 15:42:19 -03:00
Thomas M
0a01386756 fix: canonicalize session keys at write time (#30654) (thanks @thomasxm)
* fix: canonicalize session keys at write time to prevent orphaned sessions (#29683)

resolveSessionKey() uses hardcoded DEFAULT_AGENT_ID="main", but all read
paths canonicalize via cfg. When the configured default agent differs
(e.g. "ops" with mainKey "work"), writes produce "agent:main:main" while
reads look up "agent:ops:work", orphaning transcripts on every restart.

Fix all three write-path call sites by wrapping with
canonicalizeMainSessionAlias:
- initSessionState (auto-reply/reply/session.ts)
- runWebHeartbeatOnce (web/auto-reply/heartbeat-runner.ts)
- resolveCronAgentSessionKey (cron/isolated-agent/session-key.ts)

Add startup migration (migrateOrphanedSessionKeys) to rename existing
orphaned keys to canonical form, merging by most-recent updatedAt.

* fix: address review — track agent IDs in migration map, align snapshot key

P1: migrateOrphanedSessionKeys now tracks agentId alongside each store
path in a Map instead of inferring from the filesystem path. This
correctly handles custom session.store templates outside the default
agents/<id>/ layout.

P2: Pass the already-canonicalized sessionKey to getSessionSnapshot so
the heartbeat snapshot reads/restores use the same key as the write path.

* fix: log migration results at all early return points

migrateOrphanedSessionKeys runs before detectLegacyStateMigrations, so
it can canonicalize legacy keys (e.g. "main" → "agent:main:main") before
the legacy detector sees them. This caused the early return path to skip
logging, breaking doctor-state-migrations tests that assert log.info was
called.

Extract logMigrationResults helper and call it at every return point.

* fix: handle shared stores and ~ expansion in migration

P1: When session.store has no {agentId}, all agents resolve to the same
file. Track all agentIds per store path (Map<path, Set<id>>) and run
canonicalization once per agent. Skip cross-agent "agent:main:*"
remapping when "main" is a legitimate configured agent sharing the store,
to avoid merging its data into another agent's namespace.

P2: Use expandHomePrefix (environment-aware ~ resolution) instead of
os.homedir() in resolveStorePathFromTemplate, matching the runtime
resolveStorePath behavior for OPENCLAW_HOME/HOME overrides.

* fix: narrow cross-agent remap to provable orphan aliases only

Only remap agent:main:* keys where the suffix is a main session alias
("main" or the configured mainKey). Other agent:main:* keys — hooks,
subagents, cron sessions, per-sender keys — may be intentional
cross-agent references and must not be silently moved into another
agent's namespace.

* fix: run orphan-key session migration at gateway startup (#29683)

* fix: canonicalize cross-agent legacy main aliases in session keys (#29683)

* fix: guard shared-store migration against cross-agent legacy alias remap (#29683)

* refactor: split session-key migration out of pr 30654

---------

Co-authored-by: Your Name <your_email@example.com>
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-03-29 18:59:25 +05:30
Peter Steinberger
8e0ab35b0e refactor(plugins): decouple bundled plugin runtime loading 2026-03-29 09:10:38 +01:00
Peter Steinberger
61936938e9 refactor: move test harnesses off infra runtime 2026-03-28 06:52:06 +00:00
Peter Steinberger
4beb231fd8 refactor: move heartbeat helpers onto channel runtime 2026-03-28 04:09:25 +00:00
Peter Steinberger
faae213ab7 refactor: route whatsapp monitor through channel runtime 2026-03-28 03:48:57 +00:00
Peter Steinberger
12b7327e16 refactor: move secure random helpers onto core sdk 2026-03-28 03:06:06 +00:00
Peter Steinberger
b34b03dd9e refactor: move channel dedupe helpers onto core sdk 2026-03-28 02:58:45 +00:00
Peter Steinberger
491969efb0 refactor: route channel activity through channel runtime 2026-03-28 02:53:03 +00:00
Peter Steinberger
00dcfa1b3d refactor: move channel backoff helpers onto runtime-env 2026-03-28 02:48:35 +00:00
Tak Hoffman
3143cf86e8 fix(regression): restore whatsapp cold-runtime chunking 2026-03-27 21:23:18 -05:00
Peter Steinberger
4ca07559ab refactor: move provider seams behind plugin sdk surfaces 2026-03-27 23:26:26 +00:00
Peter Steinberger
992b30604d refactor: move extension-owned tests to extensions 2026-03-27 21:37:09 +00:00
Peter Steinberger
9a775aa59c refactor: continue plugin seam cleanup 2026-03-27 13:46:16 +00:00
lurebat
5d91b68af3 fix(whatsapp): exclude quoted message mentionedJids from mention detection (#52711)
Merged via squash.

Prepared head SHA: 2ac325f615
Co-authored-by: lurebat <154669821+lurebat@users.noreply.github.com>
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Reviewed-by: @mcaxtr
2026-03-27 02:35:49 -03:00
Peter Steinberger
40bd36e35d refactor: move channel config metadata into plugin-owned manifests 2026-03-27 01:59:30 +00:00
Tak Hoffman
d69ff3c022 fix(whatsapp): unwrap quoted wrapper messages 2026-03-26 10:16:33 -05:00
Peter Steinberger
2ed11a375a refactor: share web media loader 2026-03-26 14:55:32 +00:00
OfflynAI
e45533d568 fix(whatsapp): drop fromMe echoes in self-chat DMs using outbound ID tracking (#54570)
Merged via squash.

Prepared head SHA: dad53caf39
Co-authored-by: joelnishanth <140015627+joelnishanth@users.noreply.github.com>
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Reviewed-by: @mcaxtr
2026-03-26 02:24:24 -03:00
Marcus Castro
bc1c308383 fix(whatsapp): clarify allowFrom policy error (#54850) 2026-03-26 00:44:10 -03:00
Peter Steinberger
3b6d980c52 refactor: unify whatsapp identity handling 2026-03-25 04:46:24 -07:00
khhjoe
f3fe019e3d fix(whatsapp): use async fs.promises.readFile for selfLid creds read 2026-03-25 04:24:31 -07:00
khhjoe
770a5ee5b1 fix(whatsapp): read selfLid from creds.json for reply-to-bot detection 2026-03-25 04:24:31 -07:00
khhjoe
93594a1440 fix(whatsapp): compare selfLid for reply-to-bot implicit mention in groups 2026-03-25 04:24:31 -07:00
khhjoe
ff25407861 fix(whatsapp): unwrap FutureProofMessage (botInvokeMessage) to restore reply-to-bot detection 2026-03-25 04:24:31 -07:00
Peter Steinberger
b7f2b0d7b9 refactor: align pairing replies, daemon hints, and feishu mention policy 2026-03-25 04:22:53 -07:00
Ayaan Zaidi
15776091a8 fix(whatsapp): avoid eager login tool runtime access 2026-03-25 16:25:00 +05:30
Peter Steinberger
57e2223eec test: align pairing reply assertions 2026-03-25 05:48:31 +00:00
Peter Steinberger
6f137fff76 test: collapse telegram and whatsapp target suites 2026-03-25 05:21:16 +00:00
Peter Steinberger
61dd61e917 refactor: tighten split-runtime live-state guardrails 2026-03-24 21:58:50 -07:00
Peter Steinberger
fe84148724 test: collapse messaging target test suites 2026-03-25 04:52:36 +00:00
Peter Steinberger
039e87c942 fix: restore WhatsApp active listener singleton (#54232) 2026-03-24 21:36:20 -07:00
Peter Steinberger
6f6468027a refactor: dedupe test and runtime seams 2026-03-24 23:33:30 +00:00
Peter Steinberger
a18e156316 test: speed up telegram and whatsapp suites 2026-03-24 21:48:07 +00:00
Peter Steinberger
b11f4835e2 fix: suppress only recent whatsapp group echoes (#53624) (thanks @w-sss) 2026-03-24 10:10:48 -07:00
w-sss
0d4b47a14e fix(whatsapp): filter fromMe messages in groups to prevent infinite loop (#53386) 2026-03-24 10:10:48 -07:00
Peter Steinberger
332d2ebfe8 test: speed up whatsapp and signal suites 2026-03-24 16:26:58 +00:00
Peter Steinberger
49ae71fa62 test: speed up signal and whatsapp extension suites 2026-03-24 15:57:16 +00:00
Peter Steinberger
d884676dd2 test: speed up whatsapp and shared test suites 2026-03-24 15:16:18 +00:00
Peter Steinberger
b1b162fcdb test: harden threaded channel follow-ups 2026-03-24 09:24:29 +00:00
Vincent Koc
19295994f3 fix(ci): stabilize whatsapp extension checks 2026-03-23 15:50:19 -07:00
Vincent Koc
6f5df14308 test(whatsapp): preserve harness session exports 2026-03-23 15:50:19 -07:00
Vincent Koc
7b03502175 test(whatsapp): preserve media test module exports 2026-03-23 15:50:19 -07:00
Vincent Koc
e87a64f8d0 test(whatsapp): preserve session exports in login coverage 2026-03-23 15:50:19 -07:00
Vincent Koc
dad6018230 test(whatsapp): stabilize login coverage in shared workers 2026-03-23 15:50:19 -07:00