Skip to content

Support existing WhatsApp groups and Companion turns - #46

Merged
dimavrem22 merged 9 commits into
mainfrom
feat/whatsapp-groups-companion
Nov 7, 2026
Merged

dimavrem22 merged 9 commits into
mainfrom
feat/whatsapp-groups-companion

Conversation

@dimavrem22

@dimavrem22 dimavrem22 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Executive Summary

Support existing WhatsApp groups, readable inline replies, native mentions, and Companion conversations through OpenCode.

  • Preserve media, reactions, explicit quoted sends, contextual participation, and optional mention-required mode.
  • Show the exact quoted message's author, bounded text, and attachment metadata before the agent responds.
  • Match Hermes and Codex behavior using the published Inkbox SDK 0.7.29 and the host's existing durable lifecycle.

Description

Groups are addressed by stable conversation IDs; names are labels. The group must already exist and have received an inbound message before the agent can reply. Group sessions remain separate from direct messages and other groups.

Incoming direct/group inline replies resolve only their explicit parent through the authenticated identity's message-read API. The parent must match the requested ID, conversation, identity, and access checks. The source/parent association survives initialization, queued turns, and quiet Companion context. Optional read failures never drop the current message: temporary failures and inaccessible parents are explicitly distinguished, with the exact target ID retained.

Native mentions resolve to the agent handle, visible contact name, verified number, or an unresolved label. URLs remain intact and conflicting mention tokens are not assigned a guessed name. Only the current message's raw text and verified native mentions control attention or commands. Quotes remain context.

Reason

An agent must understand an ambiguous inline reply without guessing which earlier message it refers to. The same behavior should work across the plugin fleet without introducing separate permission models, group creation, or host-specific product differences.

Decisions

  • Existing groups only: No group creation or membership management. Names are not routing keys.
  • Current intent only: Quoted mentions, commands, and reaction targets cannot become a new current request. Reactions do not inherit the target message's own quote chain.
  • Bounded context: Shared JSON label/schema and limits: 2,000 text characters, 200 author characters, four attachment metadata records capped at 200 characters per field. No attachment URLs or contact memories are injected into the quote block.
  • Authorization: Preserve current source, destination, sponsor, membership, and explicit-block checks. Quoted context is authorized history, not a new grant or sender admission.
  • Ordering and recovery: Retain each host's durable queue and idempotency behavior. Where enrichment precedes admission, serialize that preparation by conversation. Do not invent replacement sends for uncertain outcomes.
  • Released SDK: Require SDK 0.7.29 in current dependencies and feature CI. Preserve intentional historical compatibility lanes; no SDK source overlay or new release is needed.

Testing

  • Current pushed and tested head: ea51183c47998e49627b35e922b9883156a6fd3d.
  • Local immutable runtime suite: 1,557 passed, 1 skipped. Final error-message-only follow-up: 128 passed, 1 skipped. Typecheck, lint, build, and four Python preflight tests passed.
  • All 26 latest-head checks passed, including the complete downstream pipeline and aggregate: unit, SDK, and host-contract checks, full-stack checks, and CodeQL.
  • Full-stack coverage passed for mock and real channels, all five A2A modes, all three voice modes, and external events.
  • Fable and Opus found no remaining blocking findings after verified fixes.
  • Regression coverage includes exact-parent author/text/media, foreign or blocked parents, transient failures, initialization/quiet retention, distinct-parent bursts, quote-aware burst bounds, current-only mention/control gating, conversation ordering, and existing send/reaction behavior.

Related PRs

Installation and verification

From the reviewed checkout, use the existing host/gateway environment and preserve its identity, credentials, configuration, and retained state. No merge or package publication is part of these commands:

./install.sh --no-setup
inkbox-opencode doctor
inkbox-opencode restart
inkbox-opencode status

For a gateway managed by a service manager, restart the existing service rather than launching a second instance. OpenCode's host process must also reload its plugin after installation. Do not rerun onboarding just to update the plugin, and do not delete retained receipts to retry an uncertain send.

Manual verification

  1. Quote an earlier message in an existing group and send “What about this?” Confirm the agent identifies the exact quoted author and text.
  2. Send rapid replies to different parents and a plain correction. Confirm source-parent association and arrival ordering.
  3. Quote an attachment-only message. Confirm its metadata is shown without falsely claiming the attachment was viewed.
  4. In mention-required mode, quote a message containing an agent mention or command without mentioning the agent in the current message. Confirm it stays contextual until a genuine current-message wake.
  5. React to a message that was itself a reply. Confirm the reaction remains tied to its actual target, with no invented quote.
  6. Exercise media, explicit quoted sends, reactions, and Companion Safe/Relaxed participation. Confirm destination isolation and retention of original keys for uncertain sends.

@dimavrem22

Copy link
Copy Markdown
Contributor Author

Updated in e3ede4f:

  • Ordinary group rechecks now use the same inbound participant policy as admission.
  • Restart recovers a completed answer interrupted during preflight only when no send intent was recorded; a recorded uncertain operation stays fenced.
  • Wrapped transient preflight errors retain their retry classification.

Validation: 273 focused tests passed with the compatible SDK, including four new recovery/policy regressions; typecheck, lint, and diff checks pass. The full published-SDK suite previously passed 1,517 tests (one source-SDK-only skip), and the compatible SDK suite passed all 1,518 before this recovery patch. Latest-head CI and independent follow-up reviews are running. No package publication or deployment was performed for this PR.

@dimavrem22

Copy link
Copy Markdown
Contributor Author

Final review candidate: 164defeac15dac463690ffc56cfcc642546c0442.

Additional verified fixes:

  • Distinguish inbound reservation receipts from real send attempts during crash recovery.
  • Keep a reserved Companion receipt queued when its initial activation read fails.
  • Bind each Companion control acknowledgement to the current source, not the initialization source.

Validation: 356 focused session, wiring, WhatsApp and SDK tests pass, including six recovery/control regressions. Typecheck, lint, and diff checks pass. Current main is fully included and the PR is mergeable. Fable, Opus, and Grok are checking immutable snapshots of this exact head; all latest-head CI workflows remain under monitoring, including downstream live checks. Obsolete queued runs were cancelled; the latest run is retained.

@dimavrem22

Copy link
Copy Markdown
Contributor Author

Updated in ea51183c47998e49627b35e922b9883156a6fd3d: authorized quoted-parent context with the same schema, labels, limits, and nonblocking failure behavior as Hermes/Codex; per-conversation admission ordering; initialization/quiet-context retention; URL-safe, ambiguity-safe mention labels; and published SDK 0.7.29. Existing group, media, reaction, source authorization, and idempotency behavior is preserved. No group creation.

Validation: immutable runtime suite 1,557 passed, 1 skipped; the final error-message-only follow-up passed 128 targeted tests, 1 skipped. Typecheck, lint, and build passed. Fable and Opus found no blocking runtime issues; the stale dependency hints and quote-aware existing burst budget were corrected.

Latest-head CI is running and remains owned through its full downstream pipeline. No merge, package publication, or runtime deployment is claimed by this update.

@dimavrem22

Copy link
Copy Markdown
Contributor Author

Completed verification for ea51183c47998e49627b35e922b9883156a6fd3d.

  • Local full runtime suite: 1,557 passed, 1 skipped; final error-message-only follow-up: 128 passed, 1 skipped. Typecheck, lint, build, and four Python preflight tests passed.
  • All 26 checks passed on the current head: unit/SDK/host checks, complete full-stack pipeline and aggregate, and CodeQL.
  • Full-stack verification includes both channel modes, five A2A modes, three voice modes, and external events. No pending or failing checks remain.

The Testing section now records these final results. No merge or deployment was performed.

@dimavrem22
dimavrem22 merged commit bf6820a into main Nov 7, 2026
26 checks passed
@dimavrem22
dimavrem22 deleted the feat/whatsapp-groups-companion branch November 7, 2026 20:32
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