Skip to content

fix(id/world_ssh): validate the /records drain cursor instead of trusting next_after (#6615) - #6739

Merged
dezren39 merged 1 commit into
mainfrom
queue/fb-6615-records-cursor
Nov 7, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/fb-6615-records-cursor

Conversation

@dezren39

@dezren39 dezren39 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Closes #6615

Summary

The SSH /records drain (pkgs/id/src/world_ssh.rs) trusted the host's next_after unchecked: .as_str() collapsed a present-but-non-string cursor to None — indistinguishable from a legitimate end-of-pages, so a malformed page rendered exactly like a complete listing — and continuation was gated only by the rendered-byte cap, so a repeated or empty cursor re-requested the same page ~18,700 times in the filing's probe. The drain now judges every page's cursor through a factored records_cursor() against the cursor that produced the page (new records_after session state, reset at drain start and on error):

  • absent/null next_after → listing complete (unchanged);
  • a string cursor that strictly advances → next page, as before;
  • a present, non-string cursor → drain stops with [records truncated: host sent a malformed next-page cursor];
  • a cursor that does not advance (repeat, backwards, or "" on the first page) → drain stops with [records truncated: host cursor did not advance].

A code comment at the validation site records why no separate page-count bound is needed beside the existing byte bound: with strict advance, every continuation moves forward through the host's key space so pages cannot repeat, and the rendered-byte total still caps the drain's size. Oracle: the world_net records cursor contract (#6505/#6578), per the issue's acceptance criteria.

Evidence

Merge Danger

Door: two-way — client-side drain validation only, single-commit revert.

Blast Radius: SSH command-mode /records sessions only. Well-formed hosts (string cursors that advance, null at the end) are unaffected; only malformed or non-advancing cursors change, from a silent fake-complete listing or an ~18,700-request loop to the rendered page plus an explicit truncation notice.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…non-advancing next_after stops the drain with a notice (#6615)
@dezren39
dezren39 requested a review from a team as a code owner November 7, 2026 03:37
@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 16012ede-5514-4cc8-b8d2-9cb6e05477da
Commits

Reviewing files that changed from the base of the PR and between be4040c and a4dde7a.

Files selected for processing: 1

  • pkgs/id/src/world_ssh.rs
  • 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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 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-07T03:40:03.583768Z a4dde7a 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.

@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: a4dde7a48b

ℹ️ 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 pkgs/id/src/world_ssh.rs
Comment on lines +1060 to 1062
self.records_after = Some(after.clone());
self.commands
.push_back(WorldCommand::RecordsContinue { prefix, after });

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 Track the cursor when its records request is dispatched

When two identical /records commands are pasted in one input frame, recv() queues both initial requests before their continuations, so the drains interleave. After the first drain's second page advances records_after to k2, the second drain's queued continuation still sends after: k1, but its valid next_after: k2 is compared against the shared k2 and falsely rejected as stalled. This clears the drain state and, for listings spanning four or more pages, leaves later pages unfetched. Set records_after from the dequeued RecordsContinue.after when dispatching the request, rather than from a continuation being enqueued, or serialize complete drains.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant