Skip to content

fix: resolve quoted and older conversation context - #29

Merged
Muawiya-contact merged 6 commits into
mainfrom
fix-issue-26-reply-context
Nov 21, 2026
Merged

Muawiya-contact merged 6 commits into
mainfrom
fix-issue-26-reply-context

Conversation

@Muawiya-contact

Copy link
Copy Markdown
Member

Closes #26

What changed

  • Includes WhatsApp reply content as bounded, untrusted private context; unreadable quoted media is identified as unavailable rather than guessed.
  • Restricts stored quote lookup to the exact group chat and message ID, preserving group-policy boundaries.
  • Keeps the normal recent private dialogue window small (three turns, or six for an explicit ordinal/previous reference) and adds at most two relevant older turns through SQLite FTS.
  • Adds an upgrade path that rebuilds the dialogue index for existing databases.

Why

Maya can now understand replies such as “what should I say to that?”, and can recover a named topic after unrelated messages without receiving the owner’s full chat history.

Validation

  • browser-use --doctor
  • npm run typecheck
  • npm run lint
  • node --import tsx --test tests/context-phase3.test.mjs tests/migration-vu.test.mjs tests/whatsapp-router-ingest.test.mjs tests/owner-media.test.mjs tests/memory.test.mjs (27 passing)
  • git diff --check

Manual checks

  1. Reply to a Maya text in the private chat and ask what should I reply to this?
  2. Send several unrelated messages after discussing a named topic, then ask about that topic again.
  3. Reply to an image or voice note without a readable caption and confirm Maya says it cannot read the quoted attachment instead of inventing its content.

No production secrets or group messages are included in this PR.

@netlify

netlify Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for maya-assistant ready!

Name Link
🔨 Latest commit cec9990
🔍 Latest deploy log https://app.netlify.com/projects/maya-assistant/deploys/6b01404a334114914535937c
😎 Deploy Preview https://deploy-preview-29--maya-assistant.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T06:57:45.481400Z cec9990 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48afa90a3a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/features/context.ts Outdated
const stored = !quotedMessage.text && quotedMessage.remoteJid
? joinedGroupMessageByExternalId(quotedMessage.remoteJid, quotedMessage.id)
: undefined;
const text = quotedMessage.text ?? stored?.text ?? null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply group retrieval checks to inline quoted text

If a private owner message contains an inline quote from a group that is no longer joined or has retrieval disabled, this path sends quotedMessage.text to Gemini without checking the group; the policy-aware database lookup runs only when that text is absent. Apply the same source and retrieval-policy checks before including inline quote text, so quoted content cannot bypass the private-answer boundary.

AGENTS.md reference: AGENTS.md:L5-L7

Useful? React with 👍 / 👎.

@Muawiya-contact Muawiya-contact left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ok

@Muawiya-contact

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: cec99901b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Muawiya-contact
Muawiya-contact merged commit d4b0745 into main Nov 21, 2026
6 checks passed
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.

Implement reliable conversation context and WhatsApp reply-reference resolution

1 participant