Skip to content

fix(wacli): resolve group chat titles#50

Merged
g1e2x87 merged 1 commit into
mainfrom
fix/wacli-chat-title-contract
Jul 21, 2026
Merged

fix(wacli): resolve group chat titles#50
g1e2x87 merged 1 commit into
mainfrom
fix/wacli-chat-title-contract

Conversation

@g1e2x87

@g1e2x87 g1e2x87 commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Problem: wacli group webhooks reached OpenPRX without a conversation title, so group profiles could be displayed as untitled even though wacli had the group name.
  • Why it matters: operators cannot reliably identify WhatsApp group conversations in context and profile metadata.
  • What changed: accept ChatName/chatName from newer webhook payloads and use a read-only store_dir/wacli.db lookup (chats, then groups) as a legacy group-only fallback.
  • What did not change (scope boundary): outbound delivery, webhook authentication, DM naming, reply policy, and the wacli database schema remain unchanged.

Label Snapshot (required)

  • Risk label (risk: low|medium|high): risk: low
  • Size label (size: XS|S|M|L|XL, auto-managed/read-only): size: S expected
  • Scope labels (core|agent|channel|config|cron|daemon|doctor|gateway|health|heartbeat|integration|memory|observability|onboard|provider|runtime|security|service|skillforge|skills|tool|tunnel|docs|dependencies|ci|tests|scripts|dev, comma-separated): channel, config, docs, tests
  • Module labels (<module>: <component>, for example channel: telegram, provider: kimi, tool: shell): channel: wacli
  • Contributor tier label (trusted contributor|experienced contributor|principal contributor|distinguished contributor, auto-managed/read-only; author merged PRs >=5/10/20/50): auto-managed
  • If any auto-label is incorrect, note requested correction: None

Change Metadata

  • Change type (bug|feature|refactor|docs|security|chore): bug
  • Primary scope (runtime|provider|channel|memory|security|ci|docs|multi): channel

Linked Issue

Supersede Attribution (required when Supersedes # is used)

  • Superseded PRs + authors (#<pr> by @<author>, one per line): Not applicable
  • Integrated scope by source PR (what was materially carried forward): Not applicable
  • Co-authored-by trailers added for materially incorporated contributors? (Yes/No): No
  • If No, explain why (for example: inspiration-only, no direct code/design carry-over): No superseded or incorporated contribution
  • Trailer format check (separate lines, no escaped \\n): Pass

Validation Evidence (required)

Commands and result summary:

cargo fmt --all -- --check
RUSTFLAGS='-D warnings' cargo clippy --workspace --all-targets
cargo check --all-features
cargo test --workspace
cargo test -p openprx --all-features channels::wacli::tests -- --nocapture
cargo test -p openprx --all-features --test chat_pty_e2e -- --nocapture
cargo build --release -p openprx --bin prx --all-features
  • Evidence provided (test/log/trace/screenshot/perf): all commands passed; 37 wacli tests passed; 31 PTY tests passed with 1 ignored; release binary built successfully.
  • If any command is intentionally skipped, explain why: None

Security Impact (required)

  • New permissions/capabilities? (Yes/No): No
  • New external network calls? (Yes/No): No
  • Secrets/tokens handling changed? (Yes/No): No
  • File system access scope changed? (Yes/No): Yes
  • If any Yes, describe risk and mitigation: the configured wacli SQLite store is opened only for group-title fallback, with SQLite read-only flags; errors are non-fatal and do not expose database contents.

Privacy and Data Hygiene (required)

  • Data-hygiene status (pass|needs-follow-up): pass
  • Redaction/anonymization notes: tests use project-native synthetic group names and existing synthetic JIDs only; no real contact or group data is committed.
  • Neutral wording confirmation (use OpenPRX/project-native labels if identity-like wording is needed): Confirmed

Compatibility / Migration

  • Backward compatible? (Yes/No): Yes
  • Config/env changes? (Yes/No): No; existing optional store_dir gains a read-only fallback use.
  • Migration needed? (Yes/No): No
  • If yes, exact upgrade steps: Not applicable

Human Verification (required)

What was personally validated beyond CI:

  • Verified scenarios: official payload title propagation; legacy payload fallback from a temporary wacli SQLite store; read-only open; group metadata reaches ChannelMessage.chat_title.
  • Edge cases checked: missing ChatName, blank title, non-group messages, unavailable/invalid store, and webhook authentication behavior.
  • What was not verified: a real WhatsApp group message against the deployed service will be exercised after merge and deployment.

Side Effects / Blast Radius (required)

  • Affected subsystems/workflows: inbound wacli group webhook metadata only.
  • Potential unintended effects: a slow or locked local SQLite database could delay title resolution.
  • Guardrails/monitoring for early detection: lookup runs in spawn_blocking, opens read-only, fails open to no title, and logs failures at debug level.

Agent Collaboration Notes (recommended)

  • Agent tools used (if any): Codex shell and patch tools; no sub-agents.
  • Workflow/plan summary (if any): audit official payload and local store, implement dual-source title resolution, validate, PR, deploy after merge.
  • Verification focus: backward compatibility, read-only database access, transport/profile metadata contract, full workspace and PTY gates.
  • Confirmation: naming + architecture boundaries followed (AGENTS.md + CONTRIBUTING.md): Confirmed

Rollback Plan (required)

  • Fast rollback command/path: revert this PR; the channel then returns to title-less wacli group messages.
  • Feature flags or config toggles (if any): remove or omit channels_config.wacli.store_dir to disable the database fallback while retaining payload titles.
  • Observable failure symptoms: group conversations remain untitled, or debug logs report a read-only title lookup failure.

Risks and Mitigations

  • Risk: local database schema drift or read contention prevents fallback lookup.
    • Mitigation: read-only access, established chats/groups lookup order, group-only execution, and non-fatal fallback behavior.

@g1e2x87 g1e2x87 added risk: low Auto risk: docs/chore-only paths. channel Auto scope: src/channels/** changed. config Auto scope: src/config/** changed. docs Auto scope: docs/markdown/template files changed. tests Auto scope: tests/** changed. bug Something isn't working labels Jul 21, 2026
@g1e2x87
g1e2x87 merged commit ffc4276 into main Jul 21, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working channel Auto scope: src/channels/** changed. config Auto scope: src/config/** changed. docs Auto scope: docs/markdown/template files changed. risk: low Auto risk: docs/chore-only paths. tests Auto scope: tests/** changed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant