Skip to content

Expose history request IDs before dispatch - #1796

Merged
jlucaso1 merged 1 commit into
oxidezap:mainfrom
eternalwaitt:codex/history-request-id
Oct 26, 2026
Merged

jlucaso1 merged 1 commit into
oxidezap:mainfrom
eternalwaitt:codex/history-request-id

Conversation

@eternalwaitt

Copy link
Copy Markdown
Contributor

Problem

fetch_message_history generates the peer request ID internally but returns it only after the transport send finishes. An on-demand history reply can arrive before that await completes, so callers cannot durably bind the incoming peer_data_request_session_id to the request in time.

Change

  • Add fetch_message_history_with_id, accepting the library's validated MessageId.
  • Let callers generate and durably record the request ID before awaiting transport.
  • Keep fetch_message_history source-compatible: it generates an ID, delegates to the new method, and returns the same ID encoded on the outgoing stanza.
  • Preserve every existing on-demand history anchor field and send path.

The typed ID rejects empty values, and tracing continues to skip method arguments.

Validation

  • A supplied ID is encoded exactly as the outgoing stanza ID.
  • The existing API returns nonempty, unique IDs matching the wire.
  • Chat, anchor ID, direction, timestamp, count, and request type remain unchanged.
  • cargo clippy --locked -p whatsapp-rust --lib -- -D warnings

Compatibility line

PR #1791 remains an intentionally old compatibility ref used for exact downstream validation without taking unrelated generated API changes. This PR isolates the same history request-ID API on current main for normal upstream review and merge. The desktop pairing profile work remains separately reviewable in PR #1792.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-23T22:15:43.990823Z
We couldn’t complete this review. Comment @codex review to try again.
e4acdda PR opened
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f5c586cc-46fc-4325-8a0a-aa9a13ed5e80
📥 Commits

Reviewing files that changed from the base of the PR and between 9b9fdb7 and e4acdda.

📒 Files selected for processing: 1
  • src/pdo.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Summary

Summary by CodeRabbit

  • New Features
    • History synchronization requests now return a generated request ID, making it available to the caller.
    • You can also send a history synchronization request with an ID you provide. That ID is used for the outgoing request, giving callers control over its identifier while preserving the existing option to generate one automatically.

The history-sync-on-demand request builder is shared by both client APIs. fetch_message_history generates and returns a request ID. fetch_message_history_with_id sends the request with a caller-supplied ID.

Changes: History Sync Request IDs

Layer / File(s) Summary
Build history-sync requests
src/pdo.rs
A shared helper builds the PDO request from the chat, oldest-message anchor fields, and count. A test checks the request type and supplied fields.
Send requests with request IDs
src/pdo.rs
fetch_message_history generates and returns an ID. The new fetch_message_history_with_id accepts an ID, which the send path uses as the outgoing stanza ID. Tests check supplied IDs and generated ID uniqueness.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: jlucaso1

Merge Risk: ⚪ Minimal · up to e4acd

The request-ID change has no identified issue requiring a fix before merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description clearly explains the new fetch_message_history_with_id API, the request-ID timing problem, compatibility behavior, and validation results. It is directly related to the changeset.
Title check Passed The title clearly states the main change: exposing history request IDs before dispatch. It is concise and specific.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot requested a review from jlucaso1 October 23, 2026 22:16
@codspeed

codspeed Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 35.34%

3 warnings

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 116 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ Base and head ran on different runner types

Some benchmarks with significant performance changes were compared across different runner types, so the changes might not come from the code. Run base and head on the same runner type, or use CodSpeed Macro Runners for more stable results.

Learn more about Macro Runners

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 869 untouched benchmarks
⏩ 26 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory eight_clients[65536] 1.2 MB 1.8 MB -35.34%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing eternalwaitt:codex/history-request-id (e4acdda) with main (d73c3cc)

Open in CodSpeed

Footnotes

  1. 26 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@jlucaso1
jlucaso1 merged commit fed0cf3 into oxidezap:main Oct 26, 2026
44 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.

2 participants